Re: [PATCH 17/18] fs: icache remove inode_lock

Christoph Hellwig
2010-10-08T08:03:30Z

On Fri, Oct 08, 2010 at 04:21:31PM +1100, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> All the functionality that the inode_lock protected has now been
> wrapped up in new independent locks and/or functionality. Hence the
> inode_lock does not serve a purpose any longer and hence can now be
> removed.

Might be worth mentioning this also updates the locking / lock order
documenation all over the place.

> --- a/Documentation/filesystems/Locking
> +++ b/Documentation/filesystems/Locking
> @@ -114,7 +114,7 @@ alloc_inode:
> destroy_inode:
> dirty_inode: (must not sleep)
> write_inode:
> -drop_inode: !!!inode_lock!!!
> +drop_inode: !!!i_lock, sb_inode_list_lock!!!

sb_inode_list_lock now is sb->s_inodes_lock, this also applies in a few
other places.

> +[mandatory]
> + inode_lock is gone, replaced by fine grained locks. See fs/inode.c
> +for details of what locks to replace inode_lock with in order to protect
> +particular things. Most of the time, a filesystem only needs ->i_lock, which
> +protects *all* the inode state and its membership on lists that was
> +previously protected with inode_lock.

Which list membership does i_lock protect?

> --- a/fs/notify/inode_mark.c
> +++ b/fs/notify/inode_mark.c
> @@ -22,7 +22,7 @@
> #include <linux/module.h>
> #include <linux/mutex.h>
> #include <linux/spinlock.h>
> -#include <linux/writeback.h> /* for inode_lock */
> +#include <linux/writeback.h>

Do we still need writeback.h here?

> @@ -76,7 +76,7 @@
> #include <linux/buffer_head.h>
> #include <linux/capability.h>
> #include <linux/quotaops.h>
> -#include <linux/writeback.h> /* for inode_lock, oddly enough.. */
> +#include <linux/writeback.h>

Same here.

Otherwise looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>