f2fs: refresh recent accessed nat entry in lru list
Chao Yu
maintainerPATCH 1/2 f2fs: refresh recent accessed nat entry in lru list
From: Chao Yu <[email protected]>
Introduce nat_list_lock to protect nm_i->nat_entries list, and manage it as a LRU list, refresh location for therein recent accessed entries in the list.
--- fs/f2fs/f2fs.h | 1 + fs/f2fs/node.c | 46 ++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 43 insertions(+), 4 deletions(-)
fs/f2fs/f2fs.h +1 -0
@@ -780,6 +780,7 @@ struct f2fs_nm_info {struct radix_tree_root nat_set_root;/* root of the nat set cache */ struct rw_semaphore nat_tree_lock;/* protect nat_tree_lock */ struct list_head nat_entries;/* cached nat entry list (clean) */ +spinlock_t nat_list_lock;/* protect clean nat entry list */ unsigned int nat_cnt;/* the # of cached nat entries */ unsigned int dirty_nat_cnt;/* total num of nat entries in set */ unsigned int nat_blocks;/* # of nat blocks */
fs/f2fs/node.c +42 -4
106 lines not on this page · raw message
Signature · 1 line
2.18.0
Chao Yu
maintainerPATCH 2/2 f2fs: fix incorrect range->len in f2fs_trim_fs()
From: Chao Yu <[email protected]>
generic/260 reported below error:
[+] Default length with start set (should succeed)
[+] Length beyond the end of fs (should succeed)
[+] Length beyond the end of fs with start set (should succeed)
+./tests/generic/260: line 94: [: 18446744073709551615: integer expression expected +./tests/generic/260: line 104: [: 18446744073709551615: integer expression expected
Test done
...
In f2fs_trim_fs(), if there is no discard being trimmed, we need to correct range->len before return.
--- fs/f2fs/segment.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/f2fs/segment.c +2 -1
@@ -2626,8 +2626,9 @@ int f2fs_trim_fs(struct f2fs_sb_info *sbi, struct fstrim_range *range) trimmed +=__wait_discard_cmd_range (sbi, &dpolicy, start_block, end_block); - range->len =F2FS_BLK_TO_BYTES (trimmed); out: +if (!err) + range->len =F2FS_BLK_TO_BYTES (trimmed);return err; }
Signature · 1 line
2.18.0