From e22a444275d1e7c80db5d8bec08fb8d0d79617ad Mon Sep 17 00:00:00 2001 From: Namjae Jeon Date: Mon, 29 Apr 2013 16:21:10 -0700 Subject: fat: introduce a helper fat_get_blknr_offset() Introduce helper function to get the block number and offset for a given i_pos value. Use it in __fat_write_inode() now and later on in nfs.c Signed-off-by: Namjae Jeon Signed-off-by: Ravishankar N Signed-off-by: Amit Sahrawat Acked-by: OGAWA Hirofumi Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/fat/fat.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'fs/fat/fat.h') diff --git a/fs/fat/fat.h b/fs/fat/fat.h index f16948ed5bf8..980c0346c168 100644 --- a/fs/fat/fat.h +++ b/fs/fat/fat.h @@ -218,6 +218,13 @@ static inline sector_t fat_clus_to_blknr(struct msdos_sb_info *sbi, int clus) + sbi->data_start; } +static inline void fat_get_blknr_offset(struct msdos_sb_info *sbi, + loff_t i_pos, sector_t *blknr, int *offset) +{ + *blknr = i_pos >> sbi->dir_per_block_bits; + *offset = i_pos & (sbi->dir_per_block - 1); +} + static inline loff_t fat_i_pos_read(struct msdos_sb_info *sbi, struct inode *inode) { -- cgit v1.2.3