Btw, while this series relies on the blk_next_bio() patch to work, it was not the reason that I sent the latter. It was just because the way it calls bio_chain() doesn't look right to any of the functions that make use of it (or in other words, the apparent logic of itself). That's actually why I didn't have it in the same series. On Sun, 6 Dec 2020 at 22:07, Tom Yan <tom.ty89@xxxxxxxxx> wrote: > > Yes it does have "dependency" to the blk_next_bio() patch. I just > somehow missed that. > > The problem is, I don't think I'm trying to change the logic of > bio_chain(), or even that of blk_next_bio(). It really just looks like > a careless mistake, that the arguments were typed in the wrong order. > > Adding those who signed off the original commit (block: remove struct > bio_batch / 9082e87b) here too to the CC list. > > > On Sun, 6 Dec 2020 at 21:56, Hannes Reinecke <hare@xxxxxxx> wrote: > > > > On 12/6/20 2:25 PM, Tom Yan wrote: > > > I think you misunderstood it. The goal of this patch is to split the > > > current situation into two chains (or one unchained bio + a series of > > > chained bio). The first one is an attempt/trial which makes sure that > > > the latter large bio chain can actually be handled (as per the > > > "command capability" of the device). > > > > > Oh, I think I do get what you're trying to do. And, in fact, I don't > > argue with what you're trying to achieve. > > > > What I would like to see, though, is keep the current bio_chain logic > > intact (irrespective of your previous patch, which should actually be > > part of this series), and just lift the first check out of the loop: > > > > @@ -262,9 +262,14 @@ static int __blkdev_issue_write_zeroes(struct > > block_device *bdev, > > > > if (max_write_zeroes_sectors == 0) > > return -EOPNOTSUPP; > > - > > + new = bio_alloc(gfp_mask, 0); > > + bio_chain(bio, new); > > + if (submit_bio_wait(bio) == BLK_STS_NOTSUPP) { > > + bio_put(new); > > + return -ENOPNOTSUPP; > > + } > > + bio = new; > > while (nr_sects) { > > - bio = blk_next_bio(bio, 0, gfp_mask); > > bio->bi_iter.bi_sector = sector; > > bio_set_dev(bio, bdev); > > bio->bi_opf = REQ_OP_WRITE_ZEROES; > > @@ -279,6 +284,7 @@ static int __blkdev_issue_write_zeroes(struct > > block_device *bdev, > > bio->bi_iter.bi_size = nr_sects << 9; > > nr_sects = 0; > > } > > + bio = blk_next_bio(bio, 0, gfp_mask); > > cond_resched(); > > } > > > > (The error checking from submit_bio_wait() could be improved :-) > > > > Cheers, > > > > Hannes > > -- > > Dr. Hannes Reinecke Kernel Storage Architect > > hare@xxxxxxx +49 911 74053 688 > > SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg > > HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer