diff options
-rw-r--r-- | fs/nilfs2/bmap.c | 13 | ||||
-rw-r--r-- | fs/nilfs2/bmap.h | 4 | ||||
-rw-r--r-- | fs/nilfs2/btree.c | 22 | ||||
-rw-r--r-- | fs/nilfs2/btree.h | 5 | ||||
-rw-r--r-- | fs/nilfs2/direct.c | 13 | ||||
-rw-r--r-- | fs/nilfs2/direct.h | 4 |
6 files changed, 18 insertions, 43 deletions
diff --git a/fs/nilfs2/bmap.c b/fs/nilfs2/bmap.c index cf5c5d2cfa00..de67d2a12515 100644 --- a/fs/nilfs2/bmap.c +++ b/fs/nilfs2/bmap.c | |||
@@ -101,8 +101,7 @@ static int nilfs_bmap_do_insert(struct nilfs_bmap *bmap, __u64 key, __u64 ptr) | |||
101 | if (n < 0) | 101 | if (n < 0) |
102 | return n; | 102 | return n; |
103 | ret = nilfs_btree_convert_and_insert( | 103 | ret = nilfs_btree_convert_and_insert( |
104 | bmap, key, ptr, keys, ptrs, n, | 104 | bmap, key, ptr, keys, ptrs, n); |
105 | NILFS_BMAP_LARGE_LOW, NILFS_BMAP_LARGE_HIGH); | ||
106 | if (ret == 0) | 105 | if (ret == 0) |
107 | bmap->b_u.u_flags |= NILFS_BMAP_LARGE; | 106 | bmap->b_u.u_flags |= NILFS_BMAP_LARGE; |
108 | 107 | ||
@@ -158,8 +157,7 @@ static int nilfs_bmap_do_delete(struct nilfs_bmap *bmap, __u64 key) | |||
158 | if (n < 0) | 157 | if (n < 0) |
159 | return n; | 158 | return n; |
160 | ret = nilfs_direct_delete_and_convert( | 159 | ret = nilfs_direct_delete_and_convert( |
161 | bmap, key, keys, ptrs, n, | 160 | bmap, key, keys, ptrs, n); |
162 | NILFS_BMAP_SMALL_LOW, NILFS_BMAP_SMALL_HIGH); | ||
163 | if (ret == 0) | 161 | if (ret == 0) |
164 | bmap->b_u.u_flags &= ~NILFS_BMAP_LARGE; | 162 | bmap->b_u.u_flags &= ~NILFS_BMAP_LARGE; |
165 | 163 | ||
@@ -681,12 +679,7 @@ int nilfs_bmap_read(struct nilfs_bmap *bmap, struct nilfs_inode *raw_inode) | |||
681 | } | 679 | } |
682 | 680 | ||
683 | return (bmap->b_u.u_flags & NILFS_BMAP_LARGE) ? | 681 | return (bmap->b_u.u_flags & NILFS_BMAP_LARGE) ? |
684 | nilfs_btree_init(bmap, | 682 | nilfs_btree_init(bmap) : nilfs_direct_init(bmap); |
685 | NILFS_BMAP_LARGE_LOW, | ||
686 | NILFS_BMAP_LARGE_HIGH) : | ||
687 | nilfs_direct_init(bmap, | ||
688 | NILFS_BMAP_SMALL_LOW, | ||
689 | NILFS_BMAP_SMALL_HIGH); | ||
690 | } | 683 | } |
691 | 684 | ||
692 | /** | 685 | /** |
diff --git a/fs/nilfs2/bmap.h b/fs/nilfs2/bmap.h index 978073bf5650..28c77bb71bb7 100644 --- a/fs/nilfs2/bmap.h +++ b/fs/nilfs2/bmap.h | |||
@@ -125,8 +125,6 @@ static inline int nilfs_bmap_is_new_ptr(unsigned long ptr) | |||
125 | * @b_inode: owner of bmap | 125 | * @b_inode: owner of bmap |
126 | * @b_ops: bmap operation table | 126 | * @b_ops: bmap operation table |
127 | * @b_pops: bmap ptr operation table | 127 | * @b_pops: bmap ptr operation table |
128 | * @b_low: low watermark of conversion | ||
129 | * @b_high: high watermark of conversion | ||
130 | * @b_last_allocated_key: last allocated key for data block | 128 | * @b_last_allocated_key: last allocated key for data block |
131 | * @b_last_allocated_ptr: last allocated ptr for data block | 129 | * @b_last_allocated_ptr: last allocated ptr for data block |
132 | * @b_state: state | 130 | * @b_state: state |
@@ -140,8 +138,6 @@ struct nilfs_bmap { | |||
140 | struct inode *b_inode; | 138 | struct inode *b_inode; |
141 | const struct nilfs_bmap_operations *b_ops; | 139 | const struct nilfs_bmap_operations *b_ops; |
142 | const struct nilfs_bmap_ptr_operations *b_pops; | 140 | const struct nilfs_bmap_ptr_operations *b_pops; |
143 | __u64 b_low; | ||
144 | __u64 b_high; | ||
145 | __u64 b_last_allocated_key; | 141 | __u64 b_last_allocated_key; |
146 | __u64 b_last_allocated_ptr; | 142 | __u64 b_last_allocated_ptr; |
147 | int b_state; | 143 | int b_state; |
diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c index 5b2606a0ac48..f5a0ec64e1aa 100644 --- a/fs/nilfs2/btree.c +++ b/fs/nilfs2/btree.c | |||
@@ -1527,7 +1527,7 @@ static int nilfs_btree_check_delete(struct nilfs_bmap *bmap, __u64 key) | |||
1527 | if (bh != NULL) | 1527 | if (bh != NULL) |
1528 | brelse(bh); | 1528 | brelse(bh); |
1529 | 1529 | ||
1530 | return (maxkey == key) && (nextmaxkey < bmap->b_low); | 1530 | return (maxkey == key) && (nextmaxkey < NILFS_BMAP_LARGE_LOW); |
1531 | } | 1531 | } |
1532 | 1532 | ||
1533 | static int nilfs_btree_gather_data(struct nilfs_bmap *bmap, | 1533 | static int nilfs_btree_gather_data(struct nilfs_bmap *bmap, |
@@ -1634,7 +1634,7 @@ static void | |||
1634 | nilfs_btree_commit_convert_and_insert(struct nilfs_bmap *bmap, | 1634 | nilfs_btree_commit_convert_and_insert(struct nilfs_bmap *bmap, |
1635 | __u64 key, __u64 ptr, | 1635 | __u64 key, __u64 ptr, |
1636 | const __u64 *keys, const __u64 *ptrs, | 1636 | const __u64 *keys, const __u64 *ptrs, |
1637 | int n, __u64 low, __u64 high, | 1637 | int n, |
1638 | union nilfs_bmap_ptr_req *dreq, | 1638 | union nilfs_bmap_ptr_req *dreq, |
1639 | union nilfs_bmap_ptr_req *nreq, | 1639 | union nilfs_bmap_ptr_req *nreq, |
1640 | struct buffer_head *bh) | 1640 | struct buffer_head *bh) |
@@ -1652,7 +1652,7 @@ nilfs_btree_commit_convert_and_insert(struct nilfs_bmap *bmap, | |||
1652 | 1652 | ||
1653 | /* convert and insert */ | 1653 | /* convert and insert */ |
1654 | btree = (struct nilfs_btree *)bmap; | 1654 | btree = (struct nilfs_btree *)bmap; |
1655 | nilfs_btree_init(bmap, low, high); | 1655 | nilfs_btree_init(bmap); |
1656 | if (nreq != NULL) { | 1656 | if (nreq != NULL) { |
1657 | bmap->b_pops->bpop_commit_alloc_ptr(bmap, dreq); | 1657 | bmap->b_pops->bpop_commit_alloc_ptr(bmap, dreq); |
1658 | bmap->b_pops->bpop_commit_alloc_ptr(bmap, nreq); | 1658 | bmap->b_pops->bpop_commit_alloc_ptr(bmap, nreq); |
@@ -1701,13 +1701,10 @@ nilfs_btree_commit_convert_and_insert(struct nilfs_bmap *bmap, | |||
1701 | * @keys: | 1701 | * @keys: |
1702 | * @ptrs: | 1702 | * @ptrs: |
1703 | * @n: | 1703 | * @n: |
1704 | * @low: | ||
1705 | * @high: | ||
1706 | */ | 1704 | */ |
1707 | int nilfs_btree_convert_and_insert(struct nilfs_bmap *bmap, | 1705 | int nilfs_btree_convert_and_insert(struct nilfs_bmap *bmap, |
1708 | __u64 key, __u64 ptr, | 1706 | __u64 key, __u64 ptr, |
1709 | const __u64 *keys, const __u64 *ptrs, | 1707 | const __u64 *keys, const __u64 *ptrs, int n) |
1710 | int n, __u64 low, __u64 high) | ||
1711 | { | 1708 | { |
1712 | struct buffer_head *bh; | 1709 | struct buffer_head *bh; |
1713 | union nilfs_bmap_ptr_req dreq, nreq, *di, *ni; | 1710 | union nilfs_bmap_ptr_req dreq, nreq, *di, *ni; |
@@ -1732,7 +1729,7 @@ int nilfs_btree_convert_and_insert(struct nilfs_bmap *bmap, | |||
1732 | if (ret < 0) | 1729 | if (ret < 0) |
1733 | return ret; | 1730 | return ret; |
1734 | nilfs_btree_commit_convert_and_insert(bmap, key, ptr, keys, ptrs, n, | 1731 | nilfs_btree_commit_convert_and_insert(bmap, key, ptr, keys, ptrs, n, |
1735 | low, high, di, ni, bh); | 1732 | di, ni, bh); |
1736 | nilfs_bmap_add_blocks(bmap, stats.bs_nblocks); | 1733 | nilfs_bmap_add_blocks(bmap, stats.bs_nblocks); |
1737 | return 0; | 1734 | return 0; |
1738 | } | 1735 | } |
@@ -2245,14 +2242,11 @@ static const struct nilfs_btree_operations nilfs_btree_ops_p = { | |||
2245 | .btop_assign = nilfs_btree_assign_p, | 2242 | .btop_assign = nilfs_btree_assign_p, |
2246 | }; | 2243 | }; |
2247 | 2244 | ||
2248 | int nilfs_btree_init(struct nilfs_bmap *bmap, __u64 low, __u64 high) | 2245 | int nilfs_btree_init(struct nilfs_bmap *bmap) |
2249 | { | 2246 | { |
2250 | struct nilfs_btree *btree; | 2247 | struct nilfs_btree *btree = (struct nilfs_btree *)bmap; |
2251 | 2248 | ||
2252 | btree = (struct nilfs_btree *)bmap; | ||
2253 | bmap->b_ops = &nilfs_btree_ops; | 2249 | bmap->b_ops = &nilfs_btree_ops; |
2254 | bmap->b_low = low; | ||
2255 | bmap->b_high = high; | ||
2256 | switch (bmap->b_inode->i_ino) { | 2250 | switch (bmap->b_inode->i_ino) { |
2257 | case NILFS_DAT_INO: | 2251 | case NILFS_DAT_INO: |
2258 | btree->bt_ops = &nilfs_btree_ops_p; | 2252 | btree->bt_ops = &nilfs_btree_ops_p; |
@@ -2267,7 +2261,5 @@ int nilfs_btree_init(struct nilfs_bmap *bmap, __u64 low, __u64 high) | |||
2267 | 2261 | ||
2268 | void nilfs_btree_init_gc(struct nilfs_bmap *bmap) | 2262 | void nilfs_btree_init_gc(struct nilfs_bmap *bmap) |
2269 | { | 2263 | { |
2270 | bmap->b_low = NILFS_BMAP_LARGE_LOW; | ||
2271 | bmap->b_high = NILFS_BMAP_LARGE_HIGH; | ||
2272 | bmap->b_ops = &nilfs_btree_ops_gc; | 2264 | bmap->b_ops = &nilfs_btree_ops_gc; |
2273 | } | 2265 | } |
diff --git a/fs/nilfs2/btree.h b/fs/nilfs2/btree.h index 4766deb52fb1..48aad2a0c59f 100644 --- a/fs/nilfs2/btree.h +++ b/fs/nilfs2/btree.h | |||
@@ -108,10 +108,9 @@ struct nilfs_btree { | |||
108 | 108 | ||
109 | int nilfs_btree_path_cache_init(void); | 109 | int nilfs_btree_path_cache_init(void); |
110 | void nilfs_btree_path_cache_destroy(void); | 110 | void nilfs_btree_path_cache_destroy(void); |
111 | int nilfs_btree_init(struct nilfs_bmap *, __u64, __u64); | 111 | int nilfs_btree_init(struct nilfs_bmap *); |
112 | int nilfs_btree_convert_and_insert(struct nilfs_bmap *, __u64, __u64, | 112 | int nilfs_btree_convert_and_insert(struct nilfs_bmap *, __u64, __u64, |
113 | const __u64 *, const __u64 *, | 113 | const __u64 *, const __u64 *, int); |
114 | int, __u64, __u64); | ||
115 | void nilfs_btree_init_gc(struct nilfs_bmap *); | 114 | void nilfs_btree_init_gc(struct nilfs_bmap *); |
116 | 115 | ||
117 | #endif /* _NILFS_BTREE_H */ | 116 | #endif /* _NILFS_BTREE_H */ |
diff --git a/fs/nilfs2/direct.c b/fs/nilfs2/direct.c index eaeccb068b5e..8e8095c2e1bb 100644 --- a/fs/nilfs2/direct.c +++ b/fs/nilfs2/direct.c | |||
@@ -242,8 +242,7 @@ static int nilfs_direct_gather_data(struct nilfs_bmap *bmap, | |||
242 | } | 242 | } |
243 | 243 | ||
244 | int nilfs_direct_delete_and_convert(struct nilfs_bmap *bmap, | 244 | int nilfs_direct_delete_and_convert(struct nilfs_bmap *bmap, |
245 | __u64 key, __u64 *keys, __u64 *ptrs, | 245 | __u64 key, __u64 *keys, __u64 *ptrs, int n) |
246 | int n, __u64 low, __u64 high) | ||
247 | { | 246 | { |
248 | struct nilfs_direct *direct; | 247 | struct nilfs_direct *direct; |
249 | __le64 *dptrs; | 248 | __le64 *dptrs; |
@@ -273,8 +272,7 @@ int nilfs_direct_delete_and_convert(struct nilfs_bmap *bmap, | |||
273 | dptrs[i] = NILFS_BMAP_INVALID_PTR; | 272 | dptrs[i] = NILFS_BMAP_INVALID_PTR; |
274 | } | 273 | } |
275 | 274 | ||
276 | nilfs_direct_init(bmap, low, high); | 275 | nilfs_direct_init(bmap); |
277 | |||
278 | return 0; | 276 | return 0; |
279 | } | 277 | } |
280 | 278 | ||
@@ -410,14 +408,11 @@ static const struct nilfs_direct_operations nilfs_direct_ops_p = { | |||
410 | .dop_assign = nilfs_direct_assign_p, | 408 | .dop_assign = nilfs_direct_assign_p, |
411 | }; | 409 | }; |
412 | 410 | ||
413 | int nilfs_direct_init(struct nilfs_bmap *bmap, __u64 low, __u64 high) | 411 | int nilfs_direct_init(struct nilfs_bmap *bmap) |
414 | { | 412 | { |
415 | struct nilfs_direct *direct; | 413 | struct nilfs_direct *direct = (struct nilfs_direct *)bmap; |
416 | 414 | ||
417 | direct = (struct nilfs_direct *)bmap; | ||
418 | bmap->b_ops = &nilfs_direct_ops; | 415 | bmap->b_ops = &nilfs_direct_ops; |
419 | bmap->b_low = low; | ||
420 | bmap->b_high = high; | ||
421 | switch (bmap->b_inode->i_ino) { | 416 | switch (bmap->b_inode->i_ino) { |
422 | case NILFS_DAT_INO: | 417 | case NILFS_DAT_INO: |
423 | direct->d_ops = &nilfs_direct_ops_p; | 418 | direct->d_ops = &nilfs_direct_ops_p; |
diff --git a/fs/nilfs2/direct.h b/fs/nilfs2/direct.h index 45d2c5cda812..d645f13b9aea 100644 --- a/fs/nilfs2/direct.h +++ b/fs/nilfs2/direct.h | |||
@@ -70,9 +70,9 @@ struct nilfs_direct { | |||
70 | #define NILFS_DIRECT_KEY_MAX (NILFS_DIRECT_NBLOCKS - 1) | 70 | #define NILFS_DIRECT_KEY_MAX (NILFS_DIRECT_NBLOCKS - 1) |
71 | 71 | ||
72 | 72 | ||
73 | int nilfs_direct_init(struct nilfs_bmap *, __u64, __u64); | 73 | int nilfs_direct_init(struct nilfs_bmap *); |
74 | int nilfs_direct_delete_and_convert(struct nilfs_bmap *, __u64, __u64 *, | 74 | int nilfs_direct_delete_and_convert(struct nilfs_bmap *, __u64, __u64 *, |
75 | __u64 *, int, __u64, __u64); | 75 | __u64 *, int); |
76 | 76 | ||
77 | 77 | ||
78 | #endif /* _NILFS_DIRECT_H */ | 78 | #endif /* _NILFS_DIRECT_H */ |