mirror of
https://gitee.com/openharmony/third_party_f2fs-tools
synced 2024-11-26 19:51:32 +00:00
Enhancement: add i_atime and i_generation
"You appear to have dropped i_btime - no big deal, you weren't using it anyway. However if you ever want to support NFS export you will need some value which is assigned when the inode is allocated and never changed until it is de-allocated. This is used to detect when an NFS file-handle refers to a previous incarnation of an inode and so should be rejected as STALE. i_btime could have possibly provided this, but not any more. You might want to add something back. ext3 uses "i_generation" and has an 's_next_generation' in the superblock to ensure that each new inode gets a new generation number. You've also dropped i_atime. I can certainly understand the desire to do that, but I wonder if it is entirely wise. There are some use-cases where i_mtime is a poor substitute. Also 'current_depth' looks a little odd without a 'i_' prefix. It wouldn't hurt to have a comment noting that it is for directories." >From Neil Brown. Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
This commit is contained in:
parent
036d45e551
commit
b5af7953f8
@ -1021,13 +1021,16 @@ static int8_t f2fs_write_root_inode(void)
|
||||
raw_node->i.i_size = cpu_to_le64(1 * blk_size_bytes); /* dentry */
|
||||
raw_node->i.i_blocks = cpu_to_le64(2);
|
||||
|
||||
raw_node->i.i_atime = cpu_to_le32(time(NULL));
|
||||
raw_node->i.i_atime_nsec = 0;
|
||||
raw_node->i.i_ctime = cpu_to_le32(time(NULL));
|
||||
raw_node->i.i_ctime_nsec = 0;
|
||||
raw_node->i.i_mtime = cpu_to_le32(time(NULL));
|
||||
raw_node->i.i_mtime_nsec = 0;
|
||||
raw_node->i.i_generation = 0;
|
||||
raw_node->i.i_xattr_nid = 0;
|
||||
raw_node->i.i_flags = 0;
|
||||
raw_node->i.current_depth = cpu_to_le32(1);
|
||||
raw_node->i.i_current_depth = cpu_to_le32(1);
|
||||
|
||||
data_blk_nor = le32_to_cpu(super_block.main_blkaddr) +
|
||||
f2fs_params.cur_seg[CURSEG_HOT_DATA] * f2fs_params.blks_per_seg;
|
||||
|
@ -182,7 +182,7 @@ struct f2fs_extent {
|
||||
} __attribute__((packed));
|
||||
|
||||
#define F2FS_MAX_NAME_LEN 256
|
||||
#define ADDRS_PER_INODE 927 /* Address Pointers in an Inode */
|
||||
#define ADDRS_PER_INODE 923 /* Address Pointers in an Inode */
|
||||
#define ADDRS_PER_BLOCK 1018 /* Address Pointers in a Direct Block */
|
||||
#define NIDS_PER_BLOCK 1018 /* Node IDs in an Indirect Block */
|
||||
|
||||
@ -195,11 +195,14 @@ struct f2fs_inode {
|
||||
__le32 i_links; /* Links count */
|
||||
__le64 i_size; /* File size in bytes */
|
||||
__le64 i_blocks; /* File size in bytes */
|
||||
__le64 i_atime; /* Inode access time */
|
||||
__le64 i_ctime; /* inode Change time */
|
||||
__le64 i_mtime; /* Modification time */
|
||||
__le32 i_atime_nsec;
|
||||
__le32 i_ctime_nsec;
|
||||
__le32 i_mtime_nsec;
|
||||
__le32 current_depth;
|
||||
__le32 i_generation; /* File version (for NFS) */
|
||||
__le32 i_current_depth; /* only for directory depth */
|
||||
__le32 i_xattr_nid;
|
||||
__le32 i_flags; /* file attributes */
|
||||
__le32 i_pino; /* parent inode number */
|
||||
|
Loading…
Reference in New Issue
Block a user