summaryrefslogtreecommitdiffstats
path: root/fs/ext4/ext4.h
diff options
context:
space:
mode:
authorFabian Frederick <fabf@skynet.be>2016-09-15 17:55:01 +0200
committerTheodore Ts'o <tytso@mit.edu>2016-09-15 17:55:01 +0200
commit518eaa6387df796d54e065e04502e800cae1df80 (patch)
tree9b7ce844047f58763185a4a66cb7cd1f80666f51 /fs/ext4/ext4.h
parentext4: remove unneeded test in ext4_alloc_file_blocks() (diff)
downloadlinux-518eaa6387df796d54e065e04502e800cae1df80.tar.xz
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)