aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorChao Yu <chao2.yu@samsung.com>2014-08-22 04:17:38 -0400
committerJaegeuk Kim <jaegeuk@kernel.org>2014-08-22 16:56:47 -0400
commitb5b822050ca3c4fc1f475100cc197cc00ba2d492 (patch)
tree69dd3f0332ad5f422ab02ff88bf8638b23c93a87 /include/linux
parent9d1589ef2edeb4565161771bd0faf3fd5288844b (diff)
f2fs: use macro for code readability
This patch introduces DEF_NIDS_PER_INODE/GET_ORPHAN_BLOCKS/F2FS_CP_PACKS macro instead of numbers in code for readability. change log from v1: o fix typo pointed out by Jaegeuk Kim. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/f2fs_fs.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h
index 0ed77f32c9ac..08ed2b0a96e6 100644
--- a/include/linux/f2fs_fs.h
+++ b/include/linux/f2fs_fs.h
@@ -90,6 +90,8 @@ struct f2fs_super_block {
90#define CP_ORPHAN_PRESENT_FLAG 0x00000002 90#define CP_ORPHAN_PRESENT_FLAG 0x00000002
91#define CP_UMOUNT_FLAG 0x00000001 91#define CP_UMOUNT_FLAG 0x00000001
92 92
93#define F2FS_CP_PACKS 2 /* # of checkpoint packs */
94
93struct f2fs_checkpoint { 95struct f2fs_checkpoint {
94 __le64 checkpoint_ver; /* checkpoint block version number */ 96 __le64 checkpoint_ver; /* checkpoint block version number */
95 __le64 user_block_count; /* # of user blocks */ 97 __le64 user_block_count; /* # of user blocks */
@@ -126,6 +128,9 @@ struct f2fs_checkpoint {
126 */ 128 */
127#define F2FS_ORPHANS_PER_BLOCK 1020 129#define F2FS_ORPHANS_PER_BLOCK 1020
128 130
131#define GET_ORPHAN_BLOCKS(n) ((n + F2FS_ORPHANS_PER_BLOCK - 1) / \
132 F2FS_ORPHANS_PER_BLOCK)
133
129struct f2fs_orphan_block { 134struct f2fs_orphan_block {
130 __le32 ino[F2FS_ORPHANS_PER_BLOCK]; /* inode numbers */ 135 __le32 ino[F2FS_ORPHANS_PER_BLOCK]; /* inode numbers */
131 __le32 reserved; /* reserved */ 136 __le32 reserved; /* reserved */
@@ -147,6 +152,7 @@ struct f2fs_extent {
147#define F2FS_NAME_LEN 255 152#define F2FS_NAME_LEN 255
148#define F2FS_INLINE_XATTR_ADDRS 50 /* 200 bytes for inline xattrs */ 153#define F2FS_INLINE_XATTR_ADDRS 50 /* 200 bytes for inline xattrs */
149#define DEF_ADDRS_PER_INODE 923 /* Address Pointers in an Inode */ 154#define DEF_ADDRS_PER_INODE 923 /* Address Pointers in an Inode */
155#define DEF_NIDS_PER_INODE 5 /* Node IDs in an Inode */
150#define ADDRS_PER_INODE(fi) addrs_per_inode(fi) 156#define ADDRS_PER_INODE(fi) addrs_per_inode(fi)
151#define ADDRS_PER_BLOCK 1018 /* Address Pointers in a Direct Block */ 157#define ADDRS_PER_BLOCK 1018 /* Address Pointers in a Direct Block */
152#define NIDS_PER_BLOCK 1018 /* Node IDs in an Indirect Block */ 158#define NIDS_PER_BLOCK 1018 /* Node IDs in an Indirect Block */
@@ -166,8 +172,9 @@ struct f2fs_extent {
166#define MAX_INLINE_DATA (sizeof(__le32) * (DEF_ADDRS_PER_INODE - \ 172#define MAX_INLINE_DATA (sizeof(__le32) * (DEF_ADDRS_PER_INODE - \
167 F2FS_INLINE_XATTR_ADDRS - 1)) 173 F2FS_INLINE_XATTR_ADDRS - 1))
168 174
169#define INLINE_DATA_OFFSET (PAGE_CACHE_SIZE - sizeof(struct node_footer) \ 175#define INLINE_DATA_OFFSET (PAGE_CACHE_SIZE - sizeof(struct node_footer) -\
170 - sizeof(__le32) * (DEF_ADDRS_PER_INODE + 5 - 1)) 176 sizeof(__le32) * (DEF_ADDRS_PER_INODE + \
177 DEF_NIDS_PER_INODE - 1))
171 178
172struct f2fs_inode { 179struct f2fs_inode {
173 __le16 i_mode; /* file mode */ 180 __le16 i_mode; /* file mode */
@@ -197,7 +204,7 @@ struct f2fs_inode {
197 204
198 __le32 i_addr[DEF_ADDRS_PER_INODE]; /* Pointers to data blocks */ 205 __le32 i_addr[DEF_ADDRS_PER_INODE]; /* Pointers to data blocks */
199 206
200 __le32 i_nid[5]; /* direct(2), indirect(2), 207 __le32 i_nid[DEF_NIDS_PER_INODE]; /* direct(2), indirect(2),
201 double_indirect(1) node id */ 208 double_indirect(1) node id */
202} __packed; 209} __packed;
203 210