linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
To: linux-fsdevel@vger.kernel.org
Cc: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>,
	Mike Marshall <hubcap@omnibond.com>,
	Martin Brandenburg <martin@omnibond.com>,
	devel@lists.orangefs.org
Subject: [RFC PATCH 4/5] orangefs: call __clear_page_buffers to simplify code
Date: Sun, 19 Apr 2020 00:51:22 +0200	[thread overview]
Message-ID: <20200418225123.31850-5-guoqing.jiang@cloud.ionos.com> (raw)
In-Reply-To: <20200418225123.31850-1-guoqing.jiang@cloud.ionos.com>

Since __clear_page_buffers is exported, we can call __clear_page_buffers
to simplify code in the four places.

Cc: Mike Marshall <hubcap@omnibond.com>
Cc: Martin Brandenburg <martin@omnibond.com>
Cc: devel@lists.orangefs.org
Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
---
The order for set_page_private and ClearPagePrivate is swapped in
__clear_page_buffers, not sure it is identical or not, so this is
RFC.

Thanks,
Guoqing

 fs/orangefs/inode.c | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c
index 12ae630fbed7..8e1591d8bf24 100644
--- a/fs/orangefs/inode.c
+++ b/fs/orangefs/inode.c
@@ -11,6 +11,7 @@
  */
 
 #include <linux/bvec.h>
+#include <linux/buffer_head.h>
 #include "protocol.h"
 #include "orangefs-kernel.h"
 #include "orangefs-bufmap.h"
@@ -64,9 +65,7 @@ static int orangefs_writepage_locked(struct page *page,
 	}
 	if (wr) {
 		kfree(wr);
-		set_page_private(page, 0);
-		ClearPagePrivate(page);
-		put_page(page);
+		__clear_page_buffers(page);
 	}
 	return ret;
 }
@@ -460,17 +459,13 @@ static void orangefs_invalidatepage(struct page *page,
 
 	if (offset == 0 && length == PAGE_SIZE) {
 		kfree((struct orangefs_write_range *)page_private(page));
-		set_page_private(page, 0);
-		ClearPagePrivate(page);
-		put_page(page);
+		__clear_page_buffers(page);
 		return;
 	/* write range entirely within invalidate range (or equal) */
 	} else if (page_offset(page) + offset <= wr->pos &&
 	    wr->pos + wr->len <= page_offset(page) + offset + length) {
 		kfree((struct orangefs_write_range *)page_private(page));
-		set_page_private(page, 0);
-		ClearPagePrivate(page);
-		put_page(page);
+		__clear_page_buffers(page);
 		/* XXX is this right? only caller in fs */
 		cancel_dirty_page(page);
 		return;
@@ -537,9 +532,7 @@ static void orangefs_freepage(struct page *page)
 {
 	if (PagePrivate(page)) {
 		kfree((struct orangefs_write_range *)page_private(page));
-		set_page_private(page, 0);
-		ClearPagePrivate(page);
-		put_page(page);
+		__clear_page_buffers(page);
 	}
 }
 
-- 
2.17.1


  parent reply	other threads:[~2020-04-18 22:51 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-18 22:51 [PATCH 0/5] export __clear_page_buffers to cleanup code Guoqing Jiang
2020-04-18 22:51 ` [PATCH 1/5] fs/buffer: export __clear_page_buffers Guoqing Jiang
2020-04-19  7:56   ` Nikolay Borisov
2020-04-19 13:20     ` Guoqing Jiang
2020-04-18 22:51 ` [PATCH 2/5] btrfs: call __clear_page_buffers to simplify code Guoqing Jiang
2020-04-19 19:46   ` David Sterba
2020-04-19 20:32     ` Guoqing Jiang
2020-04-18 22:51 ` [PATCH 3/5] iomap: call __clear_page_buffers in iomap_page_release Guoqing Jiang
2020-04-19  7:47   ` Christoph Hellwig
2020-04-19 13:18     ` Guoqing Jiang
2020-04-18 22:51 ` Guoqing Jiang [this message]
2020-04-18 22:51 ` [PATCH 5/5] md-bitmap: don't duplicate code for __clear_page_buffers Guoqing Jiang
2020-04-19  3:14 ` [PATCH 0/5] export __clear_page_buffers to cleanup code Matthew Wilcox
2020-04-19  5:14   ` Gao Xiang
2020-04-19 13:22     ` Guoqing Jiang
2020-04-19 13:15   ` Guoqing Jiang
2020-04-19 20:31   ` Guoqing Jiang
2020-04-19 21:17     ` Matthew Wilcox
2020-04-19 23:20   ` Dave Chinner
2020-04-20  0:30     ` Matthew Wilcox
2020-04-20 21:14       ` Guoqing Jiang
2020-04-20 22:14         ` Matthew Wilcox
2020-04-21  1:53       ` Dave Chinner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200418225123.31850-5-guoqing.jiang@cloud.ionos.com \
    --to=guoqing.jiang@cloud.ionos.com \
    --cc=devel@lists.orangefs.org \
    --cc=hubcap@omnibond.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=martin@omnibond.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).