summaryrefslogtreecommitdiffstats
path: root/fs/ext4/ext4.h
diff options
context:
space:
mode:
authorFabian Frederick <fabf@skynet.be>2016-09-15 11:55:01 -0400
committerTheodore Ts'o <tytso@mit.edu>2016-09-15 11:55:01 -0400
commit518eaa6387df796d54e065e04502e800cae1df80 (patch)
tree9b7ce844047f58763185a4a66cb7cd1f80666f51 /fs/ext4/ext4.h
parentc3fe493ccdb1f443c30155150391835004014c6a (diff)
downloadlinux-518eaa6387df796d54e065e04502e800cae1df80.tar.gz
linux-518eaa6387df796d54e065e04502e800cae1df80.tar.bz2
linux-518eaa6387df796d54e065e04502e800cae1df80.zip
ext4: create EXT4_MAX_BLOCKS() macro
Create a macro to calculate length + offset -> maximum blocks This adds more readability. Signed-off-by: Fabian Frederick <fabf@skynet.be> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/ext4.h')
-rw-r--r--fs/ext4/ext4.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 962a0444dc84..282a51b07c57 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -262,6 +262,9 @@ struct ext4_io_submit {
(s)->s_first_ino)
#endif
#define EXT4_BLOCK_ALIGN(size, blkbits) ALIGN((size), (1 << (blkbits)))
+#define EXT4_MAX_BLOCKS(size, offset, blkbits) \
+ ((EXT4_BLOCK_ALIGN(size + offset, blkbits) >> blkbits) - (offset >> \
+ blkbits))
/* Translate a block number to a cluster number */
#define EXT4_B2C(sbi, blk) ((blk) >> (sbi)->s_cluster_bits)