Re: [PATCH 01/23] block: factor out a bvec_set_page helper

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

 



On 1/30/23 01:21, Christoph Hellwig wrote:
Add a helper to initialize a bvec based of a page pointer.  This will help
removing various open code bvec initializations.

Why do you want to remove the open-coded bvec initializations? What is wrong with open-coding bvec initialization? This patch series modifies a lot of code but does not improve code readability. Anyone who encounters code that uses the new function bvec_set_page() has to look up the definition of that function to figure out what it does.

-	iv = bip->bip_vec + bip->bip_vcnt;
-
  	if (bip->bip_vcnt &&
  	    bvec_gap_to_prev(&bdev_get_queue(bio->bi_bdev)->limits,
  			     &bip->bip_vec[bip->bip_vcnt - 1], offset))
  		return 0;
- iv->bv_page = page;
-	iv->bv_len = len;
-	iv->bv_offset = offset;
+	bvec_set_page(&bip->bip_vec[bip->bip_vcnt], page, len, offset);
  	bip->bip_vcnt++;

Has it been considered to use structure assignment instead of introducing bvec_set_page(), e.g. as follows?

bip->bip_vec[bip->bip_vcnt] = (struct bio_vec) {
      .bv_page = page, .bv_len = len, .bv_offset = offset };

Thanks,

Bart.



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux