Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1337853

[PATCH] f2fs: add new wraper function for reading inline data

From Shawn Lin <shawn.lin@rock-chips.com>
Newsgroups linux.kernel
Subject [PATCH] f2fs: add new wraper function for reading inline data
Date 2016-02-19 04:00 +0100
Message-ID <r3Jsu-6IV-7@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


This patch add __read_inline_data which will no check
PageUptodate and page->index. This can be reused by
f2fs_convert_inline_page to reduce the redundant code
copied from read_inline_data.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---

 fs/f2fs/inline.c | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c
index d27347e..39eeff1 100644
--- a/fs/f2fs/inline.c
+++ b/fs/f2fs/inline.c
@@ -42,15 +42,11 @@ bool f2fs_may_inline_dentry(struct inode *inode)
 	return true;
 }
 
-void read_inline_data(struct page *page, struct page *ipage)
+static inline void __read_inline_data(struct page *page,
+				      struct page *ipage)
 {
 	void *src_addr, *dst_addr;
 
-	if (PageUptodate(page))
-		return;
-
-	f2fs_bug_on(F2FS_P_SB(page), page->index);
-
 	zero_user_segment(page, MAX_INLINE_DATA, PAGE_CACHE_SIZE);
 
 	/* Copy the whole inline data block */
@@ -61,6 +57,15 @@ void read_inline_data(struct page *page, struct page *ipage)
 	kunmap_atomic(dst_addr);
 	SetPageUptodate(page);
 }
+void read_inline_data(struct page *page, struct page *ipage)
+{
+	if (PageUptodate(page))
+		return;
+
+	f2fs_bug_on(F2FS_P_SB(page), page->index);
+
+	__read_inline_data(page, ipage);
+}
 
 bool truncate_inline_inode(struct page *ipage, u64 from)
 {
@@ -128,15 +133,8 @@ int f2fs_convert_inline_page(struct dnode_of_data *dn, struct page *page)
 	if (PageUptodate(page))
 		goto no_update;
 
-	zero_user_segment(page, MAX_INLINE_DATA, PAGE_CACHE_SIZE);
+	__read_inline_data(page, dn->inode_page);
 
-	/* Copy the whole inline data block */
-	src_addr = inline_data_addr(dn->inode_page);
-	dst_addr = kmap_atomic(page);
-	memcpy(dst_addr, src_addr, MAX_INLINE_DATA);
-	flush_dcache_page(page);
-	kunmap_atomic(dst_addr);
-	SetPageUptodate(page);
 no_update:
 	set_page_dirty(page);
 
-- 
2.3.7

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] f2fs: add new wraper function for reading inline data Shawn Lin <shawn.lin@rock-chips.com> - 2016-02-19 04:00 +0100
  RE: [PATCH] f2fs: add new wraper function for reading inline data Chao Yu <chao2.yu@samsung.com> - 2016-02-19 08:40 +0100
    Re: [PATCH] f2fs: add new wraper function for reading inline data Shawn Lin <shawn.lin@rock-chips.com> - 2016-02-19 08:50 +0100

csiph-web