diff options
author | Christoph Hellwig <hch@lst.de> | 2007-02-20 16:58:11 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-20 20:10:15 -0500 |
commit | 2be3c79046cf90d75d436708a4e0898c7a1f9d51 (patch) | |
tree | 2a5727bb2a4132af009afc24e54661dd32d3efe2 /fs/affs/inode.c | |
parent | c9ffec48487849bc277de662a6c29aad64653b99 (diff) |
[PATCH] affs: implement ->drop_inode
affs wants to truncate the inode when the last user goes away, currently it
does that through a potentially racy i_count check in ->put_inode. But we
already have a method that's called just after the we dropped the last
reference, ->drop_inode. This patch implements affs_drop_inode to take
advantage of this.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/affs/inode.c')
-rw-r--r-- | fs/affs/inode.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/fs/affs/inode.c b/fs/affs/inode.c index fce6848a4641..c5b9d73c084a 100644 --- a/fs/affs/inode.c +++ b/fs/affs/inode.c | |||
@@ -243,12 +243,17 @@ affs_put_inode(struct inode *inode) | |||
243 | { | 243 | { |
244 | pr_debug("AFFS: put_inode(ino=%lu, nlink=%u)\n", inode->i_ino, inode->i_nlink); | 244 | pr_debug("AFFS: put_inode(ino=%lu, nlink=%u)\n", inode->i_ino, inode->i_nlink); |
245 | affs_free_prealloc(inode); | 245 | affs_free_prealloc(inode); |
246 | if (atomic_read(&inode->i_count) == 1) { | 246 | } |
247 | mutex_lock(&inode->i_mutex); | 247 | |
248 | if (inode->i_size != AFFS_I(inode)->mmu_private) | 248 | void |
249 | affs_truncate(inode); | 249 | affs_drop_inode(struct inode *inode) |
250 | mutex_unlock(&inode->i_mutex); | 250 | { |
251 | } | 251 | mutex_lock(&inode->i_mutex); |
252 | if (inode->i_size != AFFS_I(inode)->mmu_private) | ||
253 | affs_truncate(inode); | ||
254 | mutex_unlock(&inode->i_mutex); | ||
255 | |||
256 | generic_drop_inode(inode); | ||
252 | } | 257 | } |
253 | 258 | ||
254 | void | 259 | void |