summaryrefslogtreecommitdiff
path: root/include/linux/f2fs_fs.h
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2015-02-09 23:02:44 +0300
committerJaegeuk Kim <jaegeuk@kernel.org>2015-02-12 04:04:48 +0300
commitf7ef9b83b583640111039b30e13263b71c3a6ed5 (patch)
tree712cb50392f1b1a2d922a991fa63acf8d5c3c553 /include/linux/f2fs_fs.h
parentda17eece035d72cb50d48529744a490784f29d2f (diff)
downloadlinux-f7ef9b83b583640111039b30e13263b71c3a6ed5.tar.xz
f2fs: introduce macros to convert bytes and blocks in f2fs
This patch adds two macros for transition between byte and block offsets. Currently, f2fs only supports 4KB blocks, so use the default size for now. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'include/linux/f2fs_fs.h')
-rw-r--r--include/linux/f2fs_fs.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h
index 09805720f4bf..a23556c32703 100644
--- a/include/linux/f2fs_fs.h
+++ b/include/linux/f2fs_fs.h
@@ -19,12 +19,16 @@
#define F2FS_MAX_LOG_SECTOR_SIZE 12 /* 12 bits for 4096 bytes */
#define F2FS_LOG_SECTORS_PER_BLOCK 3 /* log number for sector/blk */
#define F2FS_BLKSIZE 4096 /* support only 4KB block */
+#define F2FS_BLKSIZE_BITS 12 /* bits for F2FS_BLKSIZE */
#define F2FS_MAX_EXTENSION 64 /* # of extension entries */
#define F2FS_BLK_ALIGN(x) (((x) + F2FS_BLKSIZE - 1) / F2FS_BLKSIZE)
#define NULL_ADDR ((block_t)0) /* used as block_t addresses */
#define NEW_ADDR ((block_t)-1) /* used as block_t addresses */
+#define F2FS_BYTES_TO_BLK(bytes) ((bytes) >> F2FS_BLKSIZE_BITS)
+#define F2FS_BLK_TO_BYTES(blk) ((blk) << F2FS_BLKSIZE_BITS)
+
/* 0, 1(node nid), 2(meta nid) are reserved node id */
#define F2FS_RESERVED_NODE_NUM 3