Commit 6272b5a5 authored by Nick Piggin's avatar Nick Piggin Committed by Linus Torvalds

block_dev: convert to new aops

Signed-off-by: default avatarNick Piggin <npiggin@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 800d15a5
...@@ -378,14 +378,26 @@ static int blkdev_readpage(struct file * file, struct page * page) ...@@ -378,14 +378,26 @@ static int blkdev_readpage(struct file * file, struct page * page)
return block_read_full_page(page, blkdev_get_block); return block_read_full_page(page, blkdev_get_block);
} }
static int blkdev_prepare_write(struct file *file, struct page *page, unsigned from, unsigned to) static int blkdev_write_begin(struct file *file, struct address_space *mapping,
loff_t pos, unsigned len, unsigned flags,
struct page **pagep, void **fsdata)
{ {
return block_prepare_write(page, from, to, blkdev_get_block); *pagep = NULL;
return block_write_begin(file, mapping, pos, len, flags, pagep, fsdata,
blkdev_get_block);
} }
static int blkdev_commit_write(struct file *file, struct page *page, unsigned from, unsigned to) static int blkdev_write_end(struct file *file, struct address_space *mapping,
loff_t pos, unsigned len, unsigned copied,
struct page *page, void *fsdata)
{ {
return block_commit_write(page, from, to); int ret;
ret = block_write_end(file, mapping, pos, len, copied, page, fsdata);
unlock_page(page);
page_cache_release(page);
return ret;
} }
/* /*
...@@ -1327,8 +1339,8 @@ const struct address_space_operations def_blk_aops = { ...@@ -1327,8 +1339,8 @@ const struct address_space_operations def_blk_aops = {
.readpage = blkdev_readpage, .readpage = blkdev_readpage,
.writepage = blkdev_writepage, .writepage = blkdev_writepage,
.sync_page = block_sync_page, .sync_page = block_sync_page,
.prepare_write = blkdev_prepare_write, .write_begin = blkdev_write_begin,
.commit_write = blkdev_commit_write, .write_end = blkdev_write_end,
.writepages = generic_writepages, .writepages = generic_writepages,
.direct_IO = blkdev_direct_IO, .direct_IO = blkdev_direct_IO,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment