Skip to contentSkip to conversation

f2fs: maintain extent cache in separated file

PATCH RESEND In review Chao Yu 3 participants 4 messages Jul 8, 2015 – Jul 14, 2015 F2FS file system

lore
Share & tools
lore

Chao Yu

author
#0 lore raw

PATCH RESEND 1/1 f2fs: maintain extent cache in separated file

This patch moves extent cache related code from data.c into extent_cache.c since extent cache is independent feature, and its codes are not relate to others in data.c, it's better for us to maintain them in separated place.

There is no functionality change, but several small coding style fixes including:
* rename __drop_largest_extent to f2fs_drop_largest_extent for exporting;
* rename misspelled word 'untill' to 'until';
* remove unneeded 'return' in the end of f2fs_destroy_extent_tree().

---
 fs/f2fs/Makefile       |   2 +-
 fs/f2fs/data.c         | 578 +----------------------------------------------
 fs/f2fs/extent_cache.c | 594 +++++++++++++++++++++++++++++++++++++++++++++++++
 fs/f2fs/f2fs.h         |  22 +-
 4 files changed, 610 insertions(+), 586 deletions(-)
 create mode 100644 fs/f2fs/extent_cache.c
fs/f2fs/Makefile +1 -1
index 005251b..08e101e 100644
@@ -2,7 +2,7 @@ obj-$(CONFIG_F2FS_FS) += f2fs.o
 
 f2fs-y		:= dir.o file.o inode.o namei.o hash.o super.o inline.o
 f2fs-y		+= checkpoint.o gc.o data.o node.o segment.o recovery.o
-f2fs-y		+= shrinker.o
+f2fs-y		+= shrinker.o extent_cache.o
 f2fs-$(CONFIG_F2FS_STAT_FS) += debug.o
 f2fs-$(CONFIG_F2FS_FS_XATTR) += xattr.o
 f2fs-$(CONFIG_F2FS_FS_POSIX_ACL) += acl.o
fs/f2fs/data.c +1 -577

602 lines not on this page · raw message

fs/f2fs/extent_cache.c new file +594 -0

594 lines not on this page · raw message

fs/f2fs/f2fs.h +14 -8
index 1e6f54d..8b17105 100644
@@ -1766,20 +1766,12 @@ void f2fs_submit_page_mbio(struct f2fs_io_info *);
 void set_data_blkaddr(struct dnode_of_data *);
 int reserve_new_block(struct dnode_of_data *);
 int f2fs_reserve_block(struct dnode_of_data *, pgoff_t);
-unsigned int f2fs_shrink_extent_tree(struct f2fs_sb_info *, int);
-void f2fs_init_extent_tree(struct inode *, struct f2fs_extent *);
-unsigned int f2fs_destroy_extent_node(struct inode *);
-void f2fs_destroy_extent_tree(struct inode *);
-void f2fs_update_extent_cache(struct dnode_of_data *);
 struct page *get_read_data_page(struct inode *, pgoff_t, int);
 struct page *find_data_page(struct inode *, pgoff_t);
 struct page *get_lock_data_page(struct inode *, pgoff_t);
 struct page *get_new_data_page(struct inode *, struct page *, pgoff_t, bool);
 int do_write_data_page(struct f2fs_io_info *);
 int f2fs_fiemap(struct inode *inode, struct fiemap_extent_info *, u64, u64);
-void init_extent_cache_info(struct f2fs_sb_info *);
-int __init create_extent_cache(void);
-void destroy_extent_cache(void);
 void f2fs_invalidate_page(struct page *, unsigned int, unsigned int);
 int f2fs_release_page(struct page *, gfp_t);
 
@@ -1977,6 +1969,20 @@ void f2fs_join_shrinker(struct f2fs_sb_info *);
 void f2fs_leave_shrinker(struct f2fs_sb_info *);
 
 /*
+ * extent_cache.c
+ */
+unsigned int f2fs_shrink_extent_tree(struct f2fs_sb_info *, int);
+void f2fs_drop_largest_extent(struct inode *, pgoff_t);
+void f2fs_init_extent_tree(struct inode *, struct f2fs_extent *);
+void f2fs_destroy_extent_node(struct inode *);
+void f2fs_destroy_extent_tree(struct inode *);
+bool f2fs_lookup_extent_cache(struct inode *, pgoff_t, struct extent_info *);
+void f2fs_update_extent_cache(struct dnode_of_data *);
+void init_extent_cache_info(struct f2fs_sb_info *);
+int __init create_extent_cache(void);
+void destroy_extent_cache(void);
+
+/*
  * crypto support
  */
 static inline int f2fs_encrypted_inode(struct inode *inode)
Signature · 1 line
2.4.2
#1 lore raw
Quoted 1 line

From 8956df8fa1a669e8e476456e4afe0eccd8174684 Mon Sep 17 00:00:00 2001

From: Chao Yu <[email protected]>
Date: Wed, 8 Jul 2015 20:49:05 +0800
Subject: [PATCH] f2fs: maintain extent cache in separated file

This patch moves extent cache related code from data.c into extent_cache.c since extent cache is independent feature, and its codes are not relate to others in data.c, it's better for us to maintain them in separated place.

There is no functionality change, but several small coding style fixes including:
* rename __drop_largest_extent to f2fs_drop_largest_extent for exporting;
* rename misspelled word 'untill' to 'until';
* remove unneeded 'return' in the end of f2fs_destroy_extent_tree().

---
 fs/f2fs/Makefile       |   2 +-
 fs/f2fs/data.c         | 578 +----------------------------------------------
 fs/f2fs/extent_cache.c | 594 +++++++++++++++++++++++++++++++++++++++++++++++++
 fs/f2fs/f2fs.h         |  22 +-
 4 files changed, 610 insertions(+), 586 deletions(-)
 create mode 100644 fs/f2fs/extent_cache.c
fs/f2fs/Makefile +1 -1
index 005251b..08e101e 100644
@@ -2,7 +2,7 @@ obj-$(CONFIG_F2FS_FS) += f2fs.o
 
 f2fs-y		:= dir.o file.o inode.o namei.o hash.o super.o inline.o
 f2fs-y		+= checkpoint.o gc.o data.o node.o segment.o recovery.o
-f2fs-y		+= shrinker.o
+f2fs-y		+= shrinker.o extent_cache.o
 f2fs-$(CONFIG_F2FS_STAT_FS) += debug.o
 f2fs-$(CONFIG_F2FS_FS_XATTR) += xattr.o
 f2fs-$(CONFIG_F2FS_FS_POSIX_ACL) += acl.o
fs/f2fs/data.c +1 -577

602 lines not on this page · raw message

fs/f2fs/extent_cache.c new file +594 -0

594 lines not on this page · raw message

fs/f2fs/f2fs.h +14 -8
index 1e6f54d..88b05cb 100644
@@ -1766,20 +1766,12 @@ void f2fs_submit_page_mbio(struct f2fs_io_info *);
 void set_data_blkaddr(struct dnode_of_data *);
 int reserve_new_block(struct dnode_of_data *);
 int f2fs_reserve_block(struct dnode_of_data *, pgoff_t);
-unsigned int f2fs_shrink_extent_tree(struct f2fs_sb_info *, int);
-void f2fs_init_extent_tree(struct inode *, struct f2fs_extent *);
-unsigned int f2fs_destroy_extent_node(struct inode *);
-void f2fs_destroy_extent_tree(struct inode *);
-void f2fs_update_extent_cache(struct dnode_of_data *);
 struct page *get_read_data_page(struct inode *, pgoff_t, int);
 struct page *find_data_page(struct inode *, pgoff_t);
 struct page *get_lock_data_page(struct inode *, pgoff_t);
 struct page *get_new_data_page(struct inode *, struct page *, pgoff_t, bool);
 int do_write_data_page(struct f2fs_io_info *);
 int f2fs_fiemap(struct inode *inode, struct fiemap_extent_info *, u64, u64);
-void init_extent_cache_info(struct f2fs_sb_info *);
-int __init create_extent_cache(void);
-void destroy_extent_cache(void);
 void f2fs_invalidate_page(struct page *, unsigned int, unsigned int);
 int f2fs_release_page(struct page *, gfp_t);
 
@@ -1977,6 +1969,20 @@ void f2fs_join_shrinker(struct f2fs_sb_info *);
 void f2fs_leave_shrinker(struct f2fs_sb_info *);
 
 /*
+ * extent_cache.c
+ */
+unsigned int f2fs_shrink_extent_tree(struct f2fs_sb_info *, int);
+void f2fs_drop_largest_extent(struct inode *, pgoff_t);
+void f2fs_init_extent_tree(struct inode *, struct f2fs_extent *);
+unsigned int f2fs_destroy_extent_node(struct inode *);
+void f2fs_destroy_extent_tree(struct inode *);
+bool f2fs_lookup_extent_cache(struct inode *, pgoff_t, struct extent_info *);
+void f2fs_update_extent_cache(struct dnode_of_data *);
+void init_extent_cache_info(struct f2fs_sb_info *);
+int __init create_extent_cache(void);
+void destroy_extent_cache(void);
+
+/*
  * crypto support
  */
 static inline int f2fs_encrypted_inode(struct inode *inode)
Signature · 1 line
2.4.2
author
#2 lore raw

Hi Jaegeuk,

Quoted 16 lines

-----Original Message-----
From: Chao Yu [mailto:[email protected]]
Sent: Thursday, July 09, 2015 12:16 AM
To: 'Jaegeuk Kim'
Cc: [email protected]; [email protected]
Subject: Re: [f2fs-dev] [PATCH RESEND] f2fs: maintain extent cache in separated file

Quoted 1 line

From 8956df8fa1a669e8e476456e4afe0eccd8174684 Mon Sep 17 00:00:00 2001

From: Chao Yu <[email protected]>
Date: Wed, 8 Jul 2015 20:49:05 +0800
Subject: [PATCH] f2fs: maintain extent cache in separated file

This patch moves extent cache related code from data.c into extent_cache.c since extent cache is independent feature, and its codes are not relate to others in data.c, it's better for us to maintain them in separated place.

Quoted 6 lines

There is no functionality change, but several small coding style fixes including:
* rename __drop_largest_extent to f2fs_drop_largest_extent for exporting;
* rename misspelled word 'untill' to 'until';
* remove unneeded 'return' in the end of f2fs_destroy_extent_tree().

I think commit 0b84ceec9891 ("f2fs: don't try to split extents shorter than F2FS_MIN_EXTENT_LEN") is conflict with commit 392a1c419916 ("f2fs: maintain extent cache in separated file"), and it's not well resolved in dev-test.

in commit 392a1c419916 ("f2fs: maintain extent cache in separated file"):

- if (dei.len > F2FS_MIN_EXTENT_LEN) {

+ if (dei.len > 1) {

So how about merging this patch (f2fs: maintain extent cache in separated file) first, and then merge Fan's patch? because one line modification in extent_cache.c for fixing conflict seems much easier.

BTW, I have already fixed the building error in this patch, you can directly use the last sent patch in this thread showed in below link. :)

http://sourceforge.net/p/linux-f2fs/mailman/message/34277570/

Thanks,

maintainer
#3 lore raw
Quoted 29 lines · Chao Yu

Hi Jaegeuk,

Quoted 16 lines

-----Original Message-----
From: Chao Yu [mailto:[email protected]]
Sent: Thursday, July 09, 2015 12:16 AM
To: 'Jaegeuk Kim'
Cc: [email protected]; [email protected]
Subject: Re: [f2fs-dev] [PATCH RESEND] f2fs: maintain extent cache in separated file

Quoted 1 line

From 8956df8fa1a669e8e476456e4afe0eccd8174684 Mon Sep 17 00:00:00 2001

From: Chao Yu <[email protected]>
Date: Wed, 8 Jul 2015 20:49:05 +0800
Subject: [PATCH] f2fs: maintain extent cache in separated file

This patch moves extent cache related code from data.c into extent_cache.c since extent cache is independent feature, and its codes are not relate to others in data.c, it's better for us to maintain them in separated place.

Quoted 6 lines

There is no functionality change, but several small coding style fixes including:
* rename __drop_largest_extent to f2fs_drop_largest_extent for exporting;
* rename misspelled word 'untill' to 'until';
* remove unneeded 'return' in the end of f2fs_destroy_extent_tree().

I think commit 0b84ceec9891 ("f2fs: don't try to split extents shorter than F2FS_MIN_EXTENT_LEN") is conflict with commit 392a1c419916 ("f2fs: maintain extent cache in separated file"), and it's not well resolved in dev-test.

Quoted 5 lines

in commit 392a1c419916 ("f2fs: maintain extent cache in separated file"):

- if (dei.len > F2FS_MIN_EXTENT_LEN) {

+ if (dei.len > 1) {

Good catch.
Not a big deal, so I just resolved that in this patch. :)

Thanks,

Quoted 11 lines

So how about merging this patch (f2fs: maintain extent cache in separated file) first, and then merge Fan's patch? because one line modification in extent_cache.c for fixing conflict seems much easier.

BTW, I have already fixed the building error in this patch, you can directly use the last sent patch in this thread showed in below link. :)

http://sourceforge.net/p/linux-f2fs/mailman/message/34277570/

Thanks,