From: Christoph Hellwig <hch@lst.de>
To: zippel@linux-m68k.org
Cc: linux-fsdevel@vger.kernel.org
Subject: [PATCH][RFC] fix reservation discarding in affs
Date: Sun, 12 Dec 2004 14:45:46 +0100 [thread overview]
Message-ID: <20041212134545.GA6612@lst.de> (raw)
Currently affs discards preallocations in every ->put_inode but we
really want to do this in
a) ->release when a filedescriptor is closed and
b) in ->clear_inode to avoid leaking reservations for shared writeable
mappings
affs already does it in a) and a few other places, so adding it to
affs_clear_inode should make it behave fine. Also move the truncate
from affs_put_inode with the racy i_count check to affs_clear_inode.
This also avoids the need to take the inode semaphore as the inode can't
be accessed from other threads anymore.
--- 1.21/fs/affs/inode.c 2004-09-17 08:58:42 +02:00
+++ edited/fs/affs/inode.c 2004-12-10 20:21:40 +01:00
@@ -258,19 +258,6 @@
}
void
-affs_put_inode(struct inode *inode)
-{
- pr_debug("AFFS: put_inode(ino=%lu, nlink=%u)\n", inode->i_ino, inode->i_nlink);
- affs_free_prealloc(inode);
- if (atomic_read(&inode->i_count) == 1) {
- down(&inode->i_sem);
- if (inode->i_size != AFFS_I(inode)->mmu_private)
- affs_truncate(inode);
- up(&inode->i_sem);
- }
-}
-
-void
affs_delete_inode(struct inode *inode)
{
pr_debug("AFFS: delete_inode(ino=%lu, nlink=%u)\n", inode->i_ino, inode->i_nlink);
@@ -287,6 +274,12 @@
unsigned long cache_page = (unsigned long) AFFS_I(inode)->i_lc;
pr_debug("AFFS: clear_inode(ino=%lu, nlink=%u)\n", inode->i_ino, inode->i_nlink);
+
+ affs_free_prealloc(inode);
+
+ if (inode->i_size != AFFS_I(inode)->mmu_private)
+ affs_truncate(inode);
+
if (cache_page) {
pr_debug("AFFS: freeing ext cache\n");
AFFS_I(inode)->i_lc = NULL;
===== fs/affs/super.c 1.46 vs edited =====
--- 1.46/fs/affs/super.c 2004-09-04 05:11:01 +02:00
+++ edited/fs/affs/super.c 2004-12-10 20:19:18 +01:00
@@ -133,7 +133,6 @@
.destroy_inode = affs_destroy_inode,
.read_inode = affs_read_inode,
.write_inode = affs_write_inode,
- .put_inode = affs_put_inode,
.delete_inode = affs_delete_inode,
.clear_inode = affs_clear_inode,
.put_super = affs_put_super,
--- 1.9/include/linux/affs_fs.h 2004-09-17 08:58:43 +02:00
+++ edited/include/linux/affs_fs.h 2004-12-10 20:19:12 +01:00
@@ -58,7 +58,6 @@
extern unsigned long affs_parent_ino(struct inode *dir);
extern struct inode *affs_new_inode(struct inode *dir);
extern int affs_notify_change(struct dentry *dentry, struct iattr *attr);
-extern void affs_put_inode(struct inode *inode);
extern void affs_delete_inode(struct inode *inode);
extern void affs_clear_inode(struct inode *inode);
extern void affs_read_inode(struct inode *inode);
next reply other threads:[~2004-12-12 13:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-12 13:45 Christoph Hellwig [this message]
2005-02-10 10:39 ` [PATCH][RFC] fix reservation discarding in affs Christoph Hellwig
2005-02-10 12:57 ` Roman Zippel
2008-01-10 15:12 ` Christoph Hellwig
2008-01-14 3:53 ` Roman Zippel
2008-02-07 5:41 ` Christoph Hellwig
2008-02-10 23:47 ` Roman Zippel
2008-04-29 15:02 ` Christoph Hellwig
2008-04-29 15:46 ` [PATCH] kill ->put_inode Christoph Hellwig
2008-05-01 10:04 ` [PATCH][RFC] fix reservation discarding in affs Andrew Morton
2008-05-01 16:05 ` Roman Zippel
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=20041212134545.GA6612@lst.de \
--to=hch@lst.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=zippel@linux-m68k.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.