bytes_to_blocks is open coded in more than 30 places roundup_to_blocksize is open coded in more than 15 places Signed-off-by: Marcin Slusarz <marcin.slusarz@xxxxxxxxx> --- include/linux/fs.h | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/include/linux/fs.h b/include/linux/fs.h index e766be0..1b4e5b6 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2451,5 +2451,17 @@ int proc_nr_files(struct ctl_table *table, int write, struct file *filp, int get_filesystem_list(char * buf); +static inline +unsigned long long roundup_to_blocksize(unsigned long long bytes, struct super_block *sb) +{ + return (bytes + sb->s_blocksize - 1) & ~(sb->s_blocksize - 1); +} + +static inline +blkcnt_t bytes_to_blocks(unsigned long long bytes, struct super_block *sb) +{ + return (bytes + sb->s_blocksize - 1) >> sb->s_blocksize_bits; +} + #endif /* __KERNEL__ */ #endif /* _LINUX_FS_H */ -- 1.6.0.6 -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html