linux-f2fs-devel Mailing List for linux-f2fs
Brought to you by:
kjgkr
You can subscribe to this list here.
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(10) |
Dec
(98) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2013 |
Jan
(100) |
Feb
(72) |
Mar
(79) |
Apr
(122) |
May
(93) |
Jun
(97) |
Jul
(72) |
Aug
(72) |
Sep
(73) |
Oct
(121) |
Nov
(161) |
Dec
(206) |
| 2014 |
Jan
(75) |
Feb
(54) |
Mar
(82) |
Apr
(98) |
May
(67) |
Jun
(89) |
Jul
(136) |
Aug
(122) |
Sep
(136) |
Oct
(58) |
Nov
(87) |
Dec
(114) |
| 2015 |
Jan
(140) |
Feb
(129) |
Mar
(141) |
Apr
(71) |
May
(192) |
Jun
(52) |
Jul
(120) |
Aug
(125) |
Sep
(157) |
Oct
(100) |
Nov
(54) |
Dec
(248) |
| 2016 |
Jan
(301) |
Feb
(180) |
Mar
(138) |
Apr
(137) |
May
(145) |
Jun
(123) |
Jul
(98) |
Aug
(143) |
Sep
(196) |
Oct
(166) |
Nov
(205) |
Dec
(141) |
| 2017 |
Jan
(167) |
Feb
(275) |
Mar
(273) |
Apr
(239) |
May
(193) |
Jun
(171) |
Jul
(226) |
Aug
(153) |
Sep
(212) |
Oct
(311) |
Nov
(257) |
Dec
(418) |
| 2018 |
Jan
(474) |
Feb
(188) |
Mar
(252) |
Apr
(500) |
May
(176) |
Jun
(291) |
Jul
(361) |
Aug
(331) |
Sep
(355) |
Oct
(154) |
Nov
(209) |
Dec
(185) |
| 2019 |
Jan
(172) |
Feb
(214) |
Mar
(247) |
Apr
(425) |
May
(273) |
Jun
(360) |
Jul
(400) |
Aug
(409) |
Sep
(149) |
Oct
(218) |
Nov
(319) |
Dec
(225) |
| 2020 |
Jan
(231) |
Feb
(487) |
Mar
(411) |
Apr
(258) |
May
(292) |
Jun
(369) |
Jul
(407) |
Aug
(173) |
Sep
(266) |
Oct
(317) |
Nov
(273) |
Dec
(391) |
| 2021 |
Jan
(285) |
Feb
(130) |
Mar
(232) |
Apr
(156) |
May
(311) |
Jun
(252) |
Jul
(336) |
Aug
(326) |
Sep
(151) |
Oct
(86) |
Nov
(114) |
Dec
(125) |
| 2022 |
Jan
(132) |
Feb
(167) |
Mar
(230) |
Apr
(460) |
May
(334) |
Jun
(324) |
Jul
(147) |
Aug
(188) |
Sep
(262) |
Oct
(346) |
Nov
(314) |
Dec
(245) |
| 2023 |
Jan
(306) |
Feb
(190) |
Mar
(199) |
Apr
(444) |
May
(378) |
Jun
(441) |
Jul
(403) |
Aug
(464) |
Sep
(144) |
Oct
(98) |
Nov
(152) |
Dec
(212) |
| 2024 |
Jan
(288) |
Feb
(365) |
Mar
(218) |
Apr
(275) |
May
(200) |
Jun
(228) |
Jul
(255) |
Aug
(228) |
Sep
(280) |
Oct
(319) |
Nov
(241) |
Dec
(174) |
| 2025 |
Jan
(166) |
Feb
(171) |
Mar
(469) |
Apr
(235) |
May
(257) |
Jun
(342) |
Jul
(391) |
Aug
(328) |
Sep
(208) |
Oct
(254) |
Nov
(269) |
Dec
|
|
From: Jens A. <ax...@ke...> - 2025-11-25 19:20:12
|
On Mon, 24 Nov 2025 15:48:00 -0800, Chaitanya Kulkarni wrote:
> __blkdev_issue_discard() only returns value 0, that makes post call
> error checking code dead. This patch series revmoes this dead code at
> all the call sites and adjust the callers.
>
> Please note that it doesn't change the return type of the function from
> int to void in this series, it will be done once this series gets merged
> smoothly.
>
> [...]
Applied, thanks!
[1/6] block: ignore discard return value
(no commit info)
Best regards,
--
Jens Axboe
|
|
From: Jens A. <ax...@ke...> - 2025-11-25 19:19:24
|
On 11/25/25 12:09 PM, Chaitanya Kulkarni wrote: > On 11/25/25 09:38, Jens Axboe wrote: >> On 11/24/25 4:48 PM, Chaitanya Kulkarni wrote: >>> __blkdev_issue_discard() always returns 0, making the error check >>> in blkdev_issue_discard() dead code. >> Shouldn't it be a void instead then? >> > Yes, we have decided to clean up the callers first [1]. Once they are > merged safely, after rc1 I'll send a patch [2] to make it void since > it touches many different subsystems. OK, that make sense. I'll queue patch 1. -- Jens Axboe |
|
From: Chaitanya K. <cku...@gm...> - 2025-11-25 19:09:48
|
On 11/25/25 09:38, Jens Axboe wrote: > On 11/24/25 4:48 PM, Chaitanya Kulkarni wrote: >> __blkdev_issue_discard() always returns 0, making the error check >> in blkdev_issue_discard() dead code. > Shouldn't it be a void instead then? > Yes, we have decided to clean up the callers first [1]. Once they are merged safely, after rc1 I'll send a patch [2] to make it void since it touches many different subsystems. -ck [1] https://marc.info/?l=linux-block&m=176405170918235&w=2 https://marc.info/?l=dm-devel&m=176345232320530&w=2 [2] From abdf4d1863a02d4be816aaab9a789f44bfca568f Mon Sep 17 00:00:00 2001 From: Chaitanya Kulkarni <cku...@gm...> Date: Tue, 18 Nov 2025 10:35:58 -0800 Subject: [PATCH 6/6] block: change discar return type to void Now that all callers have been updated to not check the return value of __blkdev_issue_discard(), change its return type from int to void and remove the return 0 statement. This completes the cleanup of dead error checking code around __blkdev_issue_discard(). Signed-off-by: Chaitanya Kulkarni <cku...@gm...> --- block/blk-lib.c | 3 +-- include/linux/blkdev.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/block/blk-lib.c b/block/blk-lib.c index 19e0203cc18a..0a5f39325b2d 100644 --- a/block/blk-lib.c +++ b/block/blk-lib.c @@ -60,7 +60,7 @@ struct bio *blk_alloc_discard_bio(struct block_device *bdev, return bio; } -int __blkdev_issue_discard(struct block_device *bdev, sector_t sector, +void __blkdev_issue_discard(struct block_device *bdev, sector_t sector, sector_t nr_sects, gfp_t gfp_mask, struct bio **biop) { struct bio *bio; @@ -68,7 +68,6 @@ int __blkdev_issue_discard(struct block_device *bdev, sector_t sector, while ((bio = blk_alloc_discard_bio(bdev, §or, &nr_sects, gfp_mask))) *biop = bio_chain_and_submit(*biop, bio); - return 0; } EXPORT_SYMBOL(__blkdev_issue_discard); diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index f0ab02e0a673..b05c37d20b09 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1258,7 +1258,7 @@ extern void blk_io_schedule(void); int blkdev_issue_discard(struct block_device *bdev, sector_t sector, sector_t nr_sects, gfp_t gfp_mask); -int __blkdev_issue_discard(struct block_device *bdev, sector_t sector, +void __blkdev_issue_discard(struct block_device *bdev, sector_t sector, sector_t nr_sects, gfp_t gfp_mask, struct bio **biop); int blkdev_issue_secure_erase(struct block_device *bdev, sector_t sector, sector_t nr_sects, gfp_t gfp); -- 2.40.0 |
|
From: Jens A. <ax...@ke...> - 2025-11-25 18:01:01
|
On 11/24/25 4:48 PM, Chaitanya Kulkarni wrote: > __blkdev_issue_discard() always returns 0, making the error check > in blkdev_issue_discard() dead code. Shouldn't it be a void instead then? -- Jens Axboe |
|
From: Anuj g. <anu...@gm...> - 2025-11-25 13:21:33
|
Reviewed-by: Anuj Gupta <anu...@sa...> |
|
From: Sheng Y. <she...@gm...> - 2025-11-25 09:11:20
|
On 11/25/25 14:26, Yangyang Zang wrote:
> Commit 42482e81248f ("resize.f2fs: add caution message for resize")
> introduced the `-F' option to force resizing f2fs without displaying
> the caution message. And `add_default_options()` implies that `-g'
> enables `-F' for resize by default. However resize.f2fs does not
> currently support the `-g' option. This patch adds `-g' for it.
>
> Fixes: 42482e81248f ("resize.f2fs: add caution message for resize")
> Signed-off-by: Yangyang Zang <zan...@xi...>
Reviewed-by: Sheng Yong <she...@xi...>
|
|
From: Chao Yu <ch...@ke...> - 2025-11-25 07:12:07
|
On 11/25/2025 2:33 PM, Christoph Hellwig wrote: > On Tue, Nov 25, 2025 at 09:10:00AM +0800, Chao Yu wrote: >> Reviewed-by: Chao Yu <ch...@ke...> > > Sending these all as a series might be confusing - it would be good > if the individual patches get picked through the subsystem trees > so that the function signature can be cleaned up after -rc1. > > Can we get this queued up in the f2fs tree? Yes, I think it's clean to queue this patch into f2fs tree. Thanks, |
|
From: Chao Yu <ch...@ke...> - 2025-11-25 07:01:18
|
On 11/25/2025 2:26 PM, Yangyang Zang wrote:
> Commit 42482e81248f ("resize.f2fs: add caution message for resize")
> introduced the `-F' option to force resizing f2fs without displaying
> the caution message. And `add_default_options()` implies that `-g'
> enables `-F' for resize by default. However resize.f2fs does not
> currently support the `-g' option. This patch adds `-g' for it.
>
> Fixes: 42482e81248f ("resize.f2fs: add caution message for resize")
> Signed-off-by: Yangyang Zang <zan...@xi...>
Reviewed-by: Chao Yu <ch...@ke...>
Thanks,
|
|
From: Christoph H. <hc...@ls...> - 2025-11-25 06:34:13
|
On Tue, Nov 25, 2025 at 09:10:00AM +0800, Chao Yu wrote: > Reviewed-by: Chao Yu <ch...@ke...> Sending these all as a series might be confusing - it would be good if the individual patches get picked through the subsystem trees so that the function signature can be cleaned up after -rc1. Can we get this queued up in the f2fs tree? |
|
From: Yangyang Z. <zan...@gm...> - 2025-11-25 06:27:11
|
Commit 42482e81248f ("resize.f2fs: add caution message for resize")
introduced the `-F' option to force resizing f2fs without displaying
the caution message. And `add_default_options()` implies that `-g'
enables `-F' for resize by default. However resize.f2fs does not
currently support the `-g' option. This patch adds `-g' for it.
Fixes: 42482e81248f ("resize.f2fs: add caution message for resize")
Signed-off-by: Yangyang Zang <zan...@xi...>
---
Changes in v3:
- Update the resize.f2fs manual page
Changes in v2:
- Modify the commit message as suggested by shengyong
---
fsck/main.c | 11 ++++++++++-
man/resize.f2fs.8 | 7 +++++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/fsck/main.c b/fsck/main.c
index f7ef092..08d38d8 100644
--- a/fsck/main.c
+++ b/fsck/main.c
@@ -145,6 +145,9 @@ void resize_usage()
MSG(0, "[options]:\n");
MSG(0, " -d debug level [default:0]\n");
MSG(0, " -H support write hint\n");
+ MSG(0, " -f ignore errors during resize\n");
+ MSG(0, " -F force to resize\n");
+ MSG(0, " -g add default options\n");
MSG(0, " -o overprovision percentage [default:auto]\n");
MSG(0, " -s safe resize (Does not resize metadata)\n");
MSG(0, " -t target sectors [default: device size]\n");
@@ -640,7 +643,7 @@ void f2fs_parse_options(int argc, char *argv[])
#endif
} else if (!strcmp("resize.f2fs", prog)) {
#ifdef WITH_RESIZE
- const char *option_string = "d:fFHst:o:V";
+ const char *option_string = "d:fFg:Hst:o:V";
c.func = RESIZE;
while ((option = getopt(argc, argv, option_string)) != EOF) {
@@ -664,6 +667,12 @@ void f2fs_parse_options(int argc, char *argv[])
c.force = 1;
MSG(0, "Info: Force to resize\n");
break;
+ case 'g':
+ if (!strcmp(optarg, "android")) {
+ c.defset = CONF_ANDROID;
+ MSG(0, "Info: Set conf for android\n");
+ }
+ break;
case 'H':
c.need_whint = true;
c.whint = WRITE_LIFE_NOT_SET;
diff --git a/man/resize.f2fs.8 b/man/resize.f2fs.8
index 5b6daf5..5ffc5d5 100644
--- a/man/resize.f2fs.8
+++ b/man/resize.f2fs.8
@@ -24,6 +24,10 @@ resize.f2fs \- resize filesystem size
.B \-F
]
[
+.B \-g
+.I specific environment
+]
+[
.B \-H
]
[
@@ -65,6 +69,9 @@ Force to fix any inconsistent data during resize.
.BI \-F
Skip caution dialogue and resize partition directly.
.TP
+.BI \-g
+Set default options for specific environment
+.TP
.BI \-H
Specify support write hint.
.TP
--
2.43.2
|
|
From: Chao Yu <ch...@ke...> - 2025-11-25 01:38:48
|
On 11/22/2025 9:17 AM, Jaegeuk Kim wrote:
> On 11/21, Chao Yu wrote:
>> On 11/21/2025 7:54 AM, Jaegeuk Kim via Linux-f2fs-devel wrote:
>>> This patch enables large folio for limited case where we can get the high-order
>>> memory allocation. It supports the encrypted and fsverity files, which are
>>> essential for Android environment.
>>>
>>> How to test:
>>> - dd if=/dev/zero of=/mnt/test/test bs=1G count=4
>>> - f2fs_io setflags immutable /mnt/test/test
>>> - echo 3 > /proc/sys/vm/drop_caches
>>> : to reload inode with large folio
>>> - f2fs_io read 32 0 1024 mmap 0 0 /mnt/test/test
>>>
>>> Signed-off-by: Jaegeuk Kim <ja...@ke...>
>>> ---
>>> fs/f2fs/data.c | 245 ++++++++++++++++++++++++++++++++++++++++++++++--
>>> fs/f2fs/f2fs.h | 16 ++++
>>> fs/f2fs/inode.c | 6 +-
>>> 3 files changed, 257 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
>>> index 48c20386f031..8f433677c49d 100644
>>> --- a/fs/f2fs/data.c
>>> +++ b/fs/f2fs/data.c
>>> @@ -31,9 +31,15 @@
>>> static struct kmem_cache *bio_post_read_ctx_cache;
>>> static struct kmem_cache *bio_entry_slab;
>>> +static struct kmem_cache *ffs_entry_slab;
>>> static mempool_t *bio_post_read_ctx_pool;
>>> static struct bio_set f2fs_bioset;
>>> +struct f2fs_folio_state {
>>> + spinlock_t state_lock;
>>> + unsigned int read_pages_pending;
>>> +};
>>> +
>>> #define F2FS_BIO_POOL_SIZE NR_CURSEG_TYPE
>>> int __init f2fs_init_bioset(void)
>>> @@ -138,11 +144,15 @@ static void f2fs_finish_read_bio(struct bio *bio, bool in_task)
>>> {
>>> struct folio_iter fi;
>>> struct bio_post_read_ctx *ctx = bio->bi_private;
>>> + unsigned long flags;
>>> bio_for_each_folio_all(fi, bio) {
>>> struct folio *folio = fi.folio;
>>> + unsigned nr_pages = fi.length >> PAGE_SHIFT;
>>> + bool finished = true;
>>> - if (f2fs_is_compressed_page(folio)) {
>>> + if (!folio_test_large(folio) &&
>>> + f2fs_is_compressed_page(folio)) {
>>> if (ctx && !ctx->decompression_attempted)
>>> f2fs_end_read_compressed_page(folio, true, 0,
>>> in_task);
>>> @@ -156,8 +166,20 @@ static void f2fs_finish_read_bio(struct bio *bio, bool in_task)
>>> bio->bi_status = BLK_STS_IOERR;
>>> }
>>> - dec_page_count(F2FS_F_SB(folio), __read_io_type(folio));
>>> - folio_end_read(folio, bio->bi_status == BLK_STS_OK);
>>> + if (folio_test_large(folio)) {
>>> + struct f2fs_folio_state *ffs = folio->private;
>>> +
>>> + spin_lock_irqsave(&ffs->state_lock, flags);
>>> + ffs->read_pages_pending -= nr_pages;
>>> + finished = !ffs->read_pages_pending;
>>> + spin_unlock_irqrestore(&ffs->state_lock, flags);
>>> + }
>>> +
>>> + while (nr_pages--)
>>> + dec_page_count(F2FS_F_SB(folio), __read_io_type(folio));
>>> +
>>> + if (finished)
>>> + folio_end_read(folio, bio->bi_status == BLK_STS_OK);
>>> }
>>> if (ctx)
>>> @@ -518,6 +540,9 @@ static bool f2fs_crypt_mergeable_bio(struct bio *bio, const struct inode *inode,
>>> void f2fs_submit_read_bio(struct f2fs_sb_info *sbi, struct bio *bio,
>>> enum page_type type)
>>> {
>>> + if (!bio)
>>> + return;
>>> +
>>> WARN_ON_ONCE(!is_read_io(bio_op(bio)));
>>> trace_f2fs_submit_read_bio(sbi->sb, type, bio);
>>> @@ -1209,11 +1234,21 @@ struct folio *f2fs_get_read_data_folio(struct inode *inode, pgoff_t index,
>>> struct dnode_of_data dn;
>>> struct folio *folio;
>>> int err;
>>> -
>>> +retry:
>>> folio = f2fs_grab_cache_folio(mapping, index, for_write);
>>> if (IS_ERR(folio))
>>> return folio;
>>> + if (folio_test_large(folio)) {
>>> + pgoff_t folio_index = mapping_align_index(mapping, index);
>>> +
>>> + f2fs_folio_put(folio, true);
>>> + invalidate_inode_pages2_range(mapping, folio_index,
>>> + folio_index + folio_nr_pages(folio) - 1);
>>> + f2fs_schedule_timeout(DEFAULT_SCHEDULE_TIMEOUT);
>>> + goto retry;
>>> + }
>>
>> Do we need to move above check into f2fs_grab_cache_folio()? as we call
>> f2fs_grab_cache_folio() in a lot of place.
>
> We're okay with high-order allocation in other path, but I think this is
> the only problem since it goes to GC writes.
Oh, right.
>
>>
>>> +
>>> if (f2fs_lookup_read_extent_cache_block(inode, index,
>>> &dn.data_blkaddr)) {
>>> if (!f2fs_is_valid_blkaddr(F2FS_I_SB(inode), dn.data_blkaddr,
>>> @@ -2341,6 +2376,177 @@ int f2fs_read_multi_pages(struct compress_ctx *cc, struct bio **bio_ret,
>>> }
>>> #endif
>>> +static struct f2fs_folio_state *ffs_find_or_alloc(struct folio *folio)
>>> +{
>>> + struct f2fs_folio_state *ffs = folio->private;
>>> +
>>> + if (ffs)
>>> + return ffs;
>>> +
>>> + ffs = f2fs_kmem_cache_alloc(ffs_entry_slab, GFP_NOIO, true, NULL);
>>> +
>>> + spin_lock_init(&ffs->state_lock);
>>> + folio_attach_private(folio, ffs);
>>> + return ffs;
>>> +}
>>> +
>>> +static void ffs_detach_free(struct folio *folio)
>>> +{
>>> + struct f2fs_folio_state *ffs;
>>> +
>>> + if (!folio_test_large(folio)) {
>>> + folio_detach_private(folio);
>>> + return;
>>> + }
>>> +
>>> + ffs = folio_detach_private(folio);
>>> + if (!ffs)
>>> + return;
>>> +
>>> + WARN_ON_ONCE(ffs->read_pages_pending != 0);
>>> + kmem_cache_free(ffs_entry_slab, ffs);
>>> +}
>>> +
>>> +static int f2fs_read_data_large_folio(struct inode *inode,
>>> + struct readahead_control *rac, struct folio *folio)
>>> +{
>>> + struct bio *bio = NULL;
>>> + sector_t last_block_in_bio = 0;
>>> + struct f2fs_map_blocks map;
>>> + pgoff_t index, offset;> + unsigned max_nr_pages = rac ? readahead_count(rac) :
>>> + folio_nr_pages(folio);
>>> + unsigned nrpages;
>>> + struct f2fs_folio_state *ffs;
>>> + int ret = 0;
>>> +
>>> + if (f2fs_compressed_file(inode))
>>> + return -EOPNOTSUPP;
>>
>> if (!IS_IMMUTABLE(inode))
>> return -EOPNOTSUPP;
>>
>> We can configure inode after this check? Can we add some sanity check to prevent
>> enabling compress/immutable/quota if inode has already enabled large folio?
>
> I think immutable will prevent most of the changes?
Someone can drop immutable flag after above check condition in parallel?
Do we need to cover read() w/ inode_lock_shared() to prevent f2fs_fileattr_set
/w non-immutable flag concurrently?
Thanks,
>
>>
>>> +
>>> + memset(&map, 0, sizeof(map));
>>
>> Can be replaced w/ struct f2fs_map_blocks map = {0, };
>>
>>> + map.m_seg_type = NO_CHECK_TYPE;
>>> +
>>> + if (rac)
>>> + folio = readahead_folio(rac);
>>> +next_folio:
>>> + if (!folio)
>>> + goto out;
>>> +
>>> + index = folio->index;
>>> + offset = 0;
>>> + ffs = NULL;
>>> + nrpages = folio_nr_pages(folio);
>>> +
>>> + for (; nrpages; nrpages--) {
>>> + sector_t block_nr;
>>> + /*
>>> + * Map blocks using the previous result first.
>>> + */
>>> + if ((map.m_flags & F2FS_MAP_MAPPED) &&
>>> + index > map.m_lblk &&
>>> + index < (map.m_lblk + map.m_len))
>>> + goto got_it;
>>> +
>>> + /*
>>> + * Then do more f2fs_map_blocks() calls until we are
>>> + * done with this page.
>>> + */
>>> + memset(&map, 0, sizeof(map));
>>> + map.m_seg_type = NO_CHECK_TYPE;
>>> + map.m_lblk = index;
>>> + map.m_len = max_nr_pages;
>>> +
>>> + ret = f2fs_map_blocks(inode, &map, F2FS_GET_BLOCK_DEFAULT);
>>> + if (ret)
>>> + goto err_out;
>>> +got_it:
>>> + if ((map.m_flags & F2FS_MAP_MAPPED)) {
>>> + block_nr = map.m_pblk + index - map.m_lblk;
>>> + if (!f2fs_is_valid_blkaddr(F2FS_I_SB(inode), block_nr,
>>> + DATA_GENERIC_ENHANCE_READ)) {
>>> + ret = -EFSCORRUPTED;
>>> + goto err_out;
>>> + }
>>> + } else {
>>> + folio_zero_range(folio, offset << PAGE_SHIFT, PAGE_SIZE);
>>> + if (f2fs_need_verity(inode, index) &&
>>> + !fsverity_verify_page(folio_file_page(folio,
>>> + index))) {
>>> + ret = -EIO;
>>> + goto err_out;
>>> + }
>>> + continue;
>>> + }
>>> +
>>> + /*
>>> + * This page will go to BIO. Do we need to send this
>>> + * BIO off first?
>>> + */
>>> + if (bio && (!page_is_mergeable(F2FS_I_SB(inode), bio,
>>> + last_block_in_bio, block_nr) ||
>>> + !f2fs_crypt_mergeable_bio(bio, inode, index, NULL))) {
>>> +submit_and_realloc:
>>> + f2fs_submit_read_bio(F2FS_I_SB(inode), bio, DATA);
>>> + bio = NULL;
>>> + }
>>> + if (bio == NULL)
>>> + bio = f2fs_grab_read_bio(inode, block_nr,
>>> + max_nr_pages,
>>> + f2fs_ra_op_flags(rac),
>>> + index, false);
>>> +
>>> + /*
>>> + * If the page is under writeback, we need to wait for
>>> + * its completion to see the correct decrypted data.
>>> + */
>>> + f2fs_wait_on_block_writeback(inode, block_nr);
>>> +
>>> + if (!bio_add_folio(bio, folio, F2FS_BLKSIZE,
>>> + offset << PAGE_SHIFT))> + goto submit_and_realloc;
>>> +
>>> + if (folio_test_large(folio)) {
>>> + ffs = ffs_find_or_alloc(folio);
>>> +
>>> + /* set the bitmap to wait */
>>> + spin_lock_irq(&ffs->state_lock);
>>> + ffs->read_pages_pending++;
>>> + spin_unlock_irq(&ffs->state_lock);
>>> + }
>>> +
>>> + inc_page_count(F2FS_I_SB(inode), F2FS_RD_DATA);
>>> + f2fs_update_iostat(F2FS_I_SB(inode), NULL, FS_DATA_READ_IO,
>>> + F2FS_BLKSIZE);
>>> + last_block_in_bio = block_nr;
>>> + index++;
>>> + offset++;
>>> + }
>>> + if (rac) {
>>> + folio = readahead_folio(rac);
>>> + goto next_folio;
>>> + }
>>> +err_out:
>>> + /* Nothing was submitted. */
>>> + if (!bio) {
>>> + if (!ret)
>>> + folio_mark_uptodate(folio);
>>> + folio_unlock(folio);
>>> + return ret;
>>> + }
>>> +
>>> + if (ret) {
>>> + f2fs_submit_read_bio(F2FS_I_SB(inode), bio, DATA);
>>> +
>>> + /* Wait bios and clear uptodate. */
>>> + folio_lock(folio);
>>> + folio_clear_uptodate(folio);
>>> + folio_unlock(folio);
>>> + }
>>> +out:
>>> + f2fs_submit_read_bio(F2FS_I_SB(inode), bio, DATA);
>>> + return ret;
>>> +}
>>> +
>>> /*
>>> * This function was originally taken from fs/mpage.c, and customized for f2fs.
>>> * Major change was from block_size == page_size in f2fs by default.
>>> @@ -2366,9 +2572,13 @@ static int f2fs_mpage_readpages(struct inode *inode,
>>> pgoff_t index;
>>> #endif
>>> unsigned nr_pages = rac ? readahead_count(rac) : 1;
>>> + struct address_space *mapping = rac ? rac->mapping : folio->mapping;
>>> unsigned max_nr_pages = nr_pages;
>>> int ret = 0;
>>> + if (mapping_large_folio_support(mapping))
>>> + return f2fs_read_data_large_folio(inode, rac, folio);
>>> +
>>> #ifdef CONFIG_F2FS_FS_COMPRESSION
>>> if (f2fs_compressed_file(inode)) {
>>> index = rac ? readahead_index(rac) : folio->index;
>>> @@ -2459,8 +2669,7 @@ static int f2fs_mpage_readpages(struct inode *inode,
>>> }
>>> #endif
>>> }
>>> - if (bio)
>>> - f2fs_submit_read_bio(F2FS_I_SB(inode), bio, DATA);
>>> + f2fs_submit_read_bio(F2FS_I_SB(inode), bio, DATA);
>>> return ret;
>>> }
>>> @@ -3747,7 +3956,12 @@ void f2fs_invalidate_folio(struct folio *folio, size_t offset, size_t length)
>>> f2fs_remove_dirty_inode(inode);
>>> }
>>> }
>>> - folio_detach_private(folio);
>>> +
>>> + if (offset || length != folio_size(folio))
>>> + return;
>>> +
>>> + folio_cancel_dirty(folio);
>>> + ffs_detach_free(folio);
>>> }
>>> bool f2fs_release_folio(struct folio *folio, gfp_t wait)
>>> @@ -3756,7 +3970,7 @@ bool f2fs_release_folio(struct folio *folio, gfp_t wait)
>>> if (folio_test_dirty(folio))
>>> return false;
>>> - folio_detach_private(folio);
>>> + ffs_detach_free(folio);
>>> return true;
>>> }
>>> @@ -4162,12 +4376,25 @@ int __init f2fs_init_bio_entry_cache(void)
>>> {
>>> bio_entry_slab = f2fs_kmem_cache_create("f2fs_bio_entry_slab",
>>> sizeof(struct bio_entry));
>>> - return bio_entry_slab ? 0 : -ENOMEM;
>>> +
>>> + if (!bio_entry_slab)
>>> + return -ENOMEM;
>>> +
>>> + ffs_entry_slab = f2fs_kmem_cache_create("f2fs_ffs_slab",
>>> + sizeof(struct f2fs_folio_state));
>>> +
>>> + if (!ffs_entry_slab) {
>>> + kmem_cache_destroy(bio_entry_slab);
>>> + return -ENOMEM;
>>> + }
>>> +
>>> + return 0;
>>> }
>>> void f2fs_destroy_bio_entry_cache(void)
>>> {
>>> kmem_cache_destroy(bio_entry_slab);
>>> + kmem_cache_destroy(ffs_entry_slab);
>>> }
>>> static int f2fs_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
>>> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
>>> index dffe8958b580..3340db04a7c2 100644
>>> --- a/fs/f2fs/f2fs.h
>>> +++ b/fs/f2fs/f2fs.h
>>> @@ -4916,6 +4916,22 @@ static inline bool is_journalled_quota(struct f2fs_sb_info *sbi)
>>> return false;
>>> }
>>> +static inline bool f2fs_quota_file(struct inode *inode)
>>> +{
>>> +#ifdef CONFIG_QUOTA
>>> + int i;
>>> +
>>> + if (!f2fs_sb_has_quota_ino(F2FS_I_SB(inode)))
>>> + return false;
>>> +
>>> + for (i = 0; i < MAXQUOTAS; i++) {
>>> + if (f2fs_qf_ino(F2FS_I_SB(inode)->sb, i) == inode->i_ino)
>>> + return true;
>>> + }
>>> +#endif
>>> + return false;
>>> +}
>>> +
>>> static inline bool f2fs_block_unit_discard(struct f2fs_sb_info *sbi)
>>> {
>>> return F2FS_OPTION(sbi).discard_unit == DISCARD_UNIT_BLOCK;
>>> diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
>>> index e2405b79b3cc..9162154d5211 100644
>>> --- a/fs/f2fs/inode.c
>>> +++ b/fs/f2fs/inode.c
>>> @@ -597,6 +597,8 @@ struct inode *f2fs_iget(struct super_block *sb, unsigned long ino)
>>> if (ret)
>>> goto bad_inode;
>>> make_now:
>>> + f2fs_set_inode_flags(inode);
>>> +
>>> if (ino == F2FS_NODE_INO(sbi)) {
>>> inode->i_mapping->a_ops = &f2fs_node_aops;
>>> mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS);
>>> @@ -618,6 +620,9 @@ struct inode *f2fs_iget(struct super_block *sb, unsigned long ino)
>>> inode->i_op = &f2fs_file_inode_operations;
>>> inode->i_fop = &f2fs_file_operations;
>>> inode->i_mapping->a_ops = &f2fs_dblock_aops;
>>> + if (IS_IMMUTABLE(inode) && !f2fs_compressed_file(inode) &&
>>> + !f2fs_quota_file(inode))
>>> + mapping_set_folio_min_order(inode->i_mapping, 0);
>>> } else if (S_ISDIR(inode->i_mode)) {
>>> inode->i_op = &f2fs_dir_inode_operations;
>>> inode->i_fop = &f2fs_dir_operations;
>>> @@ -638,7 +643,6 @@ struct inode *f2fs_iget(struct super_block *sb, unsigned long ino)
>>> ret = -EIO;
>>> goto bad_inode;
>>> }
>>> - f2fs_set_inode_flags(inode);
>>> unlock_new_inode(inode);
>>> trace_f2fs_iget(inode);
|
|
From: Chao Yu <ch...@ke...> - 2025-11-25 01:26:16
|
On 11/24/2025 4:42 PM, Yangyang Zang wrote:
> Commit 42482e81248f ("resize.f2fs: add caution message for resize")
> introduced the `-F' option to force resizing f2fs without displaying
> the caution message. And `add_default_options()` implies that `-g'
> enables `-F' for resize by default. However resize.f2fs does not
> currently support the `-g' option. This patch adds `-g' for it.
>
> Fixes: 42482e81248f ("resize.f2fs: add caution message for resize")
> Signed-off-by: Yangyang Zang <zan...@xi...>
> ---
> Changes in v2:
> - Modify the commit message as suggested by shengyong
> ---
> fsck/main.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/fsck/main.c b/fsck/main.c
> index f7ef092..08d38d8 100644
> --- a/fsck/main.c
> +++ b/fsck/main.c
> @@ -145,6 +145,9 @@ void resize_usage()
> MSG(0, "[options]:\n");
> MSG(0, " -d debug level [default:0]\n");
> MSG(0, " -H support write hint\n");
> + MSG(0, " -f ignore errors during resize\n");
> + MSG(0, " -F force to resize\n");
> + MSG(0, " -g add default options\n");
Need to update manual page of resize.f2fs as well?
Thanks,
> MSG(0, " -o overprovision percentage [default:auto]\n");
> MSG(0, " -s safe resize (Does not resize metadata)\n");
> MSG(0, " -t target sectors [default: device size]\n");
> @@ -640,7 +643,7 @@ void f2fs_parse_options(int argc, char *argv[])
> #endif
> } else if (!strcmp("resize.f2fs", prog)) {
> #ifdef WITH_RESIZE
> - const char *option_string = "d:fFHst:o:V";
> + const char *option_string = "d:fFg:Hst:o:V";
>
> c.func = RESIZE;
> while ((option = getopt(argc, argv, option_string)) != EOF) {
> @@ -664,6 +667,12 @@ void f2fs_parse_options(int argc, char *argv[])
> c.force = 1;
> MSG(0, "Info: Force to resize\n");
> break;
> + case 'g':
> + if (!strcmp(optarg, "android")) {
> + c.defset = CONF_ANDROID;
> + MSG(0, "Info: Set conf for android\n");
> + }
> + break;
> case 'H':
> c.need_whint = true;
> c.whint = WRITE_LIFE_NOT_SET;
|
|
From: Chao Yu <ch...@ke...> - 2025-11-25 01:10:10
|
On 11/25/2025 7:48 AM, Chaitanya Kulkarni wrote: > __blkdev_issue_discard() always returns 0, making the error assignment > in __submit_discard_cmd() dead code. > > Initialize err to 0 and remove the error assignment from the > __blkdev_issue_discard() call to err. Move fault injection code into > already present if branch where err is set to -EIO. > > This preserves the fault injection behavior while removing dead error > handling. > > Reviewed-by: Martin K. Petersen <mar...@or...> > Reviewed-by: Johannes Thumshirn <joh...@wd...> > Reviewed-by: Christoph Hellwig <hc...@ls...> > Signed-off-by: Chaitanya Kulkarni <cku...@gm...> Reviewed-by: Chao Yu <ch...@ke...> Thanks, |
|
From: Chao Yu <ch...@ke...> - 2025-11-25 01:06:33
|
On 11/17/2025 8:27 PM, Masaharu Noguchi wrote: > Sphinx's LaTeX builder fails when converting the nested ASCII tables in > f2fs.rst, producing the following error: > > "Markup is unsupported in LaTeX: longtable does not support nesting a table." > > Wrap the affected ASCII tables in literal code blocks to force Sphinx to > render them verbatim. This prevents nested longtables and fixes the PDF > build failure on Sphinx 8.2.x. > > Acked-by: Bagas Sanjaya <bag...@gm...> > Reviewed-by: Akira Yokosawa <ak...@gm...> > Signed-off-by: Masaharu Noguchi <no...@gm...> Reviewed-by: Chao Yu <ch...@ke...> Thanks, |
|
From: Chao Yu <ch...@ke...> - 2025-11-25 01:05:58
|
On 11/21/2025 10:42 AM, Xiaole He wrote:
> 1. Fix typo in HAVE_PREAD macro check (lib/libf2fs_io.c:403):
> - Change HAVE_RPEAD -> HAVE_PREAD
> - The misspelled macro caused pread() optimization to never be used,
> forcing the code to always use the slower lseek() + read() path
> instead of the atomic pread() call.
>
> 2. Remove duplicate semicolons:
> - mkfs/f2fs_format.c:211: Remove extra semicolon in hot_ext_count assignment
> - fsck/dump.c:119: Remove extra semicolon in free_segs initialization
>
> These are minor code quality fixes that don't change functionality but
> improve code correctness and enable the pread() optimization.
>
> Fixes: 4b7e95300988 ("f2fs-tools: use pread and pwrite when they are available.")
> Signed-off-by: Xiaole He <hex...@12...>
Reviewed-by: Chao Yu <ch...@ke...>
Thanks,
|
|
From: Chao Yu <ch...@ke...> - 2025-11-25 01:05:08
|
On 11/19/2025 2:00 PM, Xiaole He wrote:
> The code was checking for a non-existent macro `HDIO_GETGIO` instead of
> `HDIO_GETGEO`, which caused the ioctl() call to never be executed.
> This resulted in start_sector always being set to 0, even when the
> partition actually starts at a different sector (e.g., 2048).
>
> This bug affects:
> - lib/libf2fs.c: get_device_info() function (lines 967, 1076)
> - tools/fibmap.c: stat_bdev() function (lines 91, 108)
>
> Reproducer:
> 1. Create a partition starting at sector 2048:
> # parted -s /dev/sdb mklabel gpt
> # parted -s /dev/sdb mkpart primary 2048s 32GiB
>
> 2. Verify the partition start sector:
> # cat /sys/block/sdb/sdb1/start
> 2048
>
> 3. Format with f2fs-tools (before fix) and verify incorrect calculation:
> # mkfs.f2fs /dev/sdb1
> # Info: zone aligned segment0 blkaddr: 512
>
> The calculation happens in
> mkfs/f2fs_format.c:f2fs_prepare_super_block():
>
> With default values:
> - blk_size_bytes = 4096
> - c.blks_per_seg = 512
> - c.segs_per_sec = 1
> - c.secs_per_zone = 1
> - zone_size_bytes = blk_size_bytes * c.secs_per_zone
> * c.segs_per_sec * c.blks_per_seg
> = 4096 * 1 * 1 * 512 = 2,097,152 bytes (2MB)
> - alignment_bytes = zone_size_bytes (for non-zoned or single device)
>
> With c.start_sector = 0 (bug case):
> - zone_align_start_offset
> = ((c.start_sector * DEFAULT_SECTOR_SIZE +
> 2 * F2FS_BLKSIZE + alignment_bytes - 1) /
> alignment_bytes * alignment_bytes) -
> (c.start_sector * DEFAULT_SECTOR_SIZE)
> = ((0 * 512 + 2 * 4096 + 2,097,152 - 1) /
> 2,097,152 * 2,097,152) - (0 * 512)
> = ((8,192 + 2,097,152 - 1) / 2,097,152 * 2,097,152) - 0
> = 2,097,152 - 0 = 2,097,152 bytes (2MB)
> - segment0_blkaddr = zone_align_start_offset / blk_size_bytes
> = 2,097,152 / 4,096 = 512 blocks
>
> This matches the output "segment0 blkaddr: 512".
>
> With c.start_sector = 2048 (correct case):
> - zone_align_start_offset
> = ((2048 * 512 + 2 * 4096 + 2,097,152 - 1) /
> 2,097,152 * 2,097,152) - (2048 * 512)
> = ((1,048,576 + 8,192 + 2,097,152 - 1) /
> 2,097,152 * 2,097,152) - 1,048,576
> = 2,097,152 - 1,048,576 = 1,048,576 bytes (1MB)
> - segment0_blkaddr = zone_align_start_offset / blk_size_bytes
> = 1,048,576 / 4,096 = 256 blocks
>
> 4. Confirm the bug with gdb:
> So the correct output should be "segment0 blkaddr: 256", not 512.
>
> # gdb --args mkfs.f2fs /dev/sdb1
> (gdb) b lib/libf2fs.c:1075
> (gdb) run
> 1075 if (i == 0) {
> (gdb) l
> 1075 if (i == 0) {
> 1076 #ifdef HDIO_GETGIO
> 1077 if (ioctl(fd, HDIO_GETGEO, &geom) < 0)
> 1078 c.start_sector = 0;
> 1079 else
> 1080 c.start_sector = geom.start;
> 1081 #else
> 1082 c.start_sector = 0;
> 1083 #endif
> 1084 }
> (gdb) n
> 1082 c.start_sector = 0;
> # At line 1076: #ifdef HDIO_GETGIO (bug - this macro doesn't exist)
> # The ioctl() call at line 1077 is skipped, and execution goes
> # directly to line 1082, setting c.start_sector = 0
>
> After fix:
> mkfs.f2fs output:
> Info: zone aligned segment0 blkaddr: 256
>
> gdb output:
> (gdb) p c.start_sector
> $1 = 2048
>
> The ioctl() correctly retrieves the partition start sector (2048),
> and zone_align_start_offset is calculated correctly, resulting in
> segment0_blkaddr = 256.
>
> Fixes: 43bb7b6c99fa ("f2fs-tools: build binaries in Mac")
> Signed-off-by: Xiaole He <hex...@12...>
Nice catch and analysis!
Reviewed-by: Chao Yu <ch...@ke...>
Thanks,
|
|
From: Chaitanya K. <cku...@gm...> - 2025-11-24 23:48:40
|
__blkdev_issue_discard() always returns 0, making all error checking
in XFS discard functions dead code.
Change xfs_discard_extents() return type to void, remove error variable,
error checking, and error logging for the __blkdev_issue_discard() call
in same function.
Update xfs_trim_perag_extents() and xfs_trim_rtgroup_extents() to
ignore the xfs_discard_extents() return value and error checking
code.
Update xfs_discard_rtdev_extents() to ignore __blkdev_issue_discard()
return value and error checking code.
Reviewed-by: Johannes Thumshirn <joh...@wd...>
Reviewed-by: Christoph Hellwig <hc...@ls...>
Signed-off-by: Chaitanya Kulkarni <cku...@gm...>
---
fs/xfs/xfs_discard.c | 27 +++++----------------------
fs/xfs/xfs_discard.h | 2 +-
2 files changed, 6 insertions(+), 23 deletions(-)
diff --git a/fs/xfs/xfs_discard.c b/fs/xfs/xfs_discard.c
index 6917de832191..b6ffe4807a11 100644
--- a/fs/xfs/xfs_discard.c
+++ b/fs/xfs/xfs_discard.c
@@ -108,7 +108,7 @@ xfs_discard_endio(
* list. We plug and chain the bios so that we only need a single completion
* call to clear all the busy extents once the discards are complete.
*/
-int
+void
xfs_discard_extents(
struct xfs_mount *mp,
struct xfs_busy_extents *extents)
@@ -116,7 +116,6 @@ xfs_discard_extents(
struct xfs_extent_busy *busyp;
struct bio *bio = NULL;
struct blk_plug plug;
- int error = 0;
blk_start_plug(&plug);
list_for_each_entry(busyp, &extents->extent_list, list) {
@@ -126,18 +125,10 @@ xfs_discard_extents(
trace_xfs_discard_extent(xg, busyp->bno, busyp->length);
- error = __blkdev_issue_discard(btp->bt_bdev,
+ __blkdev_issue_discard(btp->bt_bdev,
xfs_gbno_to_daddr(xg, busyp->bno),
XFS_FSB_TO_BB(mp, busyp->length),
GFP_KERNEL, &bio);
- if (error && error != -EOPNOTSUPP) {
- xfs_info(mp,
- "discard failed for extent [0x%llx,%u], error %d",
- (unsigned long long)busyp->bno,
- busyp->length,
- error);
- break;
- }
}
if (bio) {
@@ -148,8 +139,6 @@ xfs_discard_extents(
xfs_discard_endio_work(&extents->endio_work);
}
blk_finish_plug(&plug);
-
- return error;
}
/*
@@ -385,9 +374,7 @@ xfs_trim_perag_extents(
* list after this function call, as it may have been freed by
* the time control returns to us.
*/
- error = xfs_discard_extents(pag_mount(pag), extents);
- if (error)
- break;
+ xfs_discard_extents(pag_mount(pag), extents);
if (xfs_trim_should_stop())
break;
@@ -496,12 +483,10 @@ xfs_discard_rtdev_extents(
trace_xfs_discard_rtextent(mp, busyp->bno, busyp->length);
- error = __blkdev_issue_discard(bdev,
+ __blkdev_issue_discard(bdev,
xfs_rtb_to_daddr(mp, busyp->bno),
XFS_FSB_TO_BB(mp, busyp->length),
GFP_NOFS, &bio);
- if (error)
- break;
}
xfs_discard_free_rtdev_extents(tr);
@@ -741,9 +726,7 @@ xfs_trim_rtgroup_extents(
* list after this function call, as it may have been freed by
* the time control returns to us.
*/
- error = xfs_discard_extents(rtg_mount(rtg), tr.extents);
- if (error)
- break;
+ xfs_discard_extents(rtg_mount(rtg), tr.extents);
low = tr.restart_rtx;
} while (!xfs_trim_should_stop() && low <= high);
diff --git a/fs/xfs/xfs_discard.h b/fs/xfs/xfs_discard.h
index 2b1a85223a56..8c5cc4af6a07 100644
--- a/fs/xfs/xfs_discard.h
+++ b/fs/xfs/xfs_discard.h
@@ -6,7 +6,7 @@ struct fstrim_range;
struct xfs_mount;
struct xfs_busy_extents;
-int xfs_discard_extents(struct xfs_mount *mp, struct xfs_busy_extents *busy);
+void xfs_discard_extents(struct xfs_mount *mp, struct xfs_busy_extents *busy);
int xfs_ioc_trim(struct xfs_mount *mp, struct fstrim_range __user *fstrim);
#endif /* XFS_DISCARD_H */
--
2.40.0
|
|
From: Chaitanya K. <cku...@gm...> - 2025-11-24 23:48:34
|
__blkdev_issue_discard() always returns 0, making the error assignment
in __submit_discard_cmd() dead code.
Initialize err to 0 and remove the error assignment from the
__blkdev_issue_discard() call to err. Move fault injection code into
already present if branch where err is set to -EIO.
This preserves the fault injection behavior while removing dead error
handling.
Reviewed-by: Martin K. Petersen <mar...@or...>
Reviewed-by: Johannes Thumshirn <joh...@wd...>
Reviewed-by: Christoph Hellwig <hc...@ls...>
Signed-off-by: Chaitanya Kulkarni <cku...@gm...>
---
fs/f2fs/segment.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index b45eace879d7..22b736ec9c51 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1343,15 +1343,9 @@ static int __submit_discard_cmd(struct f2fs_sb_info *sbi,
dc->di.len += len;
+ err = 0;
if (time_to_inject(sbi, FAULT_DISCARD)) {
err = -EIO;
- } else {
- err = __blkdev_issue_discard(bdev,
- SECTOR_FROM_BLOCK(start),
- SECTOR_FROM_BLOCK(len),
- GFP_NOFS, &bio);
- }
- if (err) {
spin_lock_irqsave(&dc->lock, flags);
if (dc->state == D_PARTIAL)
dc->state = D_SUBMIT;
@@ -1360,6 +1354,8 @@ static int __submit_discard_cmd(struct f2fs_sb_info *sbi,
break;
}
+ __blkdev_issue_discard(bdev, SECTOR_FROM_BLOCK(start),
+ SECTOR_FROM_BLOCK(len), GFP_NOFS, &bio);
f2fs_bug_on(sbi, !bio);
/*
--
2.40.0
|
|
From: Chaitanya K. <cku...@gm...> - 2025-11-24 23:48:34
|
__blkdev_issue_discard() always returns 0, making all error checking at
call sites dead code.
Simplify md to only check !discard_bio by ignoring the
__blkdev_issue_discard() value.
Reviewed-by: Martin K. Petersen <mar...@or...>
Reviewed-by: Johannes Thumshirn <joh...@wd...>
Reviewed-by: Christoph Hellwig <hc...@ls...>
Signed-off-by: Chaitanya Kulkarni <cku...@gm...>
---
drivers/md/md.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 7b5c5967568f..aeb62df39828 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -9132,8 +9132,8 @@ void md_submit_discard_bio(struct mddev *mddev, struct md_rdev *rdev,
{
struct bio *discard_bio = NULL;
- if (__blkdev_issue_discard(rdev->bdev, start, size, GFP_NOIO,
- &discard_bio) || !discard_bio)
+ __blkdev_issue_discard(rdev->bdev, start, size, GFP_NOIO, &discard_bio);
+ if (!discard_bio)
return;
bio_chain(discard_bio, bio);
--
2.40.0
|
|
From: Chaitanya K. <cku...@gm...> - 2025-11-24 23:48:33
|
__blkdev_issue_discard() always returns 0, making the error checking
in nvmet_bdev_discard_range() dead code.
Kill the function nvmet_bdev_discard_range() and call
__blkdev_issue_discard() directly from nvmet_bdev_execute_discard(),
since no error handling is needed anymore for __blkdev_issue_discard()
call.
Reviewed-by: Martin K. Petersen <mar...@or...>
Reviewed-by: Johannes Thumshirn <joh...@wd...>
Reviewed-by: Christoph Hellwig <hc...@ls...>
Signed-off-by: Chaitanya Kulkarni <cku...@gm...>
---
drivers/nvme/target/io-cmd-bdev.c | 28 +++++++---------------------
1 file changed, 7 insertions(+), 21 deletions(-)
diff --git a/drivers/nvme/target/io-cmd-bdev.c b/drivers/nvme/target/io-cmd-bdev.c
index 8d246b8ca604..ca7731048940 100644
--- a/drivers/nvme/target/io-cmd-bdev.c
+++ b/drivers/nvme/target/io-cmd-bdev.c
@@ -362,29 +362,14 @@ u16 nvmet_bdev_flush(struct nvmet_req *req)
return 0;
}
-static u16 nvmet_bdev_discard_range(struct nvmet_req *req,
- struct nvme_dsm_range *range, struct bio **bio)
-{
- struct nvmet_ns *ns = req->ns;
- int ret;
-
- ret = __blkdev_issue_discard(ns->bdev,
- nvmet_lba_to_sect(ns, range->slba),
- le32_to_cpu(range->nlb) << (ns->blksize_shift - 9),
- GFP_KERNEL, bio);
- if (ret && ret != -EOPNOTSUPP) {
- req->error_slba = le64_to_cpu(range->slba);
- return errno_to_nvme_status(req, ret);
- }
- return NVME_SC_SUCCESS;
-}
-
static void nvmet_bdev_execute_discard(struct nvmet_req *req)
{
+ struct nvmet_ns *ns = req->ns;
struct nvme_dsm_range range;
struct bio *bio = NULL;
+ sector_t nr_sects;
int i;
- u16 status;
+ u16 status = NVME_SC_SUCCESS;
for (i = 0; i <= le32_to_cpu(req->cmd->dsm.nr); i++) {
status = nvmet_copy_from_sgl(req, i * sizeof(range), &range,
@@ -392,9 +377,10 @@ static void nvmet_bdev_execute_discard(struct nvmet_req *req)
if (status)
break;
- status = nvmet_bdev_discard_range(req, &range, &bio);
- if (status)
- break;
+ nr_sects = le32_to_cpu(range.nlb) << (ns->blksize_shift - 9);
+ __blkdev_issue_discard(ns->bdev,
+ nvmet_lba_to_sect(ns, range.slba), nr_sects,
+ GFP_KERNEL, &bio);
}
if (bio) {
--
2.40.0
|
|
From: Chaitanya K. <cku...@gm...> - 2025-11-24 23:48:32
|
Hi, __blkdev_issue_discard() only returns value 0, that makes post call error checking code dead. This patch series revmoes this dead code at all the call sites and adjust the callers. Please note that it doesn't change the return type of the function from int to void in this series, it will be done once this series gets merged smoothly. For f2fs and xfs I've ran following test which includes discard they produce same PASS and FAIL output with and without this patch series. for-next (lblk-fnext) discard-ret (lblk-discard) --------------------- -------------------------- FAIL f2fs/008 FAIL f2fs/008 FAIL f2fs/014 FAIL f2fs/014 FAIL f2fs/015 FAIL f2fs/015 PASS f2fs/017 PASS f2fs/017 PASS xfs/016 PASS xfs/016 PASS xfs/288 PASS xfs/288 PASS xfs/432 PASS xfs/432 PASS xfs/449 PASS xfs/449 PASS xfs/513 PASS xfs/513 PASS generic/033 PASS generic/033 PASS generic/038 PASS generic/038 PASS generic/098 PASS generic/098 PASS generic/224 PASS generic/224 PASS generic/251 PASS generic/251 PASS generic/260 PASS generic/260 PASS generic/288 PASS generic/288 PASS generic/351 PASS generic/351 PASS generic/455 PASS generic/455 PASS generic/457 PASS generic/457 PASS generic/470 PASS generic/470 PASS generic/482 PASS generic/482 PASS generic/500 PASS generic/500 PASS generic/537 PASS generic/537 PASS generic/608 PASS generic/608 PASS generic/619 PASS generic/619 PASS generic/746 PASS generic/746 PASS generic/757 PASS generic/757 For NVMeOF taret I've testing blktest with nvme_trtype=nvme_loop and all the testcases are passing. -ck Changes from V2:- 1. Add Reviewed-by: tags. 2. Split patch 2 into two separate patches dm and md. 3. Condense __blkdev_issue_discard() parameters for in nvmet patch. 4. Condense __blkdev_issue_discard() parameters for in f2fs patch. Chaitanya Kulkarni (6): block: ignore discard return value md: ignore discard return value dm: ignore discard return value nvmet: ignore discard return value f2fs: ignore discard return value xfs: ignore discard return value block/blk-lib.c | 6 +++--- drivers/md/dm-thin.c | 12 +++++------- drivers/md/md.c | 4 ++-- drivers/nvme/target/io-cmd-bdev.c | 28 +++++++--------------------- fs/f2fs/segment.c | 10 +++------- fs/xfs/xfs_discard.c | 27 +++++---------------------- fs/xfs/xfs_discard.h | 2 +- 7 files changed, 26 insertions(+), 63 deletions(-) -- 2.40.0 |
|
From: Chaitanya K. <cku...@gm...> - 2025-11-24 23:48:31
|
__blkdev_issue_discard() always returns 0, making all error checking
at call sites dead code.
For dm-thin change issue_discard() return type to void, in
passdown_double_checking_shared_status() remove the r assignment from
return value of the issue_discard(), for end_discard() hardcode value of
r to 0 that matches only value returned from __blkdev_issue_discard().
Reviewed-by: Martin K. Petersen <mar...@or...>
Reviewed-by: Johannes Thumshirn <joh...@wd...>
Reviewed-by: Christoph Hellwig <hc...@ls...>
Signed-off-by: Chaitanya Kulkarni <cku...@gm...>
---
drivers/md/dm-thin.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index c84149ba4e38..77c76f75c85f 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -395,13 +395,13 @@ static void begin_discard(struct discard_op *op, struct thin_c *tc, struct bio *
op->bio = NULL;
}
-static int issue_discard(struct discard_op *op, dm_block_t data_b, dm_block_t data_e)
+static void issue_discard(struct discard_op *op, dm_block_t data_b, dm_block_t data_e)
{
struct thin_c *tc = op->tc;
sector_t s = block_to_sectors(tc->pool, data_b);
sector_t len = block_to_sectors(tc->pool, data_e - data_b);
- return __blkdev_issue_discard(tc->pool_dev->bdev, s, len, GFP_NOIO, &op->bio);
+ __blkdev_issue_discard(tc->pool_dev->bdev, s, len, GFP_NOIO, &op->bio);
}
static void end_discard(struct discard_op *op, int r)
@@ -1113,9 +1113,7 @@ static void passdown_double_checking_shared_status(struct dm_thin_new_mapping *m
break;
}
- r = issue_discard(&op, b, e);
- if (r)
- goto out;
+ issue_discard(&op, b, e);
b = e;
}
@@ -1188,8 +1186,8 @@ static void process_prepared_discard_passdown_pt1(struct dm_thin_new_mapping *m)
struct discard_op op;
begin_discard(&op, tc, discard_parent);
- r = issue_discard(&op, m->data_block, data_end);
- end_discard(&op, r);
+ issue_discard(&op, m->data_block, data_end);
+ end_discard(&op, 0);
}
}
--
2.40.0
|
|
From: Chaitanya K. <cku...@gm...> - 2025-11-24 23:48:28
|
__blkdev_issue_discard() always returns 0, making the error check
in blkdev_issue_discard() dead code.
In function blkdev_issue_discard() initialize ret = 0, remove ret
assignment from __blkdev_issue_discard(), rely on bio == NULL check to
call submit_bio_wait(), preserve submit_bio_wait() error handling, and
preserve -EOPNOTSUPP to 0 mapping.
Reviewed-by: Christoph Hellwig <hc...@ls...>
Reviewed-by: Johannes Thumshirn <joh...@wd...>
Reviewed-by: Martin K. Petersen <mar...@or...>
Signed-off-by: Chaitanya Kulkarni <cku...@gm...>
---
block/blk-lib.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/block/blk-lib.c b/block/blk-lib.c
index 3030a772d3aa..19e0203cc18a 100644
--- a/block/blk-lib.c
+++ b/block/blk-lib.c
@@ -87,11 +87,11 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
{
struct bio *bio = NULL;
struct blk_plug plug;
- int ret;
+ int ret = 0;
blk_start_plug(&plug);
- ret = __blkdev_issue_discard(bdev, sector, nr_sects, gfp_mask, &bio);
- if (!ret && bio) {
+ __blkdev_issue_discard(bdev, sector, nr_sects, gfp_mask, &bio);
+ if (bio) {
ret = submit_bio_wait(bio);
if (ret == -EOPNOTSUPP)
ret = 0;
--
2.40.0
|
|
From: <pat...@ke...> - 2025-11-24 18:51:04
|
Hello:
This series was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <ja...@ke...>:
On Tue, 11 Nov 2025 19:52:28 +0800 you wrote:
> In f2fs retry logic, we will call f2fs_io_schedule_timeout() to sleep as
> uninterruptible state (waiting for IO) for a while, however, in several
> paths below, we are not blocked by IO:
> - f2fs_write_single_data_page() return -EAGAIN due to racing on cp_rwsem.
> - f2fs_quota_write() and __replace_atomic_write_block() failed due to
> no memory.
> - f2fs_flush_device_cache() failed to submit preflush command.
> - __issue_discard_cmd_range() sleeps periodically in between two in batch
> discard submissions.
>
> [...]
Here is the summary with links:
- [f2fs-dev,1/2] f2fs: introduce f2fs_schedule_timeout()
(no matching commit)
- [f2fs-dev,2/2] f2fs: change default schedule timeout value
https://git.kernel.org/jaegeuk/f2fs/c/2f4c126cc08b
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
|
|
From: <pat...@ke...> - 2025-11-24 18:51:03
|
Hello:
This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <ja...@ke...>:
On Mon, 17 Nov 2025 20:45:59 +0800 you wrote:
> opt field in structure f2fs_mount_info and opt_mask field in structure
> f2fs_fs_context is 32-bits variable, now we're running out of available
> bits in them, let's expand them to 64-bits for better scalability.
>
> Signed-off-by: Chao Yu <ch...@ke...>
> ---
> fs/f2fs/f2fs.h | 85 ++++++++++++++++++++++++++-----------------------
> fs/f2fs/super.c | 36 ++++++++++-----------
> 2 files changed, 63 insertions(+), 58 deletions(-)
Here is the summary with links:
- [f2fs-dev] f2fs: expand scalability of f2fs mount option
https://git.kernel.org/jaegeuk/f2fs/c/643fa4d0f36c
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
|