[PATCH v2 1/3] fs: rename FMODE_NOACCOUNT to FMODE_INTERNAL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Rename the flag FMODE_NOACCOUNT that is used to mark internal files of
overlayfs and cachefiles to the more generic name FMODE_INTERNAL, which
also indicates that the file's f_path is possibly "fake".

Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx>
---
 fs/file_table.c    | 6 +++---
 fs/internal.h      | 5 +++--
 fs/namei.c         | 2 +-
 fs/open.c          | 2 +-
 include/linux/fs.h | 4 ++--
 5 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/fs/file_table.c b/fs/file_table.c
index 372653b92617..d64d3933f3e4 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -55,7 +55,7 @@ static void file_free_rcu(struct rcu_head *head)
 static inline void file_free(struct file *f)
 {
 	security_file_free(f);
-	if (!(f->f_mode & FMODE_NOACCOUNT))
+	if (!(f->f_mode & FMODE_INTERNAL))
 		percpu_counter_dec(&nr_files);
 	call_rcu(&f->f_rcuhead, file_free_rcu);
 }
@@ -205,12 +205,12 @@ struct file *alloc_empty_file(int flags, const struct cred *cred)
  *
  * Should not be used unless there's a very good reason to do so.
  */
-struct file *alloc_empty_file_noaccount(int flags, const struct cred *cred)
+struct file *alloc_empty_file_internal(int flags, const struct cred *cred)
 {
 	struct file *f = __alloc_file(flags, cred);
 
 	if (!IS_ERR(f))
-		f->f_mode |= FMODE_NOACCOUNT;
+		f->f_mode |= FMODE_INTERNAL;
 
 	return f;
 }
diff --git a/fs/internal.h b/fs/internal.h
index bd3b2810a36b..018605caf597 100644
--- a/fs/internal.h
+++ b/fs/internal.h
@@ -97,8 +97,9 @@ extern void chroot_fs_refs(const struct path *, const struct path *);
 /*
  * file_table.c
  */
-extern struct file *alloc_empty_file(int, const struct cred *);
-extern struct file *alloc_empty_file_noaccount(int, const struct cred *);
+extern struct file *alloc_empty_file(int flags, const struct cred *cred);
+extern struct file *alloc_empty_file_internal(int flags,
+					      const struct cred *cred);
 
 static inline void put_file_access(struct file *file)
 {
diff --git a/fs/namei.c b/fs/namei.c
index e4fe0879ae55..167f5acb0acf 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -3721,7 +3721,7 @@ struct file *vfs_tmpfile_open(struct mnt_idmap *idmap,
 	struct file *file;
 	int error;
 
-	file = alloc_empty_file_noaccount(open_flag, cred);
+	file = alloc_empty_file_internal(open_flag, cred);
 	if (!IS_ERR(file)) {
 		error = vfs_tmpfile(idmap, parentpath, file, mode);
 		if (error) {
diff --git a/fs/open.c b/fs/open.c
index 81444ebf6091..23f862708a4f 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -1124,7 +1124,7 @@ EXPORT_SYMBOL(dentry_create);
 struct file *open_with_fake_path(const struct path *path, int flags,
 				struct inode *inode, const struct cred *cred)
 {
-	struct file *f = alloc_empty_file_noaccount(flags, cred);
+	struct file *f = alloc_empty_file_internal(flags, cred);
 	if (!IS_ERR(f)) {
 		int error;
 
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 21a981680856..13eec1e8ca86 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -180,8 +180,8 @@ typedef int (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
 /* File represents mount that needs unmounting */
 #define FMODE_NEED_UNMOUNT	((__force fmode_t)0x10000000)
 
-/* File does not contribute to nr_files count */
-#define FMODE_NOACCOUNT		((__force fmode_t)0x20000000)
+/* File is kernel internal does not contribute to nr_files count */
+#define FMODE_INTERNAL		((__force fmode_t)0x20000000)
 
 /* File supports async buffered reads */
 #define FMODE_BUF_RASYNC	((__force fmode_t)0x40000000)
-- 
2.34.1




[Index of Archives]     [Linux Filesystems Devel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux