From: Al Viro Date: Thu, 28 Feb 2013 03:37:21 +0000 (-0500) Subject: 9p: don't bother with private lock in ->d_fsdata; dentry->d_lock will do just fine X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=634095dab2a2001844fc8b26673c0cb14a766cdf;p=linux-beck.git 9p: don't bother with private lock in ->d_fsdata; dentry->d_lock will do just fine Signed-off-by: Al Viro --- diff --git a/fs/9p/fid.c b/fs/9p/fid.c index afd4724b2d92..71bc36a03e72 100644 --- a/fs/9p/fid.c +++ b/fs/9p/fid.c @@ -54,14 +54,13 @@ int v9fs_fid_add(struct dentry *dentry, struct p9_fid *fid) if (!dent) return -ENOMEM; - spin_lock_init(&dent->lock); INIT_LIST_HEAD(&dent->fidlist); dentry->d_fsdata = dent; } - spin_lock(&dent->lock); + spin_lock(&dentry->d_lock); list_add(&fid->dlist, &dent->fidlist); - spin_unlock(&dent->lock); + spin_unlock(&dentry->d_lock); return 0; } @@ -85,14 +84,14 @@ static struct p9_fid *v9fs_fid_find(struct dentry *dentry, kuid_t uid, int any) dent = (struct v9fs_dentry *) dentry->d_fsdata; ret = NULL; if (dent) { - spin_lock(&dent->lock); + spin_lock(&dentry->d_lock); list_for_each_entry(fid, &dent->fidlist, dlist) { if (any || uid_eq(fid->uid, uid)) { ret = fid; break; } } - spin_unlock(&dent->lock); + spin_unlock(&dentry->d_lock); } return ret; diff --git a/fs/9p/fid.h b/fs/9p/fid.h index bb0b6e7f58fc..469b5d517694 100644 --- a/fs/9p/fid.h +++ b/fs/9p/fid.h @@ -25,7 +25,6 @@ /** * struct v9fs_dentry - 9p private data stored in dentry d_fsdata - * @lock: protects the fidlist * @fidlist: list of FIDs currently associated with this dentry * * This structure defines the 9p private data associated with @@ -35,11 +34,12 @@ * inodes in order to more closely map functionality to the Plan 9 * expected behavior for FID reclaimation and tracking. * + * Protected by ->d_lock of dentry it belongs to. + * * See Also: Mapping FIDs to Linux VFS model in * Design and Implementation of the Linux 9P File System documentation */ struct v9fs_dentry { - spinlock_t lock; /* protect fidlist */ struct list_head fidlist; };