aboutsummaryrefslogtreecommitdiffstats
path: root/fs/block_dev.c
diff options
context:
space:
mode:
authorNick Piggin <npiggin@suse.de>2007-10-16 04:25:04 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 12:42:55 -0400
commit6272b5a5868f3d5fbf9815f9984891ced343dabc (patch)
tree350eb309221242119901f1f4fcdb04a52abaea36 /fs/block_dev.c
parent800d15a53e7d14fa26495b7b95d3bfe7877dd69d (diff)
block_dev: convert to new aops
Signed-off-by: Nick Piggin <npiggin@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/block_dev.c')
-rw-r--r--fs/block_dev.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 6339a30879b7..379a446e243e 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -378,14 +378,26 @@ static int blkdev_readpage(struct file * file, struct page * page)
378 return block_read_full_page(page, blkdev_get_block); 378 return block_read_full_page(page, blkdev_get_block);
379} 379}
380 380
381static int blkdev_prepare_write(struct file *file, struct page *page, unsigned from, unsigned to) 381static int blkdev_write_begin(struct file *file, struct address_space *mapping,
382 loff_t pos, unsigned len, unsigned flags,
383 struct page **pagep, void **fsdata)
382{ 384{
383 return block_prepare_write(page, from, to, blkdev_get_block); 385 *pagep = NULL;
386 return block_write_begin(file, mapping, pos, len, flags, pagep, fsdata,
387 blkdev_get_block);
384} 388}
385 389
386static int blkdev_commit_write(struct file *file, struct page *page, unsigned from, unsigned to) 390static int blkdev_write_end(struct file *file, struct address_space *mapping,
391 loff_t pos, unsigned len, unsigned copied,
392 struct page *page, void *fsdata)
387{ 393{
388 return block_commit_write(page, from, to); 394 int ret;
395 ret = block_write_end(file, mapping, pos, len, copied, page, fsdata);
396
397 unlock_page(page);
398 page_cache_release(page);
399
400 return ret;
389} 401}
390 402
391/* 403/*
@@ -1327,8 +1339,8 @@ const struct address_space_operations def_blk_aops = {
1327 .readpage = blkdev_readpage, 1339 .readpage = blkdev_readpage,
1328 .writepage = blkdev_writepage, 1340 .writepage = blkdev_writepage,
1329 .sync_page = block_sync_page, 1341 .sync_page = block_sync_page,
1330 .prepare_write = blkdev_prepare_write, 1342 .write_begin = blkdev_write_begin,
1331 .commit_write = blkdev_commit_write, 1343 .write_end = blkdev_write_end,
1332 .writepages = generic_writepages, 1344 .writepages = generic_writepages,
1333 .direct_IO = blkdev_direct_IO, 1345 .direct_IO = blkdev_direct_IO,
1334}; 1346};