summaryrefslogtreecommitdiffstats
path: root/fs/fat/inode.c
diff options
context:
space:
mode:
authorNamjae Jeon <namjae.jeon@samsung.com>2013-04-30 01:21:10 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2013-04-30 03:28:40 +0200
commite22a444275d1e7c80db5d8bec08fb8d0d79617ad (patch)
treeb69291b4b24a733f6d5ec6178e1cc9059e5dc5bf /fs/fat/inode.c
parentfat: move fat_i_pos_read to fat.h (diff)
downloadlinux-e22a444275d1e7c80db5d8bec08fb8d0d79617ad.tar.xz
linux-e22a444275d1e7c80db5d8bec08fb8d0d79617ad.zip
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 <namjae.jeon@samsung.com> Signed-off-by: Ravishankar N <ravi.n1@samsung.com> Signed-off-by: Amit Sahrawat <a.sahrawat@samsung.com> Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to '')
-rw-r--r--fs/fat/inode.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 78e363c844cb..68cb5a6eb539 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -662,7 +662,8 @@ static int __fat_write_inode(struct inode *inode, int wait)
struct buffer_head *bh;
struct msdos_dir_entry *raw_entry;
loff_t i_pos;
- int err;
+ sector_t blocknr;
+ int err, offset;
if (inode->i_ino == MSDOS_ROOT_INO)
return 0;
@@ -672,7 +673,8 @@ retry:
if (!i_pos)
return 0;
- bh = sb_bread(sb, i_pos >> sbi->dir_per_block_bits);
+ fat_get_blknr_offset(sbi, i_pos, &blocknr, &offset);
+ bh = sb_bread(sb, blocknr);
if (!bh) {
fat_msg(sb, KERN_ERR, "unable to read inode block "
"for updating (i_pos %lld)", i_pos);
@@ -685,8 +687,7 @@ retry:
goto retry;
}
- raw_entry = &((struct msdos_dir_entry *) (bh->b_data))
- [i_pos & (sbi->dir_per_block - 1)];
+ raw_entry = &((struct msdos_dir_entry *) (bh->b_data))[offset];
if (S_ISDIR(inode->i_mode))
raw_entry->size = 0;
else