From: Jean-Noel Cordenner <jean-noel.cordenner@bull.net>
To: linux-ext4@vger.kernel.org
Subject: [RFC] [patch 1/3] change attribute for ext4: change attribute in the VFS
Date: Wed, 29 Nov 2006 19:54:12 +0100 [thread overview]
Message-ID: <456DD754.3060803@bull.net> (raw)
This part of the patch concerns the change attribute in the VFS layer. The
definition of the change_attribute field in the inode and its update.
Signed-off-by: Celine Bourde
Signed-off-by: Alexandre Ratchov
Signed-off-by: Jean Noel Cordenner <jean-noel.cordenner@bull.net>
Index: linux-2.6.19-rc2-mm2-CA/fs/attr.c
===================================================================
--- linux-2.6.19-rc2-mm2-CA.orig/fs/attr.c 2006-11-13 16:49:14.000000000 +0100
+++ linux-2.6.19-rc2-mm2-CA/fs/attr.c 2006-11-29 15:06:56.000000000 +0100
@@ -88,6 +88,9 @@
if (ia_valid & ATTR_CTIME)
inode->i_ctime = timespec_trunc(attr->ia_ctime,
inode->i_sb->s_time_gran);
+ if (ia_valid & ATTR_CHANGE_ATTRIBUTE)
+ inode->i_change_attribute = attr->ia_change_attribute;
+
if (ia_valid & ATTR_MODE) {
umode_t mode = attr->ia_mode;
@@ -112,6 +115,7 @@
mode = inode->i_mode;
now = current_fs_time(inode->i_sb);
+ inode->i_change_attribute++;
attr->ia_ctime = now;
if (!(ia_valid & ATTR_ATIME_SET))
attr->ia_atime = now;
Index: linux-2.6.19-rc2-mm2-CA/fs/bad_inode.c
===================================================================
--- linux-2.6.19-rc2-mm2-CA.orig/fs/bad_inode.c 2006-11-09 17:20:55.000000000 +0100
+++ linux-2.6.19-rc2-mm2-CA/fs/bad_inode.c 2006-11-29 15:06:13.000000000 +0100
@@ -95,6 +95,7 @@
inode->i_mode = S_IFREG;
inode->i_atime = inode->i_mtime = inode->i_ctime =
current_fs_time(inode->i_sb);
+ inode->i_change_attribute++;
inode->i_op = &bad_inode_ops;
inode->i_fop = &bad_file_ops;
}
Index: linux-2.6.19-rc2-mm2-CA/fs/binfmt_misc.c
===================================================================
--- linux-2.6.19-rc2-mm2-CA.orig/fs/binfmt_misc.c 2006-11-09
17:20:53.000000000 +0100
+++ linux-2.6.19-rc2-mm2-CA/fs/binfmt_misc.c 2006-11-29 15:05:57.000000000 +0100
@@ -508,6 +508,7 @@
inode->i_blocks = 0;
inode->i_atime = inode->i_mtime = inode->i_ctime =
current_fs_time(inode->i_sb);
+ inode->i_change_attribute = 1;
}
return inode;
}
Index: linux-2.6.19-rc2-mm2-CA/fs/inode.c
===================================================================
--- linux-2.6.19-rc2-mm2-CA.orig/fs/inode.c 2006-11-09 17:20:59.000000000 +0100
+++ linux-2.6.19-rc2-mm2-CA/fs/inode.c 2006-11-29 15:29:51.000000000 +0100
@@ -1217,18 +1217,11 @@
return;
now = current_fs_time(inode->i_sb);
- if (!timespec_equal(&inode->i_mtime, &now)) {
- inode->i_mtime = now;
- sync_it = 1;
- }
-
- if (!timespec_equal(&inode->i_ctime, &now)) {
- inode->i_ctime = now;
- sync_it = 1;
- }
+ inode->i_mtime = now;
+ inode->i_ctime = now;
- if (sync_it)
- mark_inode_dirty_sync(inode);
+ inode->i_change_attribute++;
+ mark_inode_dirty_sync(inode);
}
EXPORT_SYMBOL(file_update_time);
Index: linux-2.6.19-rc2-mm2-CA/fs/libfs.c
===================================================================
--- linux-2.6.19-rc2-mm2-CA.orig/fs/libfs.c 2006-11-09 17:20:56.000000000 +0100
+++ linux-2.6.19-rc2-mm2-CA/fs/libfs.c 2006-11-29 15:05:31.000000000 +0100
@@ -220,6 +220,7 @@
root->i_mode = S_IFDIR | S_IRUSR | S_IWUSR;
root->i_uid = root->i_gid = 0;
root->i_atime = root->i_mtime = root->i_ctime = CURRENT_TIME;
+ root->i_change_attribute = 1;
dentry = d_alloc(NULL, &d_name);
if (!dentry) {
iput(root);
@@ -242,6 +243,8 @@
{
struct inode *inode = old_dentry->d_inode;
+ inode->i_change_attribute++;
+ dir->i_change_attribute++;
inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
inc_nlink(inode);
atomic_inc(&inode->i_count);
@@ -274,6 +277,8 @@
{
struct inode *inode = dentry->d_inode;
+ inode->i_change_attribute++;
+ dir->i_change_attribute++;
inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
drop_nlink(inode);
dput(dentry);
@@ -312,6 +317,8 @@
old_dir->i_ctime = old_dir->i_mtime = new_dir->i_ctime =
new_dir->i_mtime = inode->i_ctime = CURRENT_TIME;
+ old_dir->i_change_attribute++;
+ new_dir->i_change_attribute++;
return 0;
}
@@ -380,6 +387,7 @@
inode->i_uid = inode->i_gid = 0;
inode->i_blocks = 0;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+ inode->i_change_attribute = 1;
inode->i_op = &simple_dir_inode_operations;
inode->i_fop = &simple_dir_operations;
inode->i_nlink = 2;
@@ -401,6 +409,7 @@
inode->i_uid = inode->i_gid = 0;
inode->i_blocks = 0;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+ inode->i_change_attribute = 1;
inode->i_fop = files->ops;
inode->i_ino = i;
d_add(dentry, inode);
Index: linux-2.6.19-rc2-mm2-CA/fs/pipe.c
===================================================================
--- linux-2.6.19-rc2-mm2-CA.orig/fs/pipe.c 2006-11-09 17:20:58.000000000 +0100
+++ linux-2.6.19-rc2-mm2-CA/fs/pipe.c 2006-11-29 15:04:19.000000000 +0100
@@ -864,6 +864,7 @@
inode->i_uid = current->fsuid;
inode->i_gid = current->fsgid;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+ inode->i_change_attribute = 1;
return inode;
Index: linux-2.6.19-rc2-mm2-CA/include/linux/fs.h
===================================================================
--- linux-2.6.19-rc2-mm2-CA.orig/include/linux/fs.h 2006-11-09
17:21:55.000000000 +0100
+++ linux-2.6.19-rc2-mm2-CA/include/linux/fs.h 2006-11-29 15:04:05.000000000 +0100
@@ -323,6 +323,7 @@
#define ATTR_KILL_SUID 2048
#define ATTR_KILL_SGID 4096
#define ATTR_FILE 8192
+#define ATTR_CHANGE_ATTRIBUTE 16384
/*
* This is the Inode Attributes structure, used for notify_change(). It
@@ -342,6 +343,7 @@
struct timespec ia_atime;
struct timespec ia_mtime;
struct timespec ia_ctime;
+ unsigned long ia_change_attribute;
/*
* Not an attribute, but an auxilary info for filesystems wanting to
@@ -538,6 +540,7 @@
struct timespec i_atime;
struct timespec i_mtime;
struct timespec i_ctime;
+ unsigned long i_change_attribute;
unsigned int i_blkbits;
unsigned long i_version;
blkcnt_t i_blocks;
next reply other threads:[~2006-11-29 18:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-29 18:54 Jean-Noel Cordenner [this message]
2006-11-30 6:32 ` [RFC] [patch 1/3] change attribute for ext4: change attribute in the VFS Andreas Dilger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=456DD754.3060803@bull.net \
--to=jean-noel.cordenner@bull.net \
--cc=linux-ext4@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox