* [PATCH v2] xfs: check split_sectors validity before bio_split call
@ 2026-07-29 7:34 Hongling Zeng
2026-07-29 8:29 ` Christoph Hellwig
0 siblings, 1 reply; 2+ messages in thread
From: Hongling Zeng @ 2026-07-29 7:34 UTC (permalink / raw)
To: cem, djwong, hans.holmberg
Cc: linux-xfs, linux-kernel, zhongling0719, Hongling Zeng
Change the split_sectors check from !split_sectors to split_sectors <= 0
to make the error handling explicit. While bio_split_rw_at() cannot return
a negative error code for the current GC I/O path (GC I/O doesn't use
REQ_ATOMIC/REQ_NOWAIT flags and has proper alignment), making the check
explicit improves code clarity and makes the intent clear.
This also makes the code more robust for future maintenance if different
I/O patterns are introduced.
Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn>
---
Change in v2:
-Remove Fixes tag as this is not a triggerable bug,suggested by
Christoph Hellwig.
---
fs/xfs/xfs_zone_gc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/xfs/xfs_zone_gc.c b/fs/xfs/xfs_zone_gc.c
index f76a09130852..e00f4771e424 100644
--- a/fs/xfs/xfs_zone_gc.c
+++ b/fs/xfs/xfs_zone_gc.c
@@ -802,7 +802,7 @@ xfs_zone_gc_split_write(
split_sectors = bio_split_rw_at(&chunk->bio, lim, &nsegs,
lim->max_zone_append_sectors << SECTOR_SHIFT);
- if (!split_sectors)
+ if (split_sectors <= 0)
return NULL;
/* ensure the split chunk is still block size aligned */
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] xfs: check split_sectors validity before bio_split call
2026-07-29 7:34 [PATCH v2] xfs: check split_sectors validity before bio_split call Hongling Zeng
@ 2026-07-29 8:29 ` Christoph Hellwig
0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2026-07-29 8:29 UTC (permalink / raw)
To: Hongling Zeng
Cc: cem, djwong, hans.holmberg, linux-xfs, linux-kernel,
zhongling0719
On Wed, Jul 29, 2026 at 03:34:18PM +0800, Hongling Zeng wrote:
> Change the split_sectors check from !split_sectors to split_sectors <= 0
> to make the error handling explicit. While bio_split_rw_at() cannot return
> a negative error code for the current GC I/O path (GC I/O doesn't use
> REQ_ATOMIC/REQ_NOWAIT flags and has proper alignment), making the check
> explicit improves code clarity and makes the intent clear.
>
> This also makes the code more robust for future maintenance if different
> I/O patterns are introduced.
>
> Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn>
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-29 8:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-29 7:34 [PATCH v2] xfs: check split_sectors validity before bio_split call Hongling Zeng
2026-07-29 8:29 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox