diff options
author | Christoph Hellwig <hch@lst.de> | 2010-06-04 05:29:54 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2010-08-09 16:47:30 -0400 |
commit | ea0f04e59543bafb3d2cbe37a0d375acb0bb2c34 (patch) | |
tree | 66a400f5b8e9a01acb72107c72e504325af6fe67 /fs/buffer.c | |
parent | eafdc7d190a944c755a9fe68573c193e6e0217e7 (diff) |
get rid of nobh_write_begin_newtrunc
Move the call to vmtruncate to get rid of accessive blocks to the only
remaining caller and rename the non-truncating version to nobh_write_begin.
Get rid of the superflous file argument to it while we're at it.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/buffer.c')
-rw-r--r-- | fs/buffer.c | 37 |
1 files changed, 4 insertions, 33 deletions
diff --git a/fs/buffer.c b/fs/buffer.c index d54812b198e9..559daf76bca4 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -2510,11 +2510,11 @@ static void attach_nobh_buffers(struct page *page, struct buffer_head *head) | |||
2510 | } | 2510 | } |
2511 | 2511 | ||
2512 | /* | 2512 | /* |
2513 | * Filesystems implementing the new truncate sequence should use the | 2513 | * On entry, the page is fully not uptodate. |
2514 | * _newtrunc postfix variant which won't incorrectly call vmtruncate. | 2514 | * On exit the page is fully uptodate in the areas outside (from,to) |
2515 | * The filesystem needs to handle block truncation upon failure. | 2515 | * The filesystem needs to handle block truncation upon failure. |
2516 | */ | 2516 | */ |
2517 | int nobh_write_begin_newtrunc(struct file *file, struct address_space *mapping, | 2517 | int nobh_write_begin(struct address_space *mapping, |
2518 | loff_t pos, unsigned len, unsigned flags, | 2518 | loff_t pos, unsigned len, unsigned flags, |
2519 | struct page **pagep, void **fsdata, | 2519 | struct page **pagep, void **fsdata, |
2520 | get_block_t *get_block) | 2520 | get_block_t *get_block) |
@@ -2547,7 +2547,7 @@ int nobh_write_begin_newtrunc(struct file *file, struct address_space *mapping, | |||
2547 | unlock_page(page); | 2547 | unlock_page(page); |
2548 | page_cache_release(page); | 2548 | page_cache_release(page); |
2549 | *pagep = NULL; | 2549 | *pagep = NULL; |
2550 | return block_write_begin_newtrunc(file, mapping, pos, len, | 2550 | return block_write_begin_newtrunc(NULL, mapping, pos, len, |
2551 | flags, pagep, fsdata, get_block); | 2551 | flags, pagep, fsdata, get_block); |
2552 | } | 2552 | } |
2553 | 2553 | ||
@@ -2654,35 +2654,6 @@ out_release: | |||
2654 | 2654 | ||
2655 | return ret; | 2655 | return ret; |
2656 | } | 2656 | } |
2657 | EXPORT_SYMBOL(nobh_write_begin_newtrunc); | ||
2658 | |||
2659 | /* | ||
2660 | * On entry, the page is fully not uptodate. | ||
2661 | * On exit the page is fully uptodate in the areas outside (from,to) | ||
2662 | */ | ||
2663 | int nobh_write_begin(struct file *file, struct address_space *mapping, | ||
2664 | loff_t pos, unsigned len, unsigned flags, | ||
2665 | struct page **pagep, void **fsdata, | ||
2666 | get_block_t *get_block) | ||
2667 | { | ||
2668 | int ret; | ||
2669 | |||
2670 | ret = nobh_write_begin_newtrunc(file, mapping, pos, len, flags, | ||
2671 | pagep, fsdata, get_block); | ||
2672 | |||
2673 | /* | ||
2674 | * prepare_write() may have instantiated a few blocks | ||
2675 | * outside i_size. Trim these off again. Don't need | ||
2676 | * i_size_read because we hold i_mutex. | ||
2677 | */ | ||
2678 | if (unlikely(ret)) { | ||
2679 | loff_t isize = mapping->host->i_size; | ||
2680 | if (pos + len > isize) | ||
2681 | vmtruncate(mapping->host, isize); | ||
2682 | } | ||
2683 | |||
2684 | return ret; | ||
2685 | } | ||
2686 | EXPORT_SYMBOL(nobh_write_begin); | 2657 | EXPORT_SYMBOL(nobh_write_begin); |
2687 | 2658 | ||
2688 | int nobh_write_end(struct file *file, struct address_space *mapping, | 2659 | int nobh_write_end(struct file *file, struct address_space *mapping, |