Thread (106 messages) 106 messages, 6 authors, 2022-01-08

Re: [PATCH 07/48] iov_iter: Convert iter_xarray to use folios

From: David Howells <dhowells@redhat.com>
Date: 2021-12-23 15:24:32
Also in: linux-fsdevel

Christoph Hellwig [off-list ref] wrote:
quoted
+		size_t offset = offset_in_folio(folio, start + __off);	\
+		if (xas_retry(&xas, folio))			\
 			continue;				\
+		if (WARN_ON(xa_is_value(folio)))		\
 			break;					\
+		if (WARN_ON(folio_test_hugetlb(folio)))		\
 			break;					\
+		while (offset < folio_size(folio)) {		\
Nit: I'd be tempted to use a for loop on offset here.
A while-loop makes more sense here.  The adjustment you need for offset
(ie. len) is overwritten after offset is altered at the end of the loop:
+			offset += len;				\
+			len = PAGE_SIZE;			\
 		}						\
So you'd have to move both of these into the for-incrementor expression, in
addition to moving in the initialiser expression, making the thing less
readable.

David

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help