btrfs-progs: setting of time to the root directory
diff mbox

Message ID 201011170107.AA00002@T-ITOH1.jp.fujitsu.com
State New, archived
Headers show

Commit Message

Tsutomu Itoh Nov. 17, 2010, 1:07 a.m. UTC
None

Patch
diff mbox

diff -urNp btrfs-progs-unstable/utils.c btrfs-progs-unstable-new/utils.c
--- btrfs-progs-unstable/utils.c	2010-11-09 11:46:23.000000000 +0900
+++ btrfs-progs-unstable-new/utils.c	2010-11-16 17:24:08.000000000 +0900
@@ -565,6 +565,7 @@  int btrfs_make_root_dir(struct btrfs_tra
 {
 	int ret;
 	struct btrfs_inode_item inode_item;
+	time_t now = time(NULL);
 
 	memset(&inode_item, 0, sizeof(inode_item));
 	btrfs_set_stack_inode_generation(&inode_item, trans->transid);
@@ -572,6 +573,14 @@  int btrfs_make_root_dir(struct btrfs_tra
 	btrfs_set_stack_inode_nlink(&inode_item, 1);
 	btrfs_set_stack_inode_nbytes(&inode_item, root->leafsize);
 	btrfs_set_stack_inode_mode(&inode_item, S_IFDIR | 0555);
+	btrfs_set_stack_timespec_sec(&inode_item.atime, now);
+	btrfs_set_stack_timespec_nsec(&inode_item.atime, 0);
+	btrfs_set_stack_timespec_sec(&inode_item.ctime, now);
+	btrfs_set_stack_timespec_nsec(&inode_item.ctime, 0);
+	btrfs_set_stack_timespec_sec(&inode_item.mtime, now);
+	btrfs_set_stack_timespec_nsec(&inode_item.mtime, 0);
+	btrfs_set_stack_timespec_sec(&inode_item.otime, 0);
+	btrfs_set_stack_timespec_nsec(&inode_item.otime, 0);
 
 	if (root->fs_info->tree_root == root)
 		btrfs_set_super_root_dir(&root->fs_info->super_copy, objectid);