Skip to contentSkip to conversation

libceph: advancing variants of iov_iter_get_pages()

PATCH Superseded [email protected] 2 participants 3 messages Aug 16, 2022 – Aug 17, 2022 Ceph common code (libceph)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libceph: advancing variants of iov_iter_get_pages()

From: Xiubo Li <[email protected]>

The upper layer has changed it to iov_iter_get_pages2(). And this should be folded into the previous commit.

---
 net/ceph/messenger.c | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)
net/ceph/messenger.c +2 -15
index 945f6d1a9efa..020474cf137c 100644
@@ -985,25 +985,12 @@ static struct page *ceph_msg_data_iter_next(struct ceph_msg_data_cursor *cursor,
 	if (cursor->lastlen)
 		iov_iter_revert(&cursor->iov_iter, cursor->lastlen);
 
-	len = iov_iter_get_pages(&cursor->iov_iter, &page, PAGE_SIZE,
-				 1, page_offset);
+	len = iov_iter_get_pages2(&cursor->iov_iter, &page, PAGE_SIZE,
+				  1, page_offset);
 	BUG_ON(len < 0);
 
 	cursor->lastlen = len;
 
-	/*
-	 * FIXME: Al Viro says that he will soon change iov_iter_get_pages
-	 * to auto-advance the iterator. Emulate that here for now.
-	 */
-	iov_iter_advance(&cursor->iov_iter, len);
-
-	/*
-	 * FIXME: The assumption is that the pages represented by the iov_iter
-	 * 	  are pinned, with the references held by the upper-level
-	 * 	  callers, or by virtue of being under writeback. Eventually,
-	 * 	  we'll get an iov_iter_get_pages variant that doesn't take page
-	 * 	  refs. Until then, just put the page ref.
-	 */
 	VM_BUG_ON_PAGE(!PageWriteback(page) && page_count(page) < 2, page);
 	put_page(page);
 
Signature · 1 line
2.36.0.rc1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 29 lines · On Tue, 2022-08-16 at 10:41 +0800, [email protected] wrote:

From: Xiubo Li <[email protected]>

The upper layer has changed it to iov_iter_get_pages2(). And this should be folded into the previous commit.

---
 net/ceph/messenger.c | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)
net/ceph/messenger.c +2 -5
index 945f6d1a9efa..020474cf137c 100644
@@ -985,25 +985,12 @@ static struct page *ceph_msg_data_iter_next(struct ceph_msg_data_cursor *cursor,
 	if (cursor->lastlen)
 		iov_iter_revert(&cursor->iov_iter, cursor->lastlen);
 
-	len = iov_iter_get_pages(&cursor->iov_iter, &page, PAGE_SIZE,
-				 1, page_offset);
+	len = iov_iter_get_pages2(&cursor->iov_iter, &page, PAGE_SIZE,
+				  1, page_offset);
 	BUG_ON(len < 0);
 
 	cursor->lastlen = len;
 
-	/*
-	 * FIXME: Al Viro says that he will soon change iov_iter_get_pages
-	 * to auto-advance the iterator. Emulate that here for now.

net/ceph/messenger.c static struct page *ceph_msg_data_iter_next(struct ceph_msg_data_cursor *cursor, · line 1006

Quoted 10 lines
net/ceph/messenger.c +0 -10
-	 */
-	iov_iter_advance(&cursor->iov_iter, len);
-
-	/*
-	 * FIXME: The assumption is that the pages represented by the iov_iter
-	 * 	  are pinned, with the references held by the upper-level
-	 * 	  callers, or by virtue of being under writeback. Eventually,
-	 * 	  we'll get an iov_iter_get_pages variant that doesn't take page
-	 * 	  refs. Until then, just put the page ref.
-	 */

I think the comment above should not be removed. Eventually Al plans to add a version of this that doesn't take page refs, and this patch doesn't change that.

net/ceph/messenger.c static struct page *ceph_msg_data_iter_next(struct ceph_msg_data_cursor *cursor, · line 996

Quoted 3 lines
net/ceph/messenger.c +0 -0
 	VM_BUG_ON_PAGE(!PageWriteback(page) && page_count(page) < 2, page);
 	put_page(page);
 

Patch itself looks fine though. Thanks for fixing it up!

author
#2 lore raw
Quoted 27 lines · Jeff Layton
Quoted 26 lines · On Tue, 2022-08-16 at 10:41 +0800, [email protected] wrote:

From: Xiubo Li <[email protected]>

The upper layer has changed it to iov_iter_get_pages2(). And this should be folded into the previous commit.

---
  net/ceph/messenger.c | 17 ++---------------
  1 file changed, 2 insertions(+), 15 deletions(-)
net/ceph/messenger.c +2 -2
index 945f6d1a9efa..020474cf137c 100644
@@ -985,25 +985,12 @@ static struct page *ceph_msg_data_iter_next(struct ceph_msg_data_cursor *cursor,
  	if (cursor->lastlen)
  		iov_iter_revert(&cursor->iov_iter, cursor->lastlen);
 
-	len = iov_iter_get_pages(&cursor->iov_iter, &page, PAGE_SIZE,
-				 1, page_offset);
+	len = iov_iter_get_pages2(&cursor->iov_iter, &page, PAGE_SIZE,
+				  1, page_offset);
  	BUG_ON(len < 0);
 
  	cursor->lastlen = len;
 
Quoted 16 lines

net/ceph/messenger.c static struct page *ceph_msg_data_iter_next(struct ceph_msg_data_cursor *cursor, · line 1006

Quoted 13 lines
net/ceph/messenger.c +0 -13
-	/*
-	 * FIXME: Al Viro says that he will soon change iov_iter_get_pages
-	 * to auto-advance the iterator. Emulate that here for now.
-	 */
-	iov_iter_advance(&cursor->iov_iter, len);
-
-	/*
-	 * FIXME: The assumption is that the pages represented by the iov_iter
-	 * 	  are pinned, with the references held by the upper-level
-	 * 	  callers, or by virtue of being under writeback. Eventually,
-	 * 	  we'll get an iov_iter_get_pages variant that doesn't take page
-	 * 	  refs. Until then, just put the page ref.
-	 */

I think the comment above should not be removed. Eventually Al plans to add a version of this that doesn't take page refs, and this patch doesn't change that.

Okay, I will remove this.

Quoted 8 lines

net/ceph/messenger.c static struct page *ceph_msg_data_iter_next(struct ceph_msg_data_cursor *cursor, · line 996

Quoted 4 lines
net/ceph/messenger.c +0 -0
  	VM_BUG_ON_PAGE(!PageWriteback(page) && page_count(page) < 2, page);
  	put_page(page);
 

Patch itself looks fine though. Thanks for fixing it up!

Thanks Jeff.