diff options
author | Chris Mason <chris.mason@oracle.com> | 2011-06-03 09:36:29 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2011-06-04 08:03:47 -0400 |
commit | 4b9465cb9e3859186eefa1ca3b990a5849386320 (patch) | |
tree | 8fc06452fb75e52f6c1c2e2253c2ff6700e622fd /fs/btrfs/inode-map.c | |
parent | e7786c3ae517b2c433edc91714e86be770e9f1ce (diff) |
Btrfs: add mount -o inode_cache
This makes the inode map cache default to off until we
fix the overflow problem when the free space crcs don't fit
inside a single page.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/inode-map.c')
-rw-r--r-- | fs/btrfs/inode-map.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/fs/btrfs/inode-map.c b/fs/btrfs/inode-map.c index 2d0d50067a7b..cb79b8975c9f 100644 --- a/fs/btrfs/inode-map.c +++ b/fs/btrfs/inode-map.c | |||
@@ -38,6 +38,9 @@ static int caching_kthread(void *data) | |||
38 | int slot; | 38 | int slot; |
39 | int ret; | 39 | int ret; |
40 | 40 | ||
41 | if (!btrfs_test_opt(root, INODE_MAP_CACHE)) | ||
42 | return 0; | ||
43 | |||
41 | path = btrfs_alloc_path(); | 44 | path = btrfs_alloc_path(); |
42 | if (!path) | 45 | if (!path) |
43 | return -ENOMEM; | 46 | return -ENOMEM; |
@@ -141,6 +144,9 @@ static void start_caching(struct btrfs_root *root) | |||
141 | int ret; | 144 | int ret; |
142 | u64 objectid; | 145 | u64 objectid; |
143 | 146 | ||
147 | if (!btrfs_test_opt(root, INODE_MAP_CACHE)) | ||
148 | return; | ||
149 | |||
144 | spin_lock(&root->cache_lock); | 150 | spin_lock(&root->cache_lock); |
145 | if (root->cached != BTRFS_CACHE_NO) { | 151 | if (root->cached != BTRFS_CACHE_NO) { |
146 | spin_unlock(&root->cache_lock); | 152 | spin_unlock(&root->cache_lock); |
@@ -178,6 +184,9 @@ static void start_caching(struct btrfs_root *root) | |||
178 | 184 | ||
179 | int btrfs_find_free_ino(struct btrfs_root *root, u64 *objectid) | 185 | int btrfs_find_free_ino(struct btrfs_root *root, u64 *objectid) |
180 | { | 186 | { |
187 | if (!btrfs_test_opt(root, INODE_MAP_CACHE)) | ||
188 | return btrfs_find_free_objectid(root, objectid); | ||
189 | |||
181 | again: | 190 | again: |
182 | *objectid = btrfs_find_ino_for_alloc(root); | 191 | *objectid = btrfs_find_ino_for_alloc(root); |
183 | 192 | ||
@@ -201,6 +210,10 @@ void btrfs_return_ino(struct btrfs_root *root, u64 objectid) | |||
201 | { | 210 | { |
202 | struct btrfs_free_space_ctl *ctl = root->free_ino_ctl; | 211 | struct btrfs_free_space_ctl *ctl = root->free_ino_ctl; |
203 | struct btrfs_free_space_ctl *pinned = root->free_ino_pinned; | 212 | struct btrfs_free_space_ctl *pinned = root->free_ino_pinned; |
213 | |||
214 | if (!btrfs_test_opt(root, INODE_MAP_CACHE)) | ||
215 | return; | ||
216 | |||
204 | again: | 217 | again: |
205 | if (root->cached == BTRFS_CACHE_FINISHED) { | 218 | if (root->cached == BTRFS_CACHE_FINISHED) { |
206 | __btrfs_add_free_space(ctl, objectid, 1); | 219 | __btrfs_add_free_space(ctl, objectid, 1); |
@@ -250,6 +263,9 @@ void btrfs_unpin_free_ino(struct btrfs_root *root) | |||
250 | struct rb_node *n; | 263 | struct rb_node *n; |
251 | u64 count; | 264 | u64 count; |
252 | 265 | ||
266 | if (!btrfs_test_opt(root, INODE_MAP_CACHE)) | ||
267 | return; | ||
268 | |||
253 | while (1) { | 269 | while (1) { |
254 | n = rb_first(rbroot); | 270 | n = rb_first(rbroot); |
255 | if (!n) | 271 | if (!n) |
@@ -399,9 +415,13 @@ int btrfs_save_ino_cache(struct btrfs_root *root, | |||
399 | root != root->fs_info->tree_root) | 415 | root != root->fs_info->tree_root) |
400 | return 0; | 416 | return 0; |
401 | 417 | ||
418 | if (!btrfs_test_opt(root, INODE_MAP_CACHE)) | ||
419 | return 0; | ||
420 | |||
402 | path = btrfs_alloc_path(); | 421 | path = btrfs_alloc_path(); |
403 | if (!path) | 422 | if (!path) |
404 | return -ENOMEM; | 423 | return -ENOMEM; |
424 | |||
405 | again: | 425 | again: |
406 | inode = lookup_free_ino_inode(root, path); | 426 | inode = lookup_free_ino_inode(root, path); |
407 | if (IS_ERR(inode) && PTR_ERR(inode) != -ENOENT) { | 427 | if (IS_ERR(inode) && PTR_ERR(inode) != -ENOENT) { |