aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/delayed-inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/delayed-inode.c')
-rw-r--r--fs/btrfs/delayed-inode.c66
1 files changed, 13 insertions, 53 deletions
diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c
index 14fce27b4780..f26f38ccd194 100644
--- a/fs/btrfs/delayed-inode.c
+++ b/fs/btrfs/delayed-inode.c
@@ -202,7 +202,7 @@ static void btrfs_dequeue_delayed_node(struct btrfs_delayed_root *root,
202 spin_unlock(&root->lock); 202 spin_unlock(&root->lock);
203} 203}
204 204
205struct btrfs_delayed_node *btrfs_first_delayed_node( 205static struct btrfs_delayed_node *btrfs_first_delayed_node(
206 struct btrfs_delayed_root *delayed_root) 206 struct btrfs_delayed_root *delayed_root)
207{ 207{
208 struct list_head *p; 208 struct list_head *p;
@@ -221,7 +221,7 @@ out:
221 return node; 221 return node;
222} 222}
223 223
224struct btrfs_delayed_node *btrfs_next_delayed_node( 224static struct btrfs_delayed_node *btrfs_next_delayed_node(
225 struct btrfs_delayed_node *node) 225 struct btrfs_delayed_node *node)
226{ 226{
227 struct btrfs_delayed_root *delayed_root; 227 struct btrfs_delayed_root *delayed_root;
@@ -282,7 +282,7 @@ static inline void btrfs_release_delayed_node(struct btrfs_delayed_node *node)
282 __btrfs_release_delayed_node(node, 0); 282 __btrfs_release_delayed_node(node, 0);
283} 283}
284 284
285struct btrfs_delayed_node *btrfs_first_prepared_delayed_node( 285static struct btrfs_delayed_node *btrfs_first_prepared_delayed_node(
286 struct btrfs_delayed_root *delayed_root) 286 struct btrfs_delayed_root *delayed_root)
287{ 287{
288 struct list_head *p; 288 struct list_head *p;
@@ -308,7 +308,7 @@ static inline void btrfs_release_prepared_delayed_node(
308 __btrfs_release_delayed_node(node, 1); 308 __btrfs_release_delayed_node(node, 1);
309} 309}
310 310
311struct btrfs_delayed_item *btrfs_alloc_delayed_item(u32 data_len) 311static struct btrfs_delayed_item *btrfs_alloc_delayed_item(u32 data_len)
312{ 312{
313 struct btrfs_delayed_item *item; 313 struct btrfs_delayed_item *item;
314 item = kmalloc(sizeof(*item) + data_len, GFP_NOFS); 314 item = kmalloc(sizeof(*item) + data_len, GFP_NOFS);
@@ -383,7 +383,7 @@ static struct btrfs_delayed_item *__btrfs_lookup_delayed_item(
383 return NULL; 383 return NULL;
384} 384}
385 385
386struct btrfs_delayed_item *__btrfs_lookup_delayed_insertion_item( 386static struct btrfs_delayed_item *__btrfs_lookup_delayed_insertion_item(
387 struct btrfs_delayed_node *delayed_node, 387 struct btrfs_delayed_node *delayed_node,
388 struct btrfs_key *key) 388 struct btrfs_key *key)
389{ 389{
@@ -394,45 +394,6 @@ struct btrfs_delayed_item *__btrfs_lookup_delayed_insertion_item(
394 return item; 394 return item;
395} 395}
396 396
397struct btrfs_delayed_item *__btrfs_lookup_delayed_deletion_item(
398 struct btrfs_delayed_node *delayed_node,
399 struct btrfs_key *key)
400{
401 struct btrfs_delayed_item *item;
402
403 item = __btrfs_lookup_delayed_item(&delayed_node->del_root, key,
404 NULL, NULL);
405 return item;
406}
407
408struct btrfs_delayed_item *__btrfs_search_delayed_insertion_item(
409 struct btrfs_delayed_node *delayed_node,
410 struct btrfs_key *key)
411{
412 struct btrfs_delayed_item *item, *next;
413
414 item = __btrfs_lookup_delayed_item(&delayed_node->ins_root, key,
415 NULL, &next);
416 if (!item)
417 item = next;
418
419 return item;
420}
421
422struct btrfs_delayed_item *__btrfs_search_delayed_deletion_item(
423 struct btrfs_delayed_node *delayed_node,
424 struct btrfs_key *key)
425{
426 struct btrfs_delayed_item *item, *next;
427
428 item = __btrfs_lookup_delayed_item(&delayed_node->del_root, key,
429 NULL, &next);
430 if (!item)
431 item = next;
432
433 return item;
434}
435
436static int __btrfs_add_delayed_item(struct btrfs_delayed_node *delayed_node, 397static int __btrfs_add_delayed_item(struct btrfs_delayed_node *delayed_node,
437 struct btrfs_delayed_item *ins, 398 struct btrfs_delayed_item *ins,
438 int action) 399 int action)
@@ -535,7 +496,7 @@ static void btrfs_release_delayed_item(struct btrfs_delayed_item *item)
535 } 496 }
536} 497}
537 498
538struct btrfs_delayed_item *__btrfs_first_delayed_insertion_item( 499static struct btrfs_delayed_item *__btrfs_first_delayed_insertion_item(
539 struct btrfs_delayed_node *delayed_node) 500 struct btrfs_delayed_node *delayed_node)
540{ 501{
541 struct rb_node *p; 502 struct rb_node *p;
@@ -548,7 +509,7 @@ struct btrfs_delayed_item *__btrfs_first_delayed_insertion_item(
548 return item; 509 return item;
549} 510}
550 511
551struct btrfs_delayed_item *__btrfs_first_delayed_deletion_item( 512static struct btrfs_delayed_item *__btrfs_first_delayed_deletion_item(
552 struct btrfs_delayed_node *delayed_node) 513 struct btrfs_delayed_node *delayed_node)
553{ 514{
554 struct rb_node *p; 515 struct rb_node *p;
@@ -561,7 +522,7 @@ struct btrfs_delayed_item *__btrfs_first_delayed_deletion_item(
561 return item; 522 return item;
562} 523}
563 524
564struct btrfs_delayed_item *__btrfs_next_delayed_item( 525static struct btrfs_delayed_item *__btrfs_next_delayed_item(
565 struct btrfs_delayed_item *item) 526 struct btrfs_delayed_item *item)
566{ 527{
567 struct rb_node *p; 528 struct rb_node *p;
@@ -766,10 +727,9 @@ static void btrfs_delayed_inode_release_metadata(struct btrfs_root *root,
766 * This helper will insert some continuous items into the same leaf according 727 * This helper will insert some continuous items into the same leaf according
767 * to the free space of the leaf. 728 * to the free space of the leaf.
768 */ 729 */
769static int btrfs_batch_insert_items(struct btrfs_trans_handle *trans, 730static int btrfs_batch_insert_items(struct btrfs_root *root,
770 struct btrfs_root *root, 731 struct btrfs_path *path,
771 struct btrfs_path *path, 732 struct btrfs_delayed_item *item)
772 struct btrfs_delayed_item *item)
773{ 733{
774 struct btrfs_delayed_item *curr, *next; 734 struct btrfs_delayed_item *curr, *next;
775 int free_space; 735 int free_space;
@@ -848,7 +808,7 @@ static int btrfs_batch_insert_items(struct btrfs_trans_handle *trans,
848 btrfs_clear_path_blocking(path, NULL, 0); 808 btrfs_clear_path_blocking(path, NULL, 0);
849 809
850 /* insert the keys of the items */ 810 /* insert the keys of the items */
851 setup_items_for_insert(trans, root, path, keys, data_size, 811 setup_items_for_insert(root, path, keys, data_size,
852 total_data_size, total_size, nitems); 812 total_data_size, total_size, nitems);
853 813
854 /* insert the dir index items */ 814 /* insert the dir index items */
@@ -932,7 +892,7 @@ do_again:
932 if (curr && btrfs_is_continuous_delayed_item(prev, curr)) { 892 if (curr && btrfs_is_continuous_delayed_item(prev, curr)) {
933 /* insert the continuous items into the same leaf */ 893 /* insert the continuous items into the same leaf */
934 path->slots[0]++; 894 path->slots[0]++;
935 btrfs_batch_insert_items(trans, root, path, curr); 895 btrfs_batch_insert_items(root, path, curr);
936 } 896 }
937 btrfs_release_delayed_item(prev); 897 btrfs_release_delayed_item(prev);
938 btrfs_mark_buffer_dirty(path->nodes[0]); 898 btrfs_mark_buffer_dirty(path->nodes[0]);