Skip to contentSkip to conversation

fs/ceph: use release_pages() directly

PATCH In review [email protected] 2 participants 2 messages Aug 9, 2019 Ceph client

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/ceph: use release_pages() directly

From: John Hubbard <[email protected]>

release_pages() has been available to modules since Oct, 2010, when commit 0be8557bcd34 ("fuse: use release_pages()") added EXPORT_SYMBOL(release_pages). However, this ceph code was still using a workaround.

Remove the workaround, and call release_pages() directly.

---

Hi,

I noticed this while I trying to understand mlock.c's use of pagevec_release(). So I was looking around for examples, and stumbled across this, which seems worth cleaning up.

thanks,
John Hubbard
NVIDIA

 fs/ceph/addr.c | 19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)
fs/ceph/addr.c +1 -18
index e078cc55b989..22ed45d143be 100644
@@ -679,23 +679,6 @@ static int ceph_writepage(struct page *page, struct writeback_control *wbc)
 	return err;
 }
 
-/*
- * lame release_pages helper.  release_pages() isn't exported to
- * modules.
- */
-static void ceph_release_pages(struct page **pages, int num)
-{
-	struct pagevec pvec;
-	int i;
-
-	pagevec_init(&pvec);
-	for (i = 0; i < num; i++) {
-		if (pagevec_add(&pvec, pages[i]) == 0)
-			pagevec_release(&pvec);
-	}
-	pagevec_release(&pvec);
-}
-
 /*
  * async writeback completion handler.
  *
@@ -769,7 +752,7 @@ static void writepages_finish(struct ceph_osd_request *req)
 		dout("writepages_finish %p wrote %llu bytes cleaned %d pages\n",
 		     inode, osd_data->length, rc >= 0 ? num_pages : 0);
 
-		ceph_release_pages(osd_data->pages, num_pages);
+		release_pages(osd_data->pages, num_pages);
 	}
 
 	ceph_put_wrbuffer_cap_refs(ci, total_pages, snapc);
Signature · 1 line
2.22.0
#1 lore raw
Quoted 58 lines · On Thu, 2019-08-08 at 20:56 -0700, [email protected] wrote:

From: John Hubbard <[email protected]>

release_pages() has been available to modules since Oct, 2010, when commit 0be8557bcd34 ("fuse: use release_pages()") added EXPORT_SYMBOL(release_pages). However, this ceph code was still using a workaround.

Remove the workaround, and call release_pages() directly.

---

Hi,

I noticed this while I trying to understand mlock.c's use of pagevec_release(). So I was looking around for examples, and stumbled across this, which seems worth cleaning up.

thanks,
John Hubbard
NVIDIA

 fs/ceph/addr.c | 19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)
fs/ceph/addr.c +0 -17
index e078cc55b989..22ed45d143be 100644
@@ -679,23 +679,6 @@ static int ceph_writepage(struct page *page, struct writeback_control *wbc)
 	return err;
 }
 
-/*
- * lame release_pages helper.  release_pages() isn't exported to
- * modules.
- */
-static void ceph_release_pages(struct page **pages, int num)
-{
-	struct pagevec pvec;
-	int i;
-
-	pagevec_init(&pvec);
-	for (i = 0; i < num; i++) {
-		if (pagevec_add(&pvec, pages[i]) == 0)
-			pagevec_release(&pvec);
-	}
-	pagevec_release(&pvec);
-}
-
 /*
  * async writeback completion handler.
  *

fs/ceph/addr.c static void writepages_finish(struct ceph_osd_request *req) · line 758

Quoted 8 lines
fs/ceph/addr.c +1 -1
@@ -769,7 +752,7 @@ static void writepages_finish(struct ceph_osd_request *req)
 		dout("writepages_finish %p wrote %llu bytes cleaned %d pages\n",
 		     inode, osd_data->length, rc >= 0 ? num_pages : 0);
 
-		ceph_release_pages(osd_data->pages, num_pages);
+		release_pages(osd_data->pages, num_pages);
 	}
 
 	ceph_put_wrbuffer_cap_refs(ci, total_pages, snapc);

Thanks John. Running tests on it now, and will probably push to our testing branch later today. It should make v5.4.

Signature · 1 line
Jeff Layton <[email protected]>