mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
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 <[email protected]> Acked-by: Christoph Hellwig <[email protected]>
This commit is contained in:
parent
dd459bb197
commit
4a075e39c8
3 changed files with 57 additions and 1 deletions
|
|
@ -194,7 +194,7 @@ int inode_init_always(struct super_block *sb, struct inode *inode)
|
|||
#ifdef CONFIG_FSNOTIFY
|
||||
inode->i_fsnotify_mask = 0;
|
||||
#endif
|
||||
|
||||
inode->i_flctx = NULL;
|
||||
this_cpu_inc(nr_inodes);
|
||||
|
||||
return 0;
|
||||
|
|
@ -237,6 +237,7 @@ void __destroy_inode(struct inode *inode)
|
|||
BUG_ON(inode_has_buffers(inode));
|
||||
security_inode_free(inode);
|
||||
fsnotify_inode_delete(inode);
|
||||
locks_free_lock_context(inode->i_flctx);
|
||||
if (!inode->i_nlink) {
|
||||
WARN_ON(atomic_long_read(&inode->i_sb->s_remove_count) == 0);
|
||||
atomic_long_dec(&inode->i_sb->s_remove_count);
|
||||
|
|
|
|||
Loading…
Reference in a new issue