Thread (6 messages) 6 messages, 3 authors, 2018-07-25

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

From: Max Gurtovoy <hidden>
Date: 2018-07-25 11:47:17
Also in: linux-nvme


On 7/25/2018 2:22 PM, Christoph Hellwig wrote:
quoted
+			pmap = kmap_atomic(iv.bv_page) + iv.bv_offset;
+			p = pmap;
Maybe:

			pmap = p = kmap_atomic(iv.bv_page) + iv.bv_offset;
quoted
+			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;
quoted
+			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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help