Re: [PATCH v3 2/3] block: move dif_prepare/dif_complete functions to block layer

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

 





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.



[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