Re: [PATCH v3 7/8] block: add nowait flag for __blkdev_issue_zero_pages

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

 



On 9/6/24 14:41, Jens Axboe wrote:
On 9/4/24 8:18 AM, Pavel Begunkov wrote:
diff --git a/block/blk-lib.c b/block/blk-lib.c
index c94c67a75f7e..a16b7c7965e8 100644
--- a/block/blk-lib.c
+++ b/block/blk-lib.c
@@ -193,20 +193,32 @@ static unsigned int __blkdev_sectors_to_bio_pages(sector_t nr_sects)
  	return min(pages, (sector_t)BIO_MAX_VECS);
  }
-static void __blkdev_issue_zero_pages(struct block_device *bdev,
+int blkdev_issue_zero_pages_bio(struct block_device *bdev,
  		sector_t sector, sector_t nr_sects, gfp_t gfp_mask,
  		struct bio **biop, unsigned int flags)
  {
+	blk_opf_t opf = REQ_OP_WRITE;
+
+	if (flags & BLKDEV_ZERO_PAGES_NOWAIT) {
+		sector_t max_bio_sectors = BIO_MAX_VECS << PAGE_SECTORS_SHIFT;
+
+		if (nr_sects > max_bio_sectors)
+			return -EAGAIN;
+		opf |= REQ_NOWAIT;
+	}
+
  	while (nr_sects) {
  		unsigned int nr_vecs = __blkdev_sectors_to_bio_pages(nr_sects);
  		struct bio *bio;
bio = bio_alloc(bdev, nr_vecs, REQ_OP_WRITE, gfp_mask);

as per the kernel test bot, I guess this one should be using opf rather
than REQ_OP_WRITE.

Right, I overlooked it. I'm going to resend the series later today.

--
Pavel Begunkov




[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