diff options
author | Christoph Hellwig <hch@lst.de> | 2010-06-04 05:29:56 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2010-08-09 16:47:31 -0400 |
commit | f4e420dc423148fba637af1ab618fa8896dfb2d6 (patch) | |
tree | df0e81f5f4b8448dd6b3929e5537dcc46e7d7dde /fs/sysv/itree.c | |
parent | 282dc178849882289d30e58b54be6b2799b351aa (diff) |
clean up write_begin usage for directories in pagecache
For filesystem that implement directories in pagecache we call
block_write_begin with an already allocated page for this code, while the
normal regular file write path uses the default block_write_begin behaviour.
Get rid of the __foofs_write_begin helper and opencode the normal write_begin
call in foofs_write_begin, while adding a new foofs_prepare_chunk helper for
the directory code. The added benefit is that foofs_prepare_chunk has
a much saner calling convention.
Note that the interruptible flag passed into block_write_begin is always
ignored if we already pass in a page (see next patch for details), and
we never were doing truncations of exessive blocks for this case either so we
can switch directly to block_write_begin_newtrunc.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/sysv/itree.c')
-rw-r--r-- | fs/sysv/itree.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/fs/sysv/itree.c b/fs/sysv/itree.c index f042eec464c2..4068f485cfd6 100644 --- a/fs/sysv/itree.c +++ b/fs/sysv/itree.c | |||
@@ -459,12 +459,10 @@ static int sysv_readpage(struct file *file, struct page *page) | |||
459 | return block_read_full_page(page,get_block); | 459 | return block_read_full_page(page,get_block); |
460 | } | 460 | } |
461 | 461 | ||
462 | int __sysv_write_begin(struct file *file, struct address_space *mapping, | 462 | int sysv_prepare_chunk(struct page *page, loff_t pos, unsigned len) |
463 | loff_t pos, unsigned len, unsigned flags, | ||
464 | struct page **pagep, void **fsdata) | ||
465 | { | 463 | { |
466 | return block_write_begin(file, mapping, pos, len, flags, pagep, fsdata, | 464 | return block_write_begin_newtrunc(NULL, page->mapping, pos, len, 0, |
467 | get_block); | 465 | &page, NULL, get_block); |
468 | } | 466 | } |
469 | 467 | ||
470 | static int sysv_write_begin(struct file *file, struct address_space *mapping, | 468 | static int sysv_write_begin(struct file *file, struct address_space *mapping, |
@@ -472,7 +470,8 @@ static int sysv_write_begin(struct file *file, struct address_space *mapping, | |||
472 | struct page **pagep, void **fsdata) | 470 | struct page **pagep, void **fsdata) |
473 | { | 471 | { |
474 | *pagep = NULL; | 472 | *pagep = NULL; |
475 | return __sysv_write_begin(file, mapping, pos, len, flags, pagep, fsdata); | 473 | return block_write_begin(file, mapping, pos, len, flags, pagep, fsdata, |
474 | get_block); | ||
476 | } | 475 | } |
477 | 476 | ||
478 | static sector_t sysv_bmap(struct address_space *mapping, sector_t block) | 477 | static sector_t sysv_bmap(struct address_space *mapping, sector_t block) |