[PATCH] block: Support splitting REQ_OP_ZONE_APPEND bios

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Make it easier for filesystems to submit zone append bios that exceed
the block device limits by adding support for REQ_OP_ZONE_APPEND in
bio_split(). See also commit 0512a75b98f8 ("block: Introduce
REQ_OP_ZONE_APPEND").

This patch is a bug fix for commit d5e4377d5051 because that commit
introduces a call to bio_split() for zone append bios without adding
support for splitting REQ_OP_ZONE_APPEND bios in bio_split().

Untested.

Cc: Christoph Hellwig <hch@xxxxxx>
Cc: Keith Busch <kbusch@xxxxxxxxxx>
Cc: Damien Le Moal <damien.lemoal@xxxxxxxxxxxxxxxxxx>
Cc: Josef Bacik <josef@xxxxxxxxxxxxxx>
Cc: Johannes Thumshirn <johannes.thumshirn@xxxxxxx>
Fixes: d5e4377d5051 ("btrfs: split zone append bios in btrfs_submit_bio")
Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx>
---
 block/bio.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/block/bio.c b/block/bio.c
index fc98c1c723ca..8a4805565638 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1631,10 +1631,6 @@ struct bio *bio_split(struct bio *bio, int sectors,
 	BUG_ON(sectors <= 0);
 	BUG_ON(sectors >= bio_sectors(bio));
 
-	/* Zone append commands cannot be split */
-	if (WARN_ON_ONCE(bio_op(bio) == REQ_OP_ZONE_APPEND))
-		return NULL;
-
 	split = bio_alloc_clone(bio->bi_bdev, bio, gfp, bs);
 	if (!split)
 		return NULL;
@@ -1644,7 +1640,8 @@ struct bio *bio_split(struct bio *bio, int sectors,
 	if (bio_integrity(split))
 		bio_integrity_trim(split);
 
-	bio_advance(bio, split->bi_iter.bi_size);
+	if (bio_op(bio) != REQ_OP_ZONE_APPEND)
+		bio_advance(bio, split->bi_iter.bi_size);
 
 	if (bio_flagged(bio, BIO_TRACE_COMPLETION))
 		bio_set_flag(split, BIO_TRACE_COMPLETION);



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux