diff mbox series

[1/8] eventfs: introducing struct tracefs_inode

Message ID 1674407228-49109-1-git-send-email-akaher@vmware.com (mailing list archive)
State Changes Requested
Headers show
Series [1/8] eventfs: introducing struct tracefs_inode | expand

Commit Message

Ajay Kaher Jan. 22, 2023, 5:07 p.m. UTC
Introducing tracefs_inode structure, this will help eventfs
to keep track of inode, flags and pointer to private date.

Renaming, removing static property from some function name.

Signed-off-by: Ajay Kaher <akaher@vmware.com>
Co-developed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Tested-by: Ching-lin Yu <chinglinyu@google.com>
---
 fs/tracefs/inode.c    | 20 ++++++++++----------
 fs/tracefs/internal.h | 25 +++++++++++++++++++++++++
 2 files changed, 35 insertions(+), 10 deletions(-)
 create mode 100644 fs/tracefs/internal.h

Comments

kernel test robot Jan. 23, 2023, 5:41 a.m. UTC | #1
Hi Ajay,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.2-rc5]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Ajay-Kaher/eventfs-adding-eventfs-dir-add-functions/20230123-010956
patch link:    https://lore.kernel.org/r/1674407228-49109-1-git-send-email-akaher%40vmware.com
patch subject: [PATCH 1/8] eventfs: introducing struct tracefs_inode
config: x86_64-rhel-8.3-rust (https://download.01.org/0day-ci/archive/20230123/202301231320.vExYuIWP-lkp@intel.com/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/926ba0e4029baa4bbc7c283854148d1769642d50
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Ajay-Kaher/eventfs-adding-eventfs-dir-add-functions/20230123-010956
        git checkout 926ba0e4029baa4bbc7c283854148d1769642d50
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash fs/tracefs/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> fs/tracefs/inode.c:130:15: warning: no previous prototype for function 'tracefs_get_inode' [-Wmissing-prototypes]
   struct inode *tracefs_get_inode(struct super_block *sb)
                 ^
   fs/tracefs/inode.c:130:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   struct inode *tracefs_get_inode(struct super_block *sb)
   ^
   static 
>> fs/tracefs/inode.c:402:16: warning: no previous prototype for function 'tracefs_start_creating' [-Wmissing-prototypes]
   struct dentry *tracefs_start_creating(const char *name, struct dentry *parent)
                  ^
   fs/tracefs/inode.c:402:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   struct dentry *tracefs_start_creating(const char *name, struct dentry *parent)
   ^
   static 
>> fs/tracefs/inode.c:440:16: warning: no previous prototype for function 'tracefs_failed_creating' [-Wmissing-prototypes]
   struct dentry *tracefs_failed_creating(struct dentry *dentry)
                  ^
   fs/tracefs/inode.c:440:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   struct dentry *tracefs_failed_creating(struct dentry *dentry)
   ^
   static 
>> fs/tracefs/inode.c:448:16: warning: no previous prototype for function 'tracefs_end_creating' [-Wmissing-prototypes]
   struct dentry *tracefs_end_creating(struct dentry *dentry)
                  ^
   fs/tracefs/inode.c:448:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   struct dentry *tracefs_end_creating(struct dentry *dentry)
   ^
   static 
   4 warnings generated.


vim +/tracefs_get_inode +130 fs/tracefs/inode.c

   129	
 > 130	struct inode *tracefs_get_inode(struct super_block *sb)
   131	{
   132		struct inode *inode = new_inode(sb);
   133		if (inode) {
   134			inode->i_ino = get_next_ino();
   135			inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
   136		}
   137		return inode;
   138	}
   139
kernel test robot Jan. 23, 2023, 6:01 a.m. UTC | #2
Hi Ajay,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.2-rc5 next-20230120]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Ajay-Kaher/eventfs-adding-eventfs-dir-add-functions/20230123-010956
patch link:    https://lore.kernel.org/r/1674407228-49109-1-git-send-email-akaher%40vmware.com
patch subject: [PATCH 1/8] eventfs: introducing struct tracefs_inode
config: x86_64-rhel-8.3-func (https://download.01.org/0day-ci/archive/20230123/202301231332.yy4fecm8-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
        # https://github.com/intel-lab-lkp/linux/commit/926ba0e4029baa4bbc7c283854148d1769642d50
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Ajay-Kaher/eventfs-adding-eventfs-dir-add-functions/20230123-010956
        git checkout 926ba0e4029baa4bbc7c283854148d1769642d50
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=x86_64 olddefconfig
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> fs/tracefs/inode.c:130:15: warning: no previous prototype for 'tracefs_get_inode' [-Wmissing-prototypes]
     130 | struct inode *tracefs_get_inode(struct super_block *sb)
         |               ^~~~~~~~~~~~~~~~~
>> fs/tracefs/inode.c:402:16: warning: no previous prototype for 'tracefs_start_creating' [-Wmissing-prototypes]
     402 | struct dentry *tracefs_start_creating(const char *name, struct dentry *parent)
         |                ^~~~~~~~~~~~~~~~~~~~~~
>> fs/tracefs/inode.c:440:16: warning: no previous prototype for 'tracefs_failed_creating' [-Wmissing-prototypes]
     440 | struct dentry *tracefs_failed_creating(struct dentry *dentry)
         |                ^~~~~~~~~~~~~~~~~~~~~~~
>> fs/tracefs/inode.c:448:16: warning: no previous prototype for 'tracefs_end_creating' [-Wmissing-prototypes]
     448 | struct dentry *tracefs_end_creating(struct dentry *dentry)
         |                ^~~~~~~~~~~~~~~~~~~~


vim +/tracefs_get_inode +130 fs/tracefs/inode.c

   129	
 > 130	struct inode *tracefs_get_inode(struct super_block *sb)
   131	{
   132		struct inode *inode = new_inode(sb);
   133		if (inode) {
   134			inode->i_ino = get_next_ino();
   135			inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
   136		}
   137		return inode;
   138	}
   139
diff mbox series

Patch

diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
index da85b39..015b7b8 100644
--- a/fs/tracefs/inode.c
+++ b/fs/tracefs/inode.c
@@ -127,7 +127,7 @@  static const struct inode_operations tracefs_dir_inode_operations = {
 	.rmdir		= tracefs_syscall_rmdir,
 };
 
-static struct inode *tracefs_get_inode(struct super_block *sb)
+struct inode *tracefs_get_inode(struct super_block *sb)
 {
 	struct inode *inode = new_inode(sb);
 	if (inode) {
@@ -399,7 +399,7 @@  static struct file_system_type trace_fs_type = {
 };
 MODULE_ALIAS_FS("tracefs");
 
-static struct dentry *start_creating(const char *name, struct dentry *parent)
+struct dentry *tracefs_start_creating(const char *name, struct dentry *parent)
 {
 	struct dentry *dentry;
 	int error;
@@ -437,7 +437,7 @@  static struct dentry *start_creating(const char *name, struct dentry *parent)
 	return dentry;
 }
 
-static struct dentry *failed_creating(struct dentry *dentry)
+struct dentry *tracefs_failed_creating(struct dentry *dentry)
 {
 	inode_unlock(d_inode(dentry->d_parent));
 	dput(dentry);
@@ -445,7 +445,7 @@  static struct dentry *failed_creating(struct dentry *dentry)
 	return NULL;
 }
 
-static struct dentry *end_creating(struct dentry *dentry)
+struct dentry *tracefs_end_creating(struct dentry *dentry)
 {
 	inode_unlock(d_inode(dentry->d_parent));
 	return dentry;
@@ -490,14 +490,14 @@  struct dentry *tracefs_create_file(const char *name, umode_t mode,
 	if (!(mode & S_IFMT))
 		mode |= S_IFREG;
 	BUG_ON(!S_ISREG(mode));
-	dentry = start_creating(name, parent);
+	dentry = tracefs_start_creating(name, parent);
 
 	if (IS_ERR(dentry))
 		return NULL;
 
 	inode = tracefs_get_inode(dentry->d_sb);
 	if (unlikely(!inode))
-		return failed_creating(dentry);
+		return tracefs_failed_creating(dentry);
 
 	inode->i_mode = mode;
 	inode->i_fop = fops ? fops : &tracefs_file_operations;
@@ -506,13 +506,13 @@  struct dentry *tracefs_create_file(const char *name, umode_t mode,
 	inode->i_gid = d_inode(dentry->d_parent)->i_gid;
 	d_instantiate(dentry, inode);
 	fsnotify_create(d_inode(dentry->d_parent), dentry);
-	return end_creating(dentry);
+	return tracefs_end_creating(dentry);
 }
 
 static struct dentry *__create_dir(const char *name, struct dentry *parent,
 				   const struct inode_operations *ops)
 {
-	struct dentry *dentry = start_creating(name, parent);
+	struct dentry *dentry = tracefs_start_creating(name, parent);
 	struct inode *inode;
 
 	if (IS_ERR(dentry))
@@ -520,7 +520,7 @@  static struct dentry *__create_dir(const char *name, struct dentry *parent,
 
 	inode = tracefs_get_inode(dentry->d_sb);
 	if (unlikely(!inode))
-		return failed_creating(dentry);
+		return tracefs_failed_creating(dentry);
 
 	/* Do not set bits for OTH */
 	inode->i_mode = S_IFDIR | S_IRWXU | S_IRUSR| S_IRGRP | S_IXUSR | S_IXGRP;
@@ -534,7 +534,7 @@  static struct dentry *__create_dir(const char *name, struct dentry *parent,
 	d_instantiate(dentry, inode);
 	inc_nlink(d_inode(dentry->d_parent));
 	fsnotify_mkdir(d_inode(dentry->d_parent), dentry);
-	return end_creating(dentry);
+	return tracefs_end_creating(dentry);
 }
 
 /**
diff --git a/fs/tracefs/internal.h b/fs/tracefs/internal.h
new file mode 100644
index 0000000..27869ea
--- /dev/null
+++ b/fs/tracefs/internal.h
@@ -0,0 +1,25 @@ 
+#ifndef _TRACEFS_INTERNAL_H
+#define _TRACEFS_INTERNAL_H
+
+enum {
+	TRACEFS_EVENT_INODE     = BIT(1),
+};
+
+struct tracefs_inode {
+	unsigned long           flags;
+	void                    *private;
+	struct inode            vfs_inode;
+};
+
+static inline struct tracefs_inode *get_tracefs(const struct inode *inode)
+{
+	return container_of(inode, struct tracefs_inode, vfs_inode);
+}
+
+struct dentry *tracefs_start_creating(const char *name, struct dentry *parent);
+struct dentry *tracefs_end_creating(struct dentry *dentry);
+struct dentry *tracefs_failed_creating(struct dentry *dentry);
+struct inode *tracefs_get_inode(struct super_block *sb);
+
+#endif
+