Commit 6272b5a5868f3d5fbf9815f9984891ced343dabc
Committed by
Linus Torvalds
1 parent
800d15a53e
Exists in
master
and in
4 other branches
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>
Showing 1 changed file with 18 additions and 6 deletions Side-by-side Diff
fs/block_dev.c
... | ... | @@ -378,14 +378,26 @@ |
378 | 378 | return block_read_full_page(page, blkdev_get_block); |
379 | 379 | } |
380 | 380 | |
381 | -static int blkdev_prepare_write(struct file *file, struct page *page, unsigned from, unsigned to) | |
381 | +static 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 | |
386 | -static int blkdev_commit_write(struct file *file, struct page *page, unsigned from, unsigned to) | |
390 | +static 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 @@ |
1327 | 1339 | .readpage = blkdev_readpage, |
1328 | 1340 | .writepage = blkdev_writepage, |
1329 | 1341 | .sync_page = block_sync_page, |
1330 | - .prepare_write = blkdev_prepare_write, | |
1331 | - .commit_write = blkdev_commit_write, | |
1342 | + .write_begin = blkdev_write_begin, | |
1343 | + .write_end = blkdev_write_end, | |
1332 | 1344 | .writepages = generic_writepages, |
1333 | 1345 | .direct_IO = blkdev_direct_IO, |
1334 | 1346 | }; |