From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: chris.mason@oracle.com
Cc: linux-btrfs@vger.kernel.org,
"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Subject: [PATCH 3/3] btrfs: Update the directory link count correctly
Date: Sun, 24 Jan 2010 02:08:09 +0530 [thread overview]
Message-ID: <1264279089-14913-3-git-send-email-aneesh.kumar@linux.vnet.ibm.com> (raw)
In-Reply-To: <1264279089-14913-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com>
This patch make sure we update the directory link count properly
during delete
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
fs/btrfs/inode.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 9a56b3b..12b9d6e 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -2703,8 +2703,17 @@ static int btrfs_rmdir(struct inode *dir, struct dentry *dentry)
dentry->d_name.name, dentry->d_name.len);
if (!err) {
btrfs_i_size_write(inode, 0);
- btrfs_drop_nlink(inode);
+ /*
+ * Directories have link count 2.
+ */
+ btrfs_clear_nlink(dentry->d_inode);
btrfs_update_inode(trans, root, inode);
+ /*
+ * If we are removing a directory drop the link count from
+ * the parent directory
+ */
+ btrfs_drop_nlink(dir);
+ btrfs_update_inode(trans, root, dir);
}
out:
nr = trans->blocks_used;
--
1.6.6.1.394.gdedc0
prev parent reply other threads:[~2010-01-23 20:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-23 20:38 [PATCH 1/3] btrfs: Drop the link count update from btrfs_unlink_inode Aneesh Kumar K.V
2010-01-23 20:38 ` [PATCH 2/3] btrfs: Update directory link count correctly while creation Aneesh Kumar K.V
2010-01-24 0:30 ` Chris Mason
2010-01-23 20:38 ` Aneesh Kumar K.V [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1264279089-14913-3-git-send-email-aneesh.kumar@linux.vnet.ibm.com \
--to=aneesh.kumar@linux.vnet.ibm.com \
--cc=chris.mason@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox