2003-03-24 17:04:30

by Dave Jones

[permalink] [raw]
Subject: Add missing time initialisation to get_cramfs_inode

diff -urpN --exclude-from=/home/davej/.exclude bk-linus/fs/cramfs/inode.c linux-2.5/fs/cramfs/inode.c
--- bk-linus/fs/cramfs/inode.c 2003-03-08 09:57:39.000000000 +0000
+++ linux-2.5/fs/cramfs/inode.c 2003-03-22 12:49:42.000000000 +0000
@@ -51,6 +51,7 @@ static struct inode *get_cramfs_inode(st
inode->i_blocks = (cramfs_inode->size - 1) / 512 + 1;
inode->i_blksize = PAGE_CACHE_SIZE;
inode->i_gid = cramfs_inode->gid;
+ inode->i_mtime = inode->i_atime = inode->i_ctime = 0;
inode->i_ino = CRAMINO(cramfs_inode);
/* inode->i_nlink is left 1 - arguably wrong for directories,
but it's the best we can do without reading the directory


2003-03-25 06:39:36

by Mikael Starvik

[permalink] [raw]
Subject: RE: Add missing time initialisation to get_cramfs_inode

We have tried to push a patch similar to yours for quite some time without
any success.

diff -Nurp linux-2.5/fs/cramfs/inode.c linux-2.5-local/fs/cramfs/inode.c
--- linux-2.5/fs/cramfs/inode.c Tue Mar 25 07:43:00 2003
+++ linux-2.5-local/fs/cramfs/inode.c Tue Mar 25 07:44:32 2003
@@ -52,6 +52,10 @@ static struct inode *get_cramfs_inode(st
inode->i_blksize = PAGE_CACHE_SIZE;
inode->i_gid = cramfs_inode->gid;
inode->i_ino = CRAMINO(cramfs_inode);
+ inode->i_mtime.tv_sec = ((struct cramfs_sb_info*)sb->s_fs_info)->fstime;
+ inode->i_mtime.tv_nsec = 0;
+ inode->i_ctime.tv_sec = ((struct cramfs_sb_info*)sb->s_fs_info)->fstime;
+ inode->i_ctime.tv_nsec = 0;
/* inode->i_nlink is left 1 - arguably wrong for directories,
but it's the best we can do without reading the directory
contents. 1 yields the right result in GNU find, even
@@ -135,7 +139,7 @@ static void *cramfs_read(struct super_bl
return read_buffers[i] + blk_offset;
}

- devsize = sb->s_bdev->bd_inode->i_size >> 12;
+ devsize = sb->s_bdev->bd_inode->i_size >> PAGE_CACHE_SHIFT;
if (!devsize)
devsize = ~0UL;

@@ -232,10 +236,13 @@ static int cramfs_fill_super(struct supe
goto out;
}
root_offset = super.root.offset << 2;
+ sbi->fstime = 0;
if (super.flags & CRAMFS_FLAG_FSID_VERSION_2) {
sbi->size=super.size;
sbi->blocks=super.fsid.blocks;
sbi->files=super.fsid.files;
+ if (super.flags & CRAMFS_FLAG_EDITION_TIMESTAMP)
+ sbi->fstime=super.fsid.edition;
} else {
sbi->size=1<<28;
sbi->blocks=0;
diff -Nurp linux-2.5/include/linux/cramfs_fs.h linux-2.5-local/include/linux/cramfs_fs.h
--- linux-2.5/include/linux/cramfs_fs.h Tue Mar 25 07:43:13 2003
+++ linux-2.5-local/include/linux/cramfs_fs.h Mon Nov 18 08:29:53 2002
@@ -76,6 +76,7 @@ struct cramfs_super {
*/
#define CRAMFS_FLAG_FSID_VERSION_2 0x00000001 /* fsid version #2 */
#define CRAMFS_FLAG_SORTED_DIRS 0x00000002 /* sorted dirs */
+#define CRAMFS_FLAG_EDITION_TIMESTAMP 0x00000004 /* fstime in edition */
#define CRAMFS_FLAG_HOLES 0x00000100 /* support for holes */
#define CRAMFS_FLAG_WRONG_SIGNATURE 0x00000200 /* reserved */
#define CRAMFS_FLAG_SHIFTED_ROOT_OFFSET 0x00000400 /* shifted root fs */
diff -Nurp linux-2.5/include/linux/cramfs_fs_sb.h linux-2.5-local/include/linux/cramfs_fs_sb.h
--- linux-2.5/include/linux/cramfs_fs_sb.h Tue Mar 25 07:43:16 2003
+++ linux-2.5-local/include/linux/cramfs_fs_sb.h Mon Nov 18 08:30:05 2002
@@ -10,6 +10,7 @@ struct cramfs_sb_info {
unsigned long blocks;
unsigned long files;
unsigned long flags;
+ time_t fstime; /* From the edition field if EDITION_TIMESTAMP */
};

static inline struct cramfs_sb_info *CRAMFS_SB(struct super_block *sb)

/Mikael

-----Original Message-----
From: [email protected]
[mailto:[email protected]]On Behalf Of
[email protected]
Sent: Monday, March 24, 2003 5:42 PM
To: [email protected]
Cc: [email protected]
Subject: Add missing time initialisation to get_cramfs_inode


diff -urpN --exclude-from=/home/davej/.exclude bk-linus/fs/cramfs/inode.c linux-2.5/fs/cramfs/inode.c
--- bk-linus/fs/cramfs/inode.c 2003-03-08 09:57:39.000000000 +0000
+++ linux-2.5/fs/cramfs/inode.c 2003-03-22 12:49:42.000000000 +0000
@@ -51,6 +51,7 @@ static struct inode *get_cramfs_inode(st
inode->i_blocks = (cramfs_inode->size - 1) / 512 + 1;
inode->i_blksize = PAGE_CACHE_SIZE;
inode->i_gid = cramfs_inode->gid;
+ inode->i_mtime = inode->i_atime = inode->i_ctime = 0;
inode->i_ino = CRAMINO(cramfs_inode);
/* inode->i_nlink is left 1 - arguably wrong for directories,
but it's the best we can do without reading the directory