On 7/25/2018 2:22 PM, Christoph Hellwig wrote:
+ pmap = kmap_atomic(iv.bv_page) + iv.bv_offset;
+ p = pmap;
Maybe:
pmap = p = kmap_atomic(iv.bv_page) + iv.bv_offset;
+ for (j = 0; j < iv.bv_len; j += tuple_sz) {
+ pi = (struct t10_pi_tuple *)p;
No need for the cast, also the pi declaration can be moved into the
inner scope:
struct t10_pi_tuple *pi = p;
+ pmap = kmap_atomic(iv.bv_page) + iv.bv_offset;
+ p = pmap;
+ for (j = 0; j < iv.bv_len; j += tuple_sz) {
+ if (intervals == 0) {
+ kunmap_atomic(pmap);
+ return;
+ }
+ pi = (struct t10_pi_tuple *)p;
Same here.
Also the intervals check would make sense in the for loop I think, e.g.:
pmap = p = kmap_atomic(iv.bv_page) + iv.bv_offset;
for (j = 0; j < iv.bv_len && intervals; j += tuple_sz) {
struct t10_pi_tuple *pi = p;
Yes it make sense, but we can do more iterations before we return but I
guess it's rare and it's worth to have less lines of code.
I'll update it for the next version.