[PATCH] fat: cleanup fat_get_block(s)
get_blocks() was removed. So, this removes it on fat, and will take advantage of the multi block mapping. Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
7e96287ddc
commit
6a1d9805ec
@ -50,14 +50,14 @@ static int fat_add_cluster(struct inode *inode)
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __fat_get_blocks(struct inode *inode, sector_t iblock,
|
static inline int __fat_get_block(struct inode *inode, sector_t iblock,
|
||||||
unsigned long *max_blocks,
|
unsigned long *max_blocks,
|
||||||
struct buffer_head *bh_result, int create)
|
struct buffer_head *bh_result, int create)
|
||||||
{
|
{
|
||||||
struct super_block *sb = inode->i_sb;
|
struct super_block *sb = inode->i_sb;
|
||||||
struct msdos_sb_info *sbi = MSDOS_SB(sb);
|
struct msdos_sb_info *sbi = MSDOS_SB(sb);
|
||||||
sector_t phys;
|
|
||||||
unsigned long mapped_blocks;
|
unsigned long mapped_blocks;
|
||||||
|
sector_t phys;
|
||||||
int err, offset;
|
int err, offset;
|
||||||
|
|
||||||
err = fat_bmap(inode, iblock, &phys, &mapped_blocks);
|
err = fat_bmap(inode, iblock, &phys, &mapped_blocks);
|
||||||
@ -93,32 +93,27 @@ static int __fat_get_blocks(struct inode *inode, sector_t iblock,
|
|||||||
err = fat_bmap(inode, iblock, &phys, &mapped_blocks);
|
err = fat_bmap(inode, iblock, &phys, &mapped_blocks);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
BUG_ON(!phys);
|
BUG_ON(!phys);
|
||||||
BUG_ON(*max_blocks != mapped_blocks);
|
BUG_ON(*max_blocks != mapped_blocks);
|
||||||
set_buffer_new(bh_result);
|
set_buffer_new(bh_result);
|
||||||
map_bh(bh_result, sb, phys);
|
map_bh(bh_result, sb, phys);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int fat_get_blocks(struct inode *inode, sector_t iblock,
|
|
||||||
struct buffer_head *bh_result, int create)
|
|
||||||
{
|
|
||||||
struct super_block *sb = inode->i_sb;
|
|
||||||
int err;
|
|
||||||
unsigned long max_blocks = bh_result->b_size >> inode->i_blkbits;
|
|
||||||
|
|
||||||
err = __fat_get_blocks(inode, iblock, &max_blocks, bh_result, create);
|
|
||||||
if (err)
|
|
||||||
return err;
|
|
||||||
bh_result->b_size = max_blocks << sb->s_blocksize_bits;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fat_get_block(struct inode *inode, sector_t iblock,
|
static int fat_get_block(struct inode *inode, sector_t iblock,
|
||||||
struct buffer_head *bh_result, int create)
|
struct buffer_head *bh_result, int create)
|
||||||
{
|
{
|
||||||
unsigned long max_blocks = 1;
|
struct super_block *sb = inode->i_sb;
|
||||||
return __fat_get_blocks(inode, iblock, &max_blocks, bh_result, create);
|
unsigned long max_blocks = bh_result->b_size >> inode->i_blkbits;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
err = __fat_get_block(inode, iblock, &max_blocks, bh_result, create);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
bh_result->b_size = max_blocks << sb->s_blocksize_bits;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fat_writepage(struct page *page, struct writeback_control *wbc)
|
static int fat_writepage(struct page *page, struct writeback_control *wbc)
|
||||||
@ -188,7 +183,7 @@ static ssize_t fat_direct_IO(int rw, struct kiocb *iocb,
|
|||||||
* condition of fat_get_block() and ->truncate().
|
* condition of fat_get_block() and ->truncate().
|
||||||
*/
|
*/
|
||||||
return blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov,
|
return blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov,
|
||||||
offset, nr_segs, fat_get_blocks, NULL);
|
offset, nr_segs, fat_get_block, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static sector_t _fat_bmap(struct address_space *mapping, sector_t block)
|
static sector_t _fat_bmap(struct address_space *mapping, sector_t block)
|
||||||
|
Loading…
Reference in New Issue
Block a user