Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1667041 > unrolled thread
| Started by | Shaohua Li <shli@kernel.org> |
|---|---|
| First post | 2017-06-15 20:20 +0200 |
| Last post | 2017-06-19 21:10 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH V3 05/12] kernfs: introduce kernfs_node_id Shaohua Li <shli@kernel.org> - 2017-06-15 20:20 +0200
Re: [PATCH V3 05/12] kernfs: introduce kernfs_node_id kbuild test robot <lkp@intel.com> - 2017-06-16 16:50 +0200
Re: [PATCH V3 05/12] kernfs: introduce kernfs_node_id Tejun Heo <tj@kernel.org> - 2017-06-19 21:10 +0200
| From | Shaohua Li <shli@kernel.org> |
|---|---|
| Date | 2017-06-15 20:20 +0200 |
| Subject | [PATCH V3 05/12] kernfs: introduce kernfs_node_id |
| Message-ID | <tSHx8-5SK-25@gated-at.bofh.it> |
From: Shaohua Li <shli@fb.com>
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.
Signed-off-by: Shaohua Li <shli@fb.com>
---
fs/kernfs/dir.c | 10 +++++-----
fs/kernfs/file.c | 4 ++--
fs/kernfs/inode.c | 4 ++--
include/linux/cgroup.h | 2 +-
include/linux/kernfs.h | 9 +++++++--
5 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
index 5233318..6afb634 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. */
smp_mb__before_atomic();
@@ -718,7 +718,7 @@ struct kernfs_node *kernfs_find_and_get_node_by_ino(struct kernfs_root *root,
* '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();
@@ -1651,7 +1651,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;
diff --git a/fs/kernfs/file.c b/fs/kernfs/file.c
index 7f90d4d..7441925 100644
--- a/fs/kernfs/file.c
+++ b/fs/kernfs/file.c
@@ -895,7 +895,7 @@ static void kernfs_notify_workfn(struct work_struct *work)
* have the matching @file available. Look up the inodes
* and generate the events manually.
*/
- inode = ilookup(info->sb, kn->ino);
+ inode = ilookup(info->sb, kn->id.ino);
if (!inode)
continue;
@@ -903,7 +903,7 @@ static void kernfs_notify_workfn(struct work_struct *work)
if (parent) {
struct inode *p_inode;
- p_inode = ilookup(info->sb, parent->ino);
+ p_inode = ilookup(info->sb, parent->id.ino);
if (p_inode) {
fsnotify(p_inode, FS_MODIFY | FS_EVENT_ON_CHILD,
inode, FSNOTIFY_EVENT_INODE, kn->name, 0);
diff --git a/fs/kernfs/inode.c b/fs/kernfs/inode.c
index 4c8b510..a343039 100644
--- a/fs/kernfs/inode.c
+++ b/fs/kernfs/inode.c
@@ -220,7 +220,7 @@ static void kernfs_init_inode(struct kernfs_node *kn, struct inode *inode)
inode->i_private = kn;
inode->i_mapping->a_ops = &kernfs_aops;
inode->i_op = &kernfs_iops;
- inode->i_generation = kn->generation;
+ inode->i_generation = kn->id.generation;
set_default_inode_attr(inode, kn->mode);
kernfs_refresh_inode(kn, inode);
@@ -266,7 +266,7 @@ struct inode *kernfs_get_inode(struct super_block *sb, struct kernfs_node *kn)
{
struct inode *inode;
- inode = iget_locked(sb, kn->ino);
+ inode = iget_locked(sb, kn->id.ino);
if (inode && (inode->i_state & I_NEW))
kernfs_init_inode(kn, inode);
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 710a005..30c6877 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -543,7 +543,7 @@ static inline bool cgroup_is_populated(struct cgroup *cgrp)
/* returns ino associated with a cgroup */
static inline ino_t cgroup_ino(struct cgroup *cgrp)
{
- return cgrp->kn->ino;
+ return cgrp->kn->id.ino;
}
/* cft/css accessors for cftype->write() operation */
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h
index 8c00d28..c823a84 100644
--- a/include/linux/kernfs.h
+++ b/include/linux/kernfs.h
@@ -95,6 +95,12 @@ struct kernfs_elem_attr {
struct kernfs_node *notify_next; /* for kernfs_notify() */
};
+/* represent a kernfs node */
+struct kernfs_node_id {
+ u32 ino;
+ u32 generation;
+} __attribute__((packed));
+
/*
* kernfs_node - the building block of kernfs hierarchy. Each and every
* kernfs node is represented by single kernfs_node. Most fields are
@@ -131,11 +137,10 @@ struct kernfs_node {
void *priv;
+ struct kernfs_node_id id;
unsigned short flags;
umode_t mode;
- unsigned int ino;
struct kernfs_iattrs *iattr;
- u32 generation;
};
/*
--
2.9.3
[toc] | [next] | [standalone]
| From | kbuild test robot <lkp@intel.com> |
|---|---|
| Date | 2017-06-16 16:50 +0200 |
| Message-ID | <tT0Jr-1ld-11@gated-at.bofh.it> |
| In reply to | #1667041 |
[Multipart message — attachments visible in raw view] — view raw
Hi Shaohua,
[auto build test ERROR on block/for-next]
[also build test ERROR on v4.12-rc5 next-20170616]
[cannot apply to driver-core/driver-core-testing]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Shaohua-Li/blktrace-output-cgroup-info/20170616-133722
base: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next
config: x86_64-kexec (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All errors (new ones prefixed by >>):
In file included from fs/fs-writeback.c:98:0:
include/trace/events/writeback.h: In function '__trace_wb_assign_cgroup':
>> include/trace/events/writeback.h:139:34: error: 'struct kernfs_node' has no member named 'ino'
return wb->memcg_css->cgroup->kn->ino;
^~
In file included from fs/fs-writeback.c:98:0:
include/trace/events/writeback.h:140:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
vim +139 include/trace/events/writeback.h
9fb0a7da Tejun Heo 2013-01-11 133
5634cc2a Tejun Heo 2015-08-18 134 #ifdef CREATE_TRACE_POINTS
5634cc2a Tejun Heo 2015-08-18 135 #ifdef CONFIG_CGROUP_WRITEBACK
5634cc2a Tejun Heo 2015-08-18 136
a664edb3 Yang Shi 2016-03-03 137 static inline unsigned int __trace_wb_assign_cgroup(struct bdi_writeback *wb)
5634cc2a Tejun Heo 2015-08-18 138 {
a664edb3 Yang Shi 2016-03-03 @139 return wb->memcg_css->cgroup->kn->ino;
5634cc2a Tejun Heo 2015-08-18 140 }
5634cc2a Tejun Heo 2015-08-18 141
a664edb3 Yang Shi 2016-03-03 142 static inline unsigned int __trace_wbc_assign_cgroup(struct writeback_control *wbc)
:::::: The code at line 139 was first introduced by commit
:::::: a664edb374c704a734a0df41fc742c285a5beb52 tracing, writeback: Replace cgroup path to cgroup ino
:::::: TO: Yang Shi <yang.shi@linaro.org>
:::::: CC: Steven Rostedt <rostedt@goodmis.org>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[toc] | [prev] | [next] | [standalone]
| From | Tejun Heo <tj@kernel.org> |
|---|---|
| Date | 2017-06-19 21:10 +0200 |
| Message-ID | <tUadJ-6Iy-35@gated-at.bofh.it> |
| In reply to | #1667041 |
Hello,
On Thu, Jun 15, 2017 at 11:17:13AM -0700, Shaohua Li wrote:
> +/* represent a kernfs node */
> +struct kernfs_node_id {
> + u32 ino;
> + u32 generation;
> +} __attribute__((packed));
Can we just make it a u64? kernfs cares about the details but for
everyone else it can just be a unique 64bit id.
Thanks.
--
tejun
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web