Skip to contentSkip to conversation

Btrfs: remove residual code in delayed inode async helper

PATCH In review Miao Xie 2 participants 11 messages Dec 26, 2013 – Jan 7, 2014 Btrfs file system

lore
Share & tools
lore

Miao Xie

author
#0 lore raw

PATCH v2 1/6 Btrfs: remove residual code in delayed inode async helper

Before applying the patch
commit de3cb945db4d8eb3b046dc7a5ea89a893372750c
title: Btrfs: improve the delayed inode throttling

We need requeue the async work after the current work was done, it introduced a deadlock problem. So we wrote the code that this patch removes to avoid the above problem. But after applying the above patch, the deadlock problem didn't exist. So we should remove that fix code.

---
Changelog v1 -> v2:
- None.

---
 fs/btrfs/delayed-inode.c | 27 ---------------------------
 1 file changed, 27 deletions(-)
fs/btrfs/delayed-inode.c +0 -27
index 8d292fb..e832621 100644
@@ -1300,33 +1300,6 @@ again:
 	trans->block_rsv = &root->fs_info->delayed_block_rsv;
 
 	__btrfs_commit_inode_delayed_items(trans, path, delayed_node);
-	/*
-	 * Maybe new delayed items have been inserted, so we need requeue
-	 * the work. Besides that, we must dequeue the empty delayed nodes
-	 * to avoid the race between delayed items balance and the worker.
-	 * The race like this:
-	 * 	Task1				Worker thread
-	 * 					count == 0, needn't requeue
-	 * 					  also needn't insert the
-	 * 					  delayed node into prepare
-	 * 					  list again.
-	 * 	add lots of delayed items
-	 * 	queue the delayed node
-	 * 	  already in the list,
-	 * 	  and not in the prepare
-	 * 	  list, it means the delayed
-	 * 	  node is being dealt with
-	 * 	  by the worker.
-	 * 	do delayed items balance
-	 * 	  the delayed node is being
-	 * 	  dealt with by the worker
-	 * 	  now, just wait.
-	 * 	  				the worker goto idle.
-	 * Task1 will sleep until the transaction is commited.
-	 */
-	mutex_lock(&delayed_node->mutex);
-	btrfs_dequeue_delayed_node(root->fs_info->delayed_root, delayed_node);
-	mutex_unlock(&delayed_node->mutex);
 
 	trans->block_rsv = block_rsv;
 	btrfs_end_transaction_dmeta(trans, root);
Signature · 1 line
1.8.3.1
author
#1 lore raw

PATCH v2 2/6 Btrfs: don't run delayed nodes again after all nodes flush

If the number of the delayed items is greater than the upper limit, we will try to flush all the delayed items. After that, it is unnecessary to run them again because they are being dealt with by the wokers or the number of them is less than the lower limit.

---
Changelog v1 -> v2:
- None.

---
 fs/btrfs/delayed-inode.c | 1 +
 1 file changed, 1 insertion(+)
fs/btrfs/delayed-inode.c +1 -0
index e832621..bb101b0 100644
@@ -1395,6 +1395,7 @@ void btrfs_balance_delayed_items(struct btrfs_root *root)
 				break;
 		}
 		finish_wait(&delayed_root->wait, &__wait);
+		return;
 	}
 
 	btrfs_wq_run_delayed_node(delayed_root, root, BTRFS_DELAYED_BATCH);
Signature · 1 line
1.8.3.1
author
#2 lore raw

PATCH v2 3/6 Btrfs: cleanup code of btrfs_balance_delayed_items()

In reply to Miao Xie

- move the condition check for wait into a function
- use wait_event_interruptible instead of prepare-schedule-finish process

---
Changelog v1 -> v2:
- None.

---
 fs/btrfs/delayed-inode.c | 34 +++++++++++-----------------------
 1 file changed, 11 insertions(+), 23 deletions(-)
fs/btrfs/delayed-inode.c +11 -23
index bb101b0..5229106 100644
@@ -1349,52 +1349,40 @@ void btrfs_assert_delayed_root_empty(struct btrfs_root *root)
 	WARN_ON(btrfs_first_delayed_node(delayed_root));
 }
 
-static int refs_newer(struct btrfs_delayed_root *delayed_root,
-		      int seq, int count)
+static int could_end_wait(struct btrfs_delayed_root *delayed_root, int seq)
 {
 	int val = atomic_read(&delayed_root->items_seq);
 
-	if (val < seq || val >= seq + count)
+	if (val < seq || val >= seq + BTRFS_DELAYED_BATCH)
 		return 1;
+
+	if (atomic_read(&delayed_root->items) < BTRFS_DELAYED_BACKGROUND)
+		return 1;
+
 	return 0;
 }
 
 void btrfs_balance_delayed_items(struct btrfs_root *root)
 {
 	struct btrfs_delayed_root *delayed_root;
-	int seq;
 
 	delayed_root = btrfs_get_delayed_root(root);
 
 	if (atomic_read(&delayed_root->items) < BTRFS_DELAYED_BACKGROUND)
 		return;
 
-	seq = atomic_read(&delayed_root->items_seq);
-
 	if (atomic_read(&delayed_root->items) >= BTRFS_DELAYED_WRITEBACK) {
+		int seq;
 		int ret;
-		DEFINE_WAIT(__wait);
+
+		seq = atomic_read(&delayed_root->items_seq);
 
 		ret = btrfs_wq_run_delayed_node(delayed_root, root, 0);
 		if (ret)
 			return;
 
-		while (1) {
-			prepare_to_wait(&delayed_root->wait, &__wait,
-					TASK_INTERRUPTIBLE);
-
-			if (refs_newer(delayed_root, seq,
-				       BTRFS_DELAYED_BATCH) ||
-			    atomic_read(&delayed_root->items) <
-			    BTRFS_DELAYED_BACKGROUND) {
-				break;
-			}
-			if (!signal_pending(current))
-				schedule();
-			else
-				break;
-		}
-		finish_wait(&delayed_root->wait, &__wait);
+		wait_event_interruptible(delayed_root->wait,
+					 could_end_wait(delayed_root, seq));
 		return;
 	}
 
Signature · 1 line
1.8.3.1
author
#3 lore raw

PATCH v2 4/6 Btrfs: remove btrfs_end_transaction_dmeta()

In reply to Miao Xie

Two reasons:
- btrfs_end_transaction_dmeta() is the same as btrfs_end_transaction_throttle() so it is unnecessary.
- All the delayed items should be dealt in the current transaction, so the workers should not commit the transaction, instead, deal with the delayed items as many as possible.

So we can remove btrfs_end_transaction_dmeta()

---
Changelog v1 -> v2:
- Add the detail changelog.

---
 fs/btrfs/delayed-inode.c | 2 +-
 fs/btrfs/transaction.c   | 6 ------
 fs/btrfs/transaction.h   | 2 --
 3 files changed, 1 insertion(+), 9 deletions(-)
fs/btrfs/delayed-inode.c +1 -1
index 5229106..7d55443 100644
@@ -1302,7 +1302,7 @@ again:
 	__btrfs_commit_inode_delayed_items(trans, path, delayed_node);
 
 	trans->block_rsv = block_rsv;
-	btrfs_end_transaction_dmeta(trans, root);
+	btrfs_end_transaction(trans, root);
 	btrfs_btree_balance_dirty_nodelay(root);
 
 release_path:
fs/btrfs/transaction.c +0 -6
index c6a872a..df919b4 100644
@@ -788,12 +788,6 @@ int btrfs_end_transaction_throttle(struct btrfs_trans_handle *trans,
 	return __btrfs_end_transaction(trans, root, 1);
 }
 
-int btrfs_end_transaction_dmeta(struct btrfs_trans_handle *trans,
-				struct btrfs_root *root)
-{
-	return __btrfs_end_transaction(trans, root, 1);
-}
-
 /*
  * when btree blocks are allocated, they have some corresponding bits set for
  * them in one of two extent_io trees.  This is used to make sure all of
fs/btrfs/transaction.h +0 -2
index 7657d11..d05b601 100644
@@ -154,8 +154,6 @@ int btrfs_commit_transaction_async(struct btrfs_trans_handle *trans,
 				   int wait_for_unblock);
 int btrfs_end_transaction_throttle(struct btrfs_trans_handle *trans,
 				   struct btrfs_root *root);
-int btrfs_end_transaction_dmeta(struct btrfs_trans_handle *trans,
-				struct btrfs_root *root);
 int btrfs_should_end_transaction(struct btrfs_trans_handle *trans,
 				 struct btrfs_root *root);
 void btrfs_throttle(struct btrfs_root *root);
Signature · 1 line
1.8.3.1
author
#4 lore raw

PATCH v2 5/6 Btrfs: use flags instead of the bool variants in delayed node

In reply to Miao Xie

---
Changelog v1 -> v2:
- None.

---
 fs/btrfs/delayed-inode.c | 33 +++++++++++++++++----------------
 fs/btrfs/delayed-inode.h |  6 ++++--
 2 files changed, 21 insertions(+), 18 deletions(-)
fs/btrfs/delayed-inode.c +17 -16
index 7d55443..979db56 100644
@@ -55,8 +55,7 @@ static inline void btrfs_init_delayed_node(
 	delayed_node->inode_id = inode_id;
 	atomic_set(&delayed_node->refs, 0);
 	delayed_node->count = 0;
-	delayed_node->in_list = 0;
-	delayed_node->inode_dirty = 0;
+	delayed_node->flags = 0;
 	delayed_node->ins_root = RB_ROOT;
 	delayed_node->del_root = RB_ROOT;
 	mutex_init(&delayed_node->mutex);
@@ -172,7 +171,7 @@ static void btrfs_queue_delayed_node(struct btrfs_delayed_root *root,
 				     int mod)
 {
 	spin_lock(&root->lock);
-	if (node->in_list) {
+	if (test_bit(BTRFS_DELAYED_NODE_IN_LIST, &node->flags)) {
 		if (!list_empty(&node->p_list))
 			list_move_tail(&node->p_list, &root->prepare_list);
 		else if (mod)
@@ -182,7 +181,7 @@ static void btrfs_queue_delayed_node(struct btrfs_delayed_root *root,
 		list_add_tail(&node->p_list, &root->prepare_list);
 		atomic_inc(&node->refs);	/* inserted into list */
 		root->nodes++;
-		node->in_list = 1;
+		set_bit(BTRFS_DELAYED_NODE_IN_LIST, &node->flags);
 	}
 	spin_unlock(&root->lock);
 }
@@ -192,13 +191,13 @@ static void btrfs_dequeue_delayed_node(struct btrfs_delayed_root *root,
 				       struct btrfs_delayed_node *node)
 {
 	spin_lock(&root->lock);
-	if (node->in_list) {
+	if (test_bit(BTRFS_DELAYED_NODE_IN_LIST, &node->flags)) {
 		root->nodes--;
 		atomic_dec(&node->refs);	/* not in the list */
 		list_del_init(&node->n_list);
 		if (!list_empty(&node->p_list))
 			list_del_init(&node->p_list);
-		node->in_list = 0;
+		clear_bit(BTRFS_DELAYED_NODE_IN_LIST, &node->flags);
 	}
 	spin_unlock(&root->lock);
 }
@@ -231,7 +230,8 @@ static struct btrfs_delayed_node *btrfs_next_delayed_node(
 
 	delayed_root = node->root->fs_info->delayed_root;
 	spin_lock(&delayed_root->lock);
-	if (!node->in_list) {	/* not in the list */
+	if (!test_bit(BTRFS_DELAYED_NODE_IN_LIST, &node->flags)) {
+		/* not in the list */
 		if (list_empty(&delayed_root->node_list))
 			goto out;
 		p = delayed_root->node_list.next;
@@ -1004,9 +1004,10 @@ static void btrfs_release_delayed_inode(struct btrfs_delayed_node *delayed_node)
 {
 	struct btrfs_delayed_root *delayed_root;
 
-	if (delayed_node && delayed_node->inode_dirty) {
+	if (delayed_node &&
+	    test_bit(BTRFS_DELAYED_NODE_INODE_DIRTY, &delayed_node->flags)) {
 		BUG_ON(!delayed_node->root);
-		delayed_node->inode_dirty = 0;
+		clear_bit(BTRFS_DELAYED_NODE_INODE_DIRTY, &delayed_node->flags);
 		delayed_node->count--;
 
 		delayed_root = delayed_node->root->fs_info->delayed_root;
@@ -1059,7 +1060,7 @@ static inline int btrfs_update_delayed_inode(struct btrfs_trans_handle *trans,
 	int ret;
 
 	mutex_lock(&node->mutex);
-	if (!node->inode_dirty) {
+	if (!test_bit(BTRFS_DELAYED_NODE_INODE_DIRTY, &node->flags)) {
 		mutex_unlock(&node->mutex);
 		return 0;
 	}
@@ -1203,7 +1204,7 @@ int btrfs_commit_inode_delayed_inode(struct inode *inode)
 		return 0;
 
 	mutex_lock(&delayed_node->mutex);
-	if (!delayed_node->inode_dirty) {
+	if (!test_bit(BTRFS_DELAYED_NODE_INODE_DIRTY, &delayed_node->flags)) {
 		mutex_unlock(&delayed_node->mutex);
 		btrfs_release_delayed_node(delayed_node);
 		return 0;
@@ -1227,7 +1228,7 @@ int btrfs_commit_inode_delayed_inode(struct inode *inode)
 	trans->block_rsv = &delayed_node->root->fs_info->delayed_block_rsv;
 
 	mutex_lock(&delayed_node->mutex);
-	if (delayed_node->inode_dirty)
+	if (test_bit(BTRFS_DELAYED_NODE_INODE_DIRTY, &delayed_node->flags))
 		ret = __btrfs_update_delayed_inode(trans, delayed_node->root,
 						   path, delayed_node);
 	else
@@ -1721,7 +1722,7 @@ int btrfs_fill_inode(struct inode *inode, u32 *rdev)
 		return -ENOENT;
 
 	mutex_lock(&delayed_node->mutex);
-	if (!delayed_node->inode_dirty) {
+	if (!test_bit(BTRFS_DELAYED_NODE_INODE_DIRTY, &delayed_node->flags)) {
 		mutex_unlock(&delayed_node->mutex);
 		btrfs_release_delayed_node(delayed_node);
 		return -ENOENT;
@@ -1772,7 +1773,7 @@ int btrfs_delayed_update_inode(struct btrfs_trans_handle *trans,
 		return PTR_ERR(delayed_node);
 
 	mutex_lock(&delayed_node->mutex);
-	if (delayed_node->inode_dirty) {
+	if (test_bit(BTRFS_DELAYED_NODE_INODE_DIRTY, &delayed_node->flags)) {
 		fill_stack_inode_item(trans, &delayed_node->inode_item, inode);
 		goto release_node;
 	}
@@ -1783,7 +1784,7 @@ int btrfs_delayed_update_inode(struct btrfs_trans_handle *trans,
 		goto release_node;
 
 	fill_stack_inode_item(trans, &delayed_node->inode_item, inode);
-	delayed_node->inode_dirty = 1;
+	set_bit(BTRFS_DELAYED_NODE_INODE_DIRTY, &delayed_node->flags);
 	delayed_node->count++;
 	atomic_inc(&root->fs_info->delayed_root->items);
 release_node:
@@ -1814,7 +1815,7 @@ static void __btrfs_kill_delayed_node(struct btrfs_delayed_node *delayed_node)
 		btrfs_release_delayed_item(prev_item);
 	}
 
-	if (delayed_node->inode_dirty) {
+	if (test_bit(BTRFS_DELAYED_NODE_INODE_DIRTY, &delayed_node->flags)) {
 		btrfs_delayed_inode_release_metadata(root, delayed_node);
 		btrfs_release_delayed_inode(delayed_node);
 	}
fs/btrfs/delayed-inode.h +4 -2
index a4b38f9..a6a13f7 100644
@@ -48,6 +48,9 @@ struct btrfs_delayed_root {
 	wait_queue_head_t wait;
 };
 
+#define BTRFS_DELAYED_NODE_IN_LIST	0
+#define BTRFS_DELAYED_NODE_INODE_DIRTY	1
+
 struct btrfs_delayed_node {
 	u64 inode_id;
 	u64 bytes_reserved;
@@ -65,8 +68,7 @@ struct btrfs_delayed_node {
 	struct btrfs_inode_item inode_item;
 	atomic_t refs;
 	u64 index_cnt;
-	bool in_list;
-	bool inode_dirty;
+	unsigned long flags;
 	int count;
 };
 
Signature · 1 line
1.8.3.1
#5 lore raw

Re: [PATCH v2 5/6] Btrfs: use flags instead of the bool variants in delayed node

Quoted 7 lines · Miao Xie
fs/btrfs/delayed-inode.h +3 -0
+#define BTRFS_DELAYED_NODE_IN_LIST	0
+#define BTRFS_DELAYED_NODE_INODE_DIRTY	1
+
 struct btrfs_delayed_node {
 	u64 inode_id;
 	u64 bytes_reserved;

fs/btrfs/delayed-inode.h struct btrfs_delayed_node { · line 73

Quoted 8 lines
fs/btrfs/delayed-inode.h +1 -2
@@ -65,8 +68,7 @@ struct btrfs_delayed_node {
 	struct btrfs_inode_item inode_item;
 	atomic_t refs;
 	u64 index_cnt;
-	bool in_list;
-	bool inode_dirty;
+	unsigned long flags;
 	int count;
 };

What's the reason to do that? Replacing 2 bools with a bitfield does not seem justified, not from saving memory, nor from a performance gain side. Also some of the bit operations imply the lock instruction prefix so this affects the surrounding items as well.

I don't think this is needed, unless you have further plans with the flags item.

david

author
#6 lore raw

Re: [PATCH v2 5/6] Btrfs: use flags instead of the bool variants in delayed node

Quoted 22 lines · David Sterba
Quoted 7 lines · Miao Xie
fs/btrfs/delayed-inode.h +3 -0
+#define BTRFS_DELAYED_NODE_IN_LIST	0
+#define BTRFS_DELAYED_NODE_INODE_DIRTY	1
+
 struct btrfs_delayed_node {
 	u64 inode_id;
 	u64 bytes_reserved;

fs/btrfs/delayed-inode.h struct btrfs_delayed_node { · line 73

Quoted 8 lines
fs/btrfs/delayed-inode.h +1 -2
@@ -65,8 +68,7 @@ struct btrfs_delayed_node {
 	struct btrfs_inode_item inode_item;
 	atomic_t refs;
 	u64 index_cnt;
-	bool in_list;
-	bool inode_dirty;
+	unsigned long flags;
 	int count;
 };

What's the reason to do that? Replacing 2 bools with a bitfield does not seem justified, not from saving memory, nor from a performance gain side. Also some of the bit operations imply the lock instruction prefix so this affects the surrounding items as well.

Quoted 2 lines

I don't think this is needed, unless you have further plans with the flags item.

Yes, I introduced a flag in the next patch.

And we can not common bit operation here because we hold different locks when we change those bits, we have to use the bit operations which implies the lock instruction.

Thanks
Miao

#7 lore raw

Re: [PATCH v2 5/6] Btrfs: use flags instead of the bool variants in delayed node

Quoted 23 lines · Miao Xie
Quoted 22 lines · David Sterba
Quoted 7 lines · Miao Xie
fs/btrfs/delayed-inode.h +3 -0
+#define BTRFS_DELAYED_NODE_IN_LIST	0
+#define BTRFS_DELAYED_NODE_INODE_DIRTY	1
+
 struct btrfs_delayed_node {
 	u64 inode_id;
 	u64 bytes_reserved;

fs/btrfs/delayed-inode.h struct btrfs_delayed_node { · line 73

Quoted 8 lines
fs/btrfs/delayed-inode.h +1 -2
@@ -65,8 +68,7 @@ struct btrfs_delayed_node {
 	struct btrfs_inode_item inode_item;
 	atomic_t refs;
 	u64 index_cnt;
-	bool in_list;
-	bool inode_dirty;
+	unsigned long flags;
 	int count;
 };

What's the reason to do that? Replacing 2 bools with a bitfield does not seem justified, not from saving memory, nor from a performance gain side. Also some of the bit operations imply the lock instruction prefix so this affects the surrounding items as well.

Quoted 4 lines
Quoted 2 lines

I don't think this is needed, unless you have further plans with the flags item.

Yes, I introduced a flag in the next patch.

That's still 3 bool flags that are quite independent and consume less than the unsigned long anyway. Also the bool flags are something that compiler understands and can use during optimizations unlike the obfuscated bit access.

I don't mind using bitfields, but it imo starts to make sense to use them when there are more than a few, like BTRFS_INODE_* or EXTENT_BUFFER_*. The point of my objections is to establish good coding patterns to follow.

david

author
#8 lore raw

Re: [PATCH v2 5/6] Btrfs: use flags instead of the bool variants in delayed node

Quoted 27 lines · David Sterba
Quoted 26 lines · Miao Xie
Quoted 24 lines · David Sterba
Quoted 7 lines · Miao Xie
fs/btrfs/delayed-inode.h +3 -0
+#define BTRFS_DELAYED_NODE_IN_LIST	0
+#define BTRFS_DELAYED_NODE_INODE_DIRTY	1
+
 struct btrfs_delayed_node {
 	u64 inode_id;
 	u64 bytes_reserved;

fs/btrfs/delayed-inode.h struct btrfs_delayed_node { · line 73

Quoted 8 lines
fs/btrfs/delayed-inode.h +1 -2
@@ -65,8 +68,7 @@ struct btrfs_delayed_node {
 	struct btrfs_inode_item inode_item;
 	atomic_t refs;
 	u64 index_cnt;
-	bool in_list;
-	bool inode_dirty;
+	unsigned long flags;
 	int count;
 };

What's the reason to do that? Replacing 2 bools with a bitfield does not seem justified, not from saving memory, nor from a performance gain side. Also some of the bit operations imply the lock instruction prefix so this affects the surrounding items as well.

I don't think this is needed, unless you have further plans with the flags item.

Quoted 6 lines
Quoted 1 line

Yes, I introduced a flag in the next patch.

That's still 3 bool flags that are quite independent and consume less than the unsigned long anyway. Also the bool flags are something that compiler understands and can use during optimizations unlike the obfuscated bit access.

I made a mistake at the beginning, I though the size of boolean data type in the kernel was 4 bytes because I saw it was implemented by the enumeration type several years ago. But it has been changed for many years. So you are right.

But I read a discuss about the use of boolean type, some developers suggested us to use bitfields instead of bool, because the bitfields can work better, and they are more flexible, less misuse than bool.
https://lkml.org/lkml/2013/9/1/154

Furthermore, we may introduce more flags in the future though I have no plan now. So this patch makes sense I think.

Thanks
Miao

Quoted 7 lines

I don't mind using bitfields, but it imo starts to make sense to use them when there are more than a few, like BTRFS_INODE_* or EXTENT_BUFFER_*. The point of my objections is to establish good coding patterns to follow.

david

#9 lore raw

Re: [PATCH v2 5/6] Btrfs: use flags instead of the bool variants in delayed node

Quoted 4 lines · Miao Xie

But I read a discuss about the use of boolean type, some developers suggested us to use bitfields instead of bool, because the bitfields can work better, and they are more flexible, less misuse than bool.
https://lkml.org/lkml/2013/9/1/154

I was searching for pros/cons of the bools but haven't found this one nor anything useful, though not all of the advantages of bitfields apply in our case.

I've compared the generated assembly with just this patch, and the difference is effectively only the lock prefix for set/clear, the read side has no significant penalty:

old:
mov 0x128(%rbx),%esi

new:
mov 0x120(%rbx),%rax
test $0x1,%al

old set:
movb $0x1,0x120(%rbx)

new:
lock orb $0x1,0x120(%rbx)

The delayed_node structure is relatively short lived, is reused frequently and I haven't seen any contention points where the lock prefix would hurt.

So, ok to merge it.

author
#10 lore raw

PATCH v2 6/6 Btrfs: introduce the delayed inode ref deletion for the single link inode

In reply to Miao Xie

The inode reference item is close to inode item, so we insert it simultaneously with the inode item insertion when we create a file/directory.. In fact, we also can handle the inode reference deletion by the same way. So we made this patch to introduce the delayed inode reference deletion for the single link inode(At most case, the file doesn't has hard link, so we don't take the hard link into account).

This function is based on the delayed inode mechanism. After applying this patch, we can reduce the time of the file/directory deletion by ~10%.

---
Changelog v1 -> v2:
- Use ASSERT instead of BUG_ON(), pointed by Josef.

---
 fs/btrfs/btrfs_inode.h   |   3 ++
 fs/btrfs/delayed-inode.c | 103 +++++++++++++++++++++++++++++++++++++++++++++--
 fs/btrfs/delayed-inode.h |   2 +
 fs/btrfs/inode.c         |  55 ++++++++++++++++++++++++-
 4 files changed, 157 insertions(+), 6 deletions(-)
fs/btrfs/btrfs_inode.h +3 -0
index ac0b39d..661b0ac 100644
@@ -135,6 +135,9 @@ struct btrfs_inode {
 	 */
 	u64 index_cnt;
 
+	/* Cache the directory index number to speed the dir/file remove */
+	u64 dir_index;
+
 	/* the fsync log has some corner cases that mean we have to check
 	 * directories to see if any unlinks have been done before
 	 * the directory was logged.  See tree-log.c for all the
fs/btrfs/delayed-inode.c +99 -4

149 lines not on this page · raw message

fs/btrfs/delayed-inode.h +2 -0
index a6a13f7..f70119f 100644
@@ -50,6 +50,7 @@ struct btrfs_delayed_root {
 
 #define BTRFS_DELAYED_NODE_IN_LIST	0
 #define BTRFS_DELAYED_NODE_INODE_DIRTY	1
+#define BTRFS_DELAYED_NODE_DEL_IREF	2
 
 struct btrfs_delayed_node {
 	u64 inode_id;
@@ -127,6 +128,7 @@ int btrfs_commit_inode_delayed_inode(struct inode *inode);
 int btrfs_delayed_update_inode(struct btrfs_trans_handle *trans,
 			       struct btrfs_root *root, struct inode *inode);
 int btrfs_fill_inode(struct inode *inode, u32 *rdev);
+int btrfs_delayed_delete_inode_ref(struct inode *inode);
 
 /* Used for drop dead root */
 void btrfs_kill_all_delayed_nodes(struct btrfs_root *root);
fs/btrfs/inode.c +53 -2

115 lines not on this page · raw message

Signature · 1 line
1.8.3.1