diff options
author | Jeff Layton <jlayton@primarydata.com> | 2015-01-16 15:05:54 -0500 |
---|---|---|
committer | Jeff Layton <jlayton@primarydata.com> | 2015-01-16 15:05:54 -0500 |
commit | 4a075e39c86490cc0f0c10ac6abe3592d1689463 (patch) | |
tree | 8da8633f9f717128c02a08ad15b7d9f067091acb /fs/inode.c | |
parent | dd459bb1974c5e9cff3dfbf4f6fdb3e9363ef32e (diff) |
locks: add a new struct file_locking_context pointer to struct inode
The current scheme of using the i_flock list is really difficult to
manage. There is also a legitimate desire for a per-inode spinlock to
manage these lists that isn't the i_lock.
Start conversion to a new scheme to eventually replace the old i_flock
list with a new "file_lock_context" object.
We start by adding a new i_flctx to struct inode. For now, it lives in
parallel with i_flock list, but will eventually replace it. The idea is
to allocate a structure to sit in that pointer and act as a locus for
all things file locking.
We allocate a file_lock_context for an inode when the first lock is
added to it, and it's only freed when the inode is freed. We use the
i_lock to protect the assignment, but afterward it should mostly be
accessed locklessly.
Signed-off-by: Jeff Layton <jlayton@primarydata.com>
Acked-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/inode.c')
-rw-r--r-- | fs/inode.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/inode.c b/fs/inode.c index aa149e7262ac..f30872ade6d7 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -194,7 +194,7 @@ int inode_init_always(struct super_block *sb, struct inode *inode) | |||
194 | #ifdef CONFIG_FSNOTIFY | 194 | #ifdef CONFIG_FSNOTIFY |
195 | inode->i_fsnotify_mask = 0; | 195 | inode->i_fsnotify_mask = 0; |
196 | #endif | 196 | #endif |
197 | 197 | inode->i_flctx = NULL; | |
198 | this_cpu_inc(nr_inodes); | 198 | this_cpu_inc(nr_inodes); |
199 | 199 | ||
200 | return 0; | 200 | return 0; |
@@ -237,6 +237,7 @@ void __destroy_inode(struct inode *inode) | |||
237 | BUG_ON(inode_has_buffers(inode)); | 237 | BUG_ON(inode_has_buffers(inode)); |
238 | security_inode_free(inode); | 238 | security_inode_free(inode); |
239 | fsnotify_inode_delete(inode); | 239 | fsnotify_inode_delete(inode); |
240 | locks_free_lock_context(inode->i_flctx); | ||
240 | if (!inode->i_nlink) { | 241 | if (!inode->i_nlink) { |
241 | WARN_ON(atomic_long_read(&inode->i_sb->s_remove_count) == 0); | 242 | WARN_ON(atomic_long_read(&inode->i_sb->s_remove_count) == 0); |
242 | atomic_long_dec(&inode->i_sb->s_remove_count); | 243 | atomic_long_dec(&inode->i_sb->s_remove_count); |