* [PATCH 0/3] fs: use helper function path_foo() to simpily code
@ 2013-10-14 12:25 Kefeng Wang
2013-10-14 12:26 ` [PATCH 1/3] fs: use path_equal() and path_put() to simplify code Kefeng Wang
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Kefeng Wang @ 2013-10-14 12:25 UTC (permalink / raw)
To: Alexander Viro
Cc: John McCutchan, J. Bruce Fields, Eric Paris, Robert Love,
linux-kernel, linux-fsdevel, linux-nfs
Use helper function patch_equal() and path_put() to simpily code.
Kefeng Wang (3):
fs: use path_equal() and path_put() to simplify code
fs: nfsd: use path_equal() to simply code
fs: notify: use path_equal() to simply code
fs/namei.c | 20 ++++++--------------
fs/nfsd/export.c | 3 +--
fs/nfsd/nfs4xdr.c | 2 +-
fs/notify/fanotify/fanotify.c | 3 +--
fs/notify/inotify/inotify_fsnotify.c | 3 +--
5 files changed, 10 insertions(+), 21 deletions(-)
--
1.8.2.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] fs: use path_equal() and path_put() to simplify code
2013-10-14 12:25 [PATCH 0/3] fs: use helper function path_foo() to simpily code Kefeng Wang
@ 2013-10-14 12:26 ` Kefeng Wang
2013-10-14 12:26 ` [PATCH 2/3] fs: nfsd: use path_equal() to simply code Kefeng Wang
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Kefeng Wang @ 2013-10-14 12:26 UTC (permalink / raw)
To: Alexander Viro
Cc: John McCutchan, J. Bruce Fields, Eric Paris, Robert Love,
linux-kernel, linux-fsdevel, linux-nfs
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
fs/namei.c | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
diff --git a/fs/namei.c b/fs/namei.c
index 645268f..1a6c139 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -918,9 +918,8 @@ int follow_up(struct path *path)
mntget(&parent->mnt);
mountpoint = dget(mnt->mnt_mountpoint);
br_read_unlock(&vfsmount_lock);
- dput(path->dentry);
+ path_put(path);
path->dentry = mountpoint;
- mntput(path->mnt);
path->mnt = &parent->mnt;
return 1;
}
@@ -1077,8 +1076,7 @@ int follow_down_one(struct path *path)
mounted = lookup_mnt(path);
if (mounted) {
- dput(path->dentry);
- mntput(path->mnt);
+ path_put(path);
path->mnt = mounted;
path->dentry = dget(mounted->mnt_root);
return 1;
@@ -1146,10 +1144,8 @@ static int follow_dotdot_rcu(struct nameidata *nd)
set_root_rcu(nd);
while (1) {
- if (nd->path.dentry == nd->root.dentry &&
- nd->path.mnt == nd->root.mnt) {
+ if (path_equal(&nd->path, &nd->root))
break;
- }
if (nd->path.dentry != nd->path.mnt->mnt_root) {
struct dentry *old = nd->path.dentry;
struct dentry *parent = old->d_parent;
@@ -1214,8 +1210,7 @@ int follow_down(struct path *path)
struct vfsmount *mounted = lookup_mnt(path);
if (!mounted)
break;
- dput(path->dentry);
- mntput(path->mnt);
+ path_put(path);
path->mnt = mounted;
path->dentry = dget(mounted->mnt_root);
continue;
@@ -1236,8 +1231,7 @@ static void follow_mount(struct path *path)
struct vfsmount *mounted = lookup_mnt(path);
if (!mounted)
break;
- dput(path->dentry);
- mntput(path->mnt);
+ path_put(path);
path->mnt = mounted;
path->dentry = dget(mounted->mnt_root);
}
@@ -1250,10 +1244,8 @@ static void follow_dotdot(struct nameidata *nd)
while(1) {
struct dentry *old = nd->path.dentry;
- if (nd->path.dentry == nd->root.dentry &&
- nd->path.mnt == nd->root.mnt) {
+ if (path_equal(&nd->path, &nd->root))
break;
- }
if (nd->path.dentry != nd->path.mnt->mnt_root) {
/* rare case of legitimate dget_parent()... */
nd->path.dentry = dget_parent(nd->path.dentry);
--
1.8.2.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] fs: nfsd: use path_equal() to simply code
2013-10-14 12:25 [PATCH 0/3] fs: use helper function path_foo() to simpily code Kefeng Wang
2013-10-14 12:26 ` [PATCH 1/3] fs: use path_equal() and path_put() to simplify code Kefeng Wang
@ 2013-10-14 12:26 ` Kefeng Wang
2013-10-14 12:26 ` [PATCH 3/3] fs: notify: " Kefeng Wang
2013-10-26 10:42 ` [PATCH 0/3] fs: use helper function path_foo() to simpily code Kefeng Wang
3 siblings, 0 replies; 5+ messages in thread
From: Kefeng Wang @ 2013-10-14 12:26 UTC (permalink / raw)
To: Alexander Viro
Cc: John McCutchan, J. Bruce Fields, Eric Paris, Robert Love,
linux-kernel, linux-fsdevel, linux-nfs
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
fs/nfsd/export.c | 3 +--
fs/nfsd/nfs4xdr.c | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 5f38ea3..ca3610d 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -649,8 +649,7 @@ static int svc_export_match(struct cache_head *a, struct cache_head *b)
struct svc_export *orig = container_of(a, struct svc_export, h);
struct svc_export *new = container_of(b, struct svc_export, h);
return orig->ex_client == new->ex_client &&
- orig->ex_path.dentry == new->ex_path.dentry &&
- orig->ex_path.mnt == new->ex_path.mnt;
+ path_equal(&orig->ex_path, &new->ex_path);
}
static void svc_export_init(struct cache_head *cnew, struct cache_head *citem)
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index d9454fe..6af4ff1 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -1829,7 +1829,7 @@ static __be32 nfsd4_encode_path(const struct path *root,
* dentries/path components in an array.
*/
for (;;) {
- if (cur.dentry == root->dentry && cur.mnt == root->mnt)
+ if (path_equal(&cur, root))
break;
if (cur.dentry == cur.mnt->mnt_root) {
if (follow_up(&cur))
--
1.8.2.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] fs: notify: use path_equal() to simply code
2013-10-14 12:25 [PATCH 0/3] fs: use helper function path_foo() to simpily code Kefeng Wang
2013-10-14 12:26 ` [PATCH 1/3] fs: use path_equal() and path_put() to simplify code Kefeng Wang
2013-10-14 12:26 ` [PATCH 2/3] fs: nfsd: use path_equal() to simply code Kefeng Wang
@ 2013-10-14 12:26 ` Kefeng Wang
2013-10-26 10:42 ` [PATCH 0/3] fs: use helper function path_foo() to simpily code Kefeng Wang
3 siblings, 0 replies; 5+ messages in thread
From: Kefeng Wang @ 2013-10-14 12:26 UTC (permalink / raw)
To: Alexander Viro
Cc: John McCutchan, J. Bruce Fields, Eric Paris, Robert Love,
linux-kernel, linux-fsdevel, linux-nfs
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
fs/notify/fanotify/fanotify.c | 3 +--
fs/notify/inotify/inotify_fsnotify.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c
index 0c2f912..777af06 100644
--- a/fs/notify/fanotify/fanotify.c
+++ b/fs/notify/fanotify/fanotify.c
@@ -24,8 +24,7 @@ static bool should_merge(struct fsnotify_event *old, struct fsnotify_event *new)
(new->mask & FAN_ALL_PERM_EVENTS))
return false;
#endif
- if ((old->path.mnt == new->path.mnt) &&
- (old->path.dentry == new->path.dentry))
+ if (path_equal(&old->path, &new->path))
return true;
break;
case (FSNOTIFY_EVENT_NONE):
diff --git a/fs/notify/inotify/inotify_fsnotify.c b/fs/notify/inotify/inotify_fsnotify.c
index 4216308..58b638d 100644
--- a/fs/notify/inotify/inotify_fsnotify.c
+++ b/fs/notify/inotify/inotify_fsnotify.c
@@ -53,8 +53,7 @@ static bool event_compare(struct fsnotify_event *old, struct fsnotify_event *new
return true;
break;
case (FSNOTIFY_EVENT_PATH):
- if ((old->path.mnt == new->path.mnt) &&
- (old->path.dentry == new->path.dentry))
+ if (path_equal(&old->path, &new->path))
return true;
break;
case (FSNOTIFY_EVENT_NONE):
--
1.8.2.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] fs: use helper function path_foo() to simpily code
2013-10-14 12:25 [PATCH 0/3] fs: use helper function path_foo() to simpily code Kefeng Wang
` (2 preceding siblings ...)
2013-10-14 12:26 ` [PATCH 3/3] fs: notify: " Kefeng Wang
@ 2013-10-26 10:42 ` Kefeng Wang
3 siblings, 0 replies; 5+ messages in thread
From: Kefeng Wang @ 2013-10-26 10:42 UTC (permalink / raw)
To: Alexander Viro
Cc: John McCutchan, J. Bruce Fields, Eric Paris, Robert Love,
linux-kernel, linux-fsdevel, linux-nfs
Any advice? ping...
On 10/14 20:25, Kefeng Wang wrote:
> Use helper function patch_equal() and path_put() to simpily code.
>
> Kefeng Wang (3):
> fs: use path_equal() and path_put() to simplify code
> fs: nfsd: use path_equal() to simply code
> fs: notify: use path_equal() to simply code
>
> fs/namei.c | 20 ++++++--------------
> fs/nfsd/export.c | 3 +--
> fs/nfsd/nfs4xdr.c | 2 +-
> fs/notify/fanotify/fanotify.c | 3 +--
> fs/notify/inotify/inotify_fsnotify.c | 3 +--
> 5 files changed, 10 insertions(+), 21 deletions(-)
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-10-26 10:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-14 12:25 [PATCH 0/3] fs: use helper function path_foo() to simpily code Kefeng Wang
2013-10-14 12:26 ` [PATCH 1/3] fs: use path_equal() and path_put() to simplify code Kefeng Wang
2013-10-14 12:26 ` [PATCH 2/3] fs: nfsd: use path_equal() to simply code Kefeng Wang
2013-10-14 12:26 ` [PATCH 3/3] fs: notify: " Kefeng Wang
2013-10-26 10:42 ` [PATCH 0/3] fs: use helper function path_foo() to simpily code Kefeng Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).