aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nilfs2
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2009-04-06 22:02:00 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-07 11:31:20 -0400
commit612392307cb09e49051225092cbbd7049bd8db93 (patch)
tree401a227d0fae219aae7b682bb613bb388b4a7682 /fs/nilfs2
parente339ad31f59925b48a92ee3947692fdf9758b8c7 (diff)
nilfs2: support nanosecond timestamp
After a review of user's feedback for finding out other compatibility issues, I found nilfs improperly initializes timestamps in inode; CURRENT_TIME was used there instead of CURRENT_TIME_SEC even though nilfs didn't have nanosecond timestamps on disk. A few users gave us the report that the tar program sometimes failed to expand symbolic links on nilfs, and it turned out to be the cause. Instead of applying the above displacement, I've decided to support nanosecond timestamps on this occation. Fortunetaly, a needless 64-bit field was in the nilfs_inode struct, and I found it's available for this purpose without impact for the users. So, this will do the enhancement and resolve the tar problem. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/nilfs2')
-rw-r--r--fs/nilfs2/gcinode.c1
-rw-r--r--fs/nilfs2/inode.c13
-rw-r--r--fs/nilfs2/nilfs.h1
-rw-r--r--fs/nilfs2/super.c1
4 files changed, 7 insertions, 9 deletions
diff --git a/fs/nilfs2/gcinode.c b/fs/nilfs2/gcinode.c
index 77615aabc7e2..19d2102b6a69 100644
--- a/fs/nilfs2/gcinode.c
+++ b/fs/nilfs2/gcinode.c
@@ -226,7 +226,6 @@ static struct inode *alloc_gcinode(struct the_nilfs *nilfs, ino_t ino,
226 ii->i_flags = 0; 226 ii->i_flags = 0;
227 ii->i_state = 1 << NILFS_I_GCINODE; 227 ii->i_state = 1 << NILFS_I_GCINODE;
228 ii->i_bh = NULL; 228 ii->i_bh = NULL;
229 ii->i_dtime = 0;
230 nilfs_bmap_init_gc(ii->i_bmap); 229 nilfs_bmap_init_gc(ii->i_bmap);
231 230
232 return inode; 231 return inode;
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c
index a1922b17662c..49ab4a49bb4f 100644
--- a/fs/nilfs2/inode.c
+++ b/fs/nilfs2/inode.c
@@ -306,7 +306,6 @@ struct inode *nilfs_new_inode(struct inode *dir, int mode)
306 306
307 /* ii->i_file_acl = 0; */ 307 /* ii->i_file_acl = 0; */
308 /* ii->i_dir_acl = 0; */ 308 /* ii->i_dir_acl = 0; */
309 ii->i_dtime = 0;
310 ii->i_dir_start_lookup = 0; 309 ii->i_dir_start_lookup = 0;
311#ifdef CONFIG_NILFS_FS_POSIX_ACL 310#ifdef CONFIG_NILFS_FS_POSIX_ACL
312 ii->i_acl = NULL; 311 ii->i_acl = NULL;
@@ -390,11 +389,10 @@ int nilfs_read_inode_common(struct inode *inode,
390 inode->i_atime.tv_sec = le64_to_cpu(raw_inode->i_mtime); 389 inode->i_atime.tv_sec = le64_to_cpu(raw_inode->i_mtime);
391 inode->i_ctime.tv_sec = le64_to_cpu(raw_inode->i_ctime); 390 inode->i_ctime.tv_sec = le64_to_cpu(raw_inode->i_ctime);
392 inode->i_mtime.tv_sec = le64_to_cpu(raw_inode->i_mtime); 391 inode->i_mtime.tv_sec = le64_to_cpu(raw_inode->i_mtime);
393 inode->i_atime.tv_nsec = 0; 392 inode->i_atime.tv_nsec = le32_to_cpu(raw_inode->i_mtime_nsec);
394 inode->i_ctime.tv_nsec = 0; 393 inode->i_ctime.tv_nsec = le32_to_cpu(raw_inode->i_ctime_nsec);
395 inode->i_mtime.tv_nsec = 0; 394 inode->i_mtime.tv_nsec = le32_to_cpu(raw_inode->i_mtime_nsec);
396 ii->i_dtime = le64_to_cpu(raw_inode->i_dtime); 395 if (inode->i_nlink == 0 && inode->i_mode == 0)
397 if (inode->i_nlink == 0 && (inode->i_mode == 0 || ii->i_dtime))
398 return -EINVAL; /* this inode is deleted */ 396 return -EINVAL; /* this inode is deleted */
399 397
400 inode->i_blocks = le64_to_cpu(raw_inode->i_blocks); 398 inode->i_blocks = le64_to_cpu(raw_inode->i_blocks);
@@ -505,9 +503,10 @@ void nilfs_write_inode_common(struct inode *inode,
505 raw_inode->i_size = cpu_to_le64(inode->i_size); 503 raw_inode->i_size = cpu_to_le64(inode->i_size);
506 raw_inode->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec); 504 raw_inode->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec);
507 raw_inode->i_mtime = cpu_to_le64(inode->i_mtime.tv_sec); 505 raw_inode->i_mtime = cpu_to_le64(inode->i_mtime.tv_sec);
506 raw_inode->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec);
507 raw_inode->i_mtime_nsec = cpu_to_le32(inode->i_mtime.tv_nsec);
508 raw_inode->i_blocks = cpu_to_le64(inode->i_blocks); 508 raw_inode->i_blocks = cpu_to_le64(inode->i_blocks);
509 509
510 raw_inode->i_dtime = cpu_to_le64(ii->i_dtime);
511 raw_inode->i_flags = cpu_to_le32(ii->i_flags); 510 raw_inode->i_flags = cpu_to_le32(ii->i_flags);
512 raw_inode->i_generation = cpu_to_le32(inode->i_generation); 511 raw_inode->i_generation = cpu_to_le32(inode->i_generation);
513 512
diff --git a/fs/nilfs2/nilfs.h b/fs/nilfs2/nilfs.h
index 19af5ab86275..7558c977db02 100644
--- a/fs/nilfs2/nilfs.h
+++ b/fs/nilfs2/nilfs.h
@@ -48,7 +48,6 @@ struct nilfs_inode_info {
48 struct nilfs_bmap *i_bmap; 48 struct nilfs_bmap *i_bmap;
49 union nilfs_bmap_union i_bmap_union; 49 union nilfs_bmap_union i_bmap_union;
50 __u64 i_xattr; /* sector_t ??? */ 50 __u64 i_xattr; /* sector_t ??? */
51 __u32 i_dtime;
52 __u32 i_dir_start_lookup; 51 __u32 i_dir_start_lookup;
53 __u64 i_cno; /* check point number for GC inode */ 52 __u64 i_cno; /* check point number for GC inode */
54 struct address_space i_btnode_cache; 53 struct address_space i_btnode_cache;
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c
index e2ced824c624..e117e1ea9bff 100644
--- a/fs/nilfs2/super.c
+++ b/fs/nilfs2/super.c
@@ -792,6 +792,7 @@ nilfs_fill_super(struct super_block *sb, void *data, int silent,
792 sb->s_op = &nilfs_sops; 792 sb->s_op = &nilfs_sops;
793 sb->s_export_op = &nilfs_export_ops; 793 sb->s_export_op = &nilfs_export_ops;
794 sb->s_root = NULL; 794 sb->s_root = NULL;
795 sb->s_time_gran = 1;
795 796
796 if (!nilfs_loaded(nilfs)) { 797 if (!nilfs_loaded(nilfs)) {
797 err = load_nilfs(nilfs, sbi); 798 err = load_nilfs(nilfs, sbi);