Re: [PATCH 02/16] f2fs: add on-disk layout

From: Stefan Hajnoczi
Date: Sun Oct 07 2012 - 02:42:34 EST


> +/*
> + * For superblock
> + */
> +struct f2fs_super_block {
> + __le32 magic; /* Magic Number */
> + __le16 major_ver; /* Major Version */
> + __le16 minor_ver; /* Minor Version */
> + __le32 log_sectorsize; /* log2 (Sector size in bytes) */
> + __le32 log_sectors_per_block; /* log2 (Number of sectors per block */
> + __le32 log_blocksize; /* log2 (Block size in bytes) */

Why store log_blocksize on disk when it can be calculated from
log_sectorsize and log_sectors_per_block? It may be handy to keep this
in the in-memory superblock but keeping it on-disk means you need a
consistency check and error code path when loading the superblock.

> +struct f2fs_inode {
> + __le16 i_mode; /* File mode */
> + __le16 i_reserved; /* Reserved */
> + __le32 i_uid; /* User ID */
> + __le32 i_gid; /* Group ID */
> + __le32 i_links; /* Links count */
> + __le64 i_size; /* File size in bytes */
> + __le64 i_blocks; /* File size in bytes */

File size in blocks

> +struct direct_node {
> + __le32 addr[ADDRS_PER_BLOCK]; /* aray of data block address */

s/aray/array/

> +} __packed;
> +
> +struct indirect_node {
> + __le32 nid[NIDS_PER_BLOCK]; /* aray of data block address */

s/aray/array/

Stefan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/