summaryrefslogtreecommitdiff
path: root/fs/kernfs/dir.c
diff options
context:
space:
mode:
authorShaohua Li <shli@fb.com>2017-07-12 21:49:50 +0300
committerJens Axboe <axboe@kernel.dk>2017-07-29 18:00:03 +0300
commitc53cd490b1a491ebf1d8e30da97e7231459a4208 (patch)
tree09edea3836ea440490dcc2993c802b65b93c1e6b /fs/kernfs/dir.c
parent319ba91d352a74acb47678788109a14b9b4dd4c2 (diff)
downloadlinux-c53cd490b1a491ebf1d8e30da97e7231459a4208.tar.xz
kernfs: introduce kernfs_node_id
inode number and generation can identify a kernfs node. We are going to export the identification by exportfs operations, so put ino and generation into a separate structure. It's convenient when later patches use the identification. Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Shaohua Li <shli@fb.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/kernfs/dir.c')
-rw-r--r--fs/kernfs/dir.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
index b61a7efceb7a..89d1dc19340b 100644
--- a/fs/kernfs/dir.c
+++ b/fs/kernfs/dir.c
@@ -539,7 +539,7 @@ void kernfs_put(struct kernfs_node *kn)
}
kfree(kn->iattr);
spin_lock(&kernfs_idr_lock);
- idr_remove(&root->ino_idr, kn->ino);
+ idr_remove(&root->ino_idr, kn->id.ino);
spin_unlock(&kernfs_idr_lock);
kmem_cache_free(kernfs_node_cache, kn);
@@ -645,8 +645,8 @@ static struct kernfs_node *__kernfs_new_node(struct kernfs_root *root,
idr_preload_end();
if (ret < 0)
goto err_out2;
- kn->ino = ret;
- kn->generation = gen;
+ kn->id.ino = ret;
+ kn->id.generation = gen;
/*
* set ino first. This barrier is paired with atomic_inc_not_zero in
@@ -721,7 +721,7 @@ struct kernfs_node *kernfs_find_and_get_node_by_ino(struct kernfs_root *root,
* before 'count'. So if 'count' is uptodate, 'ino' should be uptodate,
* hence we can use 'ino' to filter stale node.
*/
- if (kn->ino != ino)
+ if (kn->id.ino != ino)
goto out;
rcu_read_unlock();
@@ -1654,7 +1654,7 @@ static int kernfs_fop_readdir(struct file *file, struct dir_context *ctx)
const char *name = pos->name;
unsigned int type = dt_type(pos);
int len = strlen(name);
- ino_t ino = pos->ino;
+ ino_t ino = pos->id.ino;
ctx->pos = pos->hash;
file->private_data = pos;