lkml.org 
[lkml]   [2020]   [Apr]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH 8/9] orangefs: use set/clear_fs_page_private
Date
Since the new pair function is introduced, we can call them to clean the
code in orangefs.

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>
---
fs/orangefs/inode.c | 24 ++++++------------------
1 file changed, 6 insertions(+), 18 deletions(-)

diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c
index 12ae630fbed7..893099d36e20 100644
--- a/fs/orangefs/inode.c
+++ b/fs/orangefs/inode.c
@@ -64,9 +64,7 @@ static int orangefs_writepage_locked(struct page *page,
}
if (wr) {
kfree(wr);
- set_page_private(page, 0);
- ClearPagePrivate(page);
- put_page(page);
+ clear_fs_page_private(page);
}
return ret;
}
@@ -409,9 +407,7 @@ static int orangefs_write_begin(struct file *file,
wr->len = len;
wr->uid = current_fsuid();
wr->gid = current_fsgid();
- SetPagePrivate(page);
- set_page_private(page, (unsigned long)wr);
- get_page(page);
+ set_fs_page_private(page, wr);
okay:
return 0;
}
@@ -460,17 +456,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_fs_page_private(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_fs_page_private(page);
/* XXX is this right? only caller in fs */
cancel_dirty_page(page);
return;
@@ -537,9 +529,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_fs_page_private(page);
}
}

@@ -740,9 +730,7 @@ vm_fault_t orangefs_page_mkwrite(struct vm_fault *vmf)
wr->len = PAGE_SIZE;
wr->uid = current_fsuid();
wr->gid = current_fsgid();
- SetPagePrivate(page);
- set_page_private(page, (unsigned long)wr);
- get_page(page);
+ set_fs_page_private(page, wr);
okay:

file_update_time(vmf->vma->vm_file);
--
2.17.1
\
 
 \ /
  Last update: 2020-04-26 23:50    [W:0.578 / U:6.656 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site