diff options
author | Chao Yu <chao2.yu@samsung.com> | 2014-04-16 22:51:05 -0400 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2014-05-06 21:21:55 -0400 |
commit | 94dac22e72e891b16e8e8abbdb6df10f322d20e0 (patch) | |
tree | b0519ec2534e4689527c25cd89723cc00b5304eb /fs/f2fs/node.c | |
parent | 876dc59eb1f0131c092803d0d206d47dd0119dfe (diff) |
f2fs: introduce raw_nat_from_node_info() to simplfy codes
This patch introduce raw_nat_from_node_info() to simplfy some codes, and also
use exist function node_info_from_raw_nat() to do the same job.
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs/node.c')
-rw-r--r-- | fs/f2fs/node.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 38fe5f534e7d..837f5fdabd19 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c | |||
@@ -179,9 +179,7 @@ retry: | |||
179 | write_unlock(&nm_i->nat_tree_lock); | 179 | write_unlock(&nm_i->nat_tree_lock); |
180 | goto retry; | 180 | goto retry; |
181 | } | 181 | } |
182 | nat_set_blkaddr(e, le32_to_cpu(ne->block_addr)); | 182 | node_info_from_raw_nat(&e->ni, ne); |
183 | nat_set_ino(e, le32_to_cpu(ne->ino)); | ||
184 | nat_set_version(e, ne->version); | ||
185 | } | 183 | } |
186 | write_unlock(&nm_i->nat_tree_lock); | 184 | write_unlock(&nm_i->nat_tree_lock); |
187 | } | 185 | } |
@@ -1755,9 +1753,7 @@ retry: | |||
1755 | write_unlock(&nm_i->nat_tree_lock); | 1753 | write_unlock(&nm_i->nat_tree_lock); |
1756 | goto retry; | 1754 | goto retry; |
1757 | } | 1755 | } |
1758 | nat_set_blkaddr(ne, le32_to_cpu(raw_ne.block_addr)); | 1756 | node_info_from_raw_nat(&ne->ni, &raw_ne); |
1759 | nat_set_ino(ne, le32_to_cpu(raw_ne.ino)); | ||
1760 | nat_set_version(ne, raw_ne.version); | ||
1761 | __set_nat_cache_dirty(nm_i, ne); | 1757 | __set_nat_cache_dirty(nm_i, ne); |
1762 | write_unlock(&nm_i->nat_tree_lock); | 1758 | write_unlock(&nm_i->nat_tree_lock); |
1763 | } | 1759 | } |
@@ -1790,7 +1786,6 @@ void flush_nat_entries(struct f2fs_sb_info *sbi) | |||
1790 | nid_t nid; | 1786 | nid_t nid; |
1791 | struct f2fs_nat_entry raw_ne; | 1787 | struct f2fs_nat_entry raw_ne; |
1792 | int offset = -1; | 1788 | int offset = -1; |
1793 | block_t new_blkaddr; | ||
1794 | 1789 | ||
1795 | if (nat_get_blkaddr(ne) == NEW_ADDR) | 1790 | if (nat_get_blkaddr(ne) == NEW_ADDR) |
1796 | continue; | 1791 | continue; |
@@ -1826,11 +1821,7 @@ to_nat_page: | |||
1826 | f2fs_bug_on(!nat_blk); | 1821 | f2fs_bug_on(!nat_blk); |
1827 | raw_ne = nat_blk->entries[nid - start_nid]; | 1822 | raw_ne = nat_blk->entries[nid - start_nid]; |
1828 | flush_now: | 1823 | flush_now: |
1829 | new_blkaddr = nat_get_blkaddr(ne); | 1824 | raw_nat_from_node_info(&raw_ne, &ne->ni); |
1830 | |||
1831 | raw_ne.ino = cpu_to_le32(nat_get_ino(ne)); | ||
1832 | raw_ne.block_addr = cpu_to_le32(new_blkaddr); | ||
1833 | raw_ne.version = nat_get_version(ne); | ||
1834 | 1825 | ||
1835 | if (offset < 0) { | 1826 | if (offset < 0) { |
1836 | nat_blk->entries[nid - start_nid] = raw_ne; | 1827 | nat_blk->entries[nid - start_nid] = raw_ne; |