Thread (66 messages) 66 messages, 14 authors, 2023-01-31

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

From: Bart Van Assche <bvanassche@acm.org>
Date: 2023-01-30 17:09:33
Also in: ceph-devel, io-uring, kvm, linux-block, linux-cifs, linux-fsdevel, linux-mm, linux-nfs, linux-nvme, linux-scsi, target-devel, virtualization

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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help