Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 207511
b: refs/heads/master
c: ea0f04e
h: refs/heads/master
i:
  207509: acc1e4b
  207507: f47be26
  207503: 02ede99
v: v3
  • Loading branch information
Christoph Hellwig authored and Al Viro committed Aug 9, 2010
1 parent a29f1a2 commit 4c8af09
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 47 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: eafdc7d190a944c755a9fe68573c193e6e0217e7
refs/heads/master: ea0f04e59543bafb3d2cbe37a0d375acb0bb2c34
37 changes: 4 additions & 33 deletions trunk/fs/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -2510,11 +2510,11 @@ static void attach_nobh_buffers(struct page *page, struct buffer_head *head)
}

/*
* Filesystems implementing the new truncate sequence should use the
* _newtrunc postfix variant which won't incorrectly call vmtruncate.
* On entry, the page is fully not uptodate.
* On exit the page is fully uptodate in the areas outside (from,to)
* The filesystem needs to handle block truncation upon failure.
*/
int nobh_write_begin_newtrunc(struct file *file, struct address_space *mapping,
int nobh_write_begin(struct address_space *mapping,
loff_t pos, unsigned len, unsigned flags,
struct page **pagep, void **fsdata,
get_block_t *get_block)
Expand Down Expand Up @@ -2547,7 +2547,7 @@ int nobh_write_begin_newtrunc(struct file *file, struct address_space *mapping,
unlock_page(page);
page_cache_release(page);
*pagep = NULL;
return block_write_begin_newtrunc(file, mapping, pos, len,
return block_write_begin_newtrunc(NULL, mapping, pos, len,
flags, pagep, fsdata, get_block);
}

Expand Down Expand Up @@ -2654,35 +2654,6 @@ int nobh_write_begin_newtrunc(struct file *file, struct address_space *mapping,

return ret;
}
EXPORT_SYMBOL(nobh_write_begin_newtrunc);

/*
* On entry, the page is fully not uptodate.
* On exit the page is fully uptodate in the areas outside (from,to)
*/
int nobh_write_begin(struct file *file, struct address_space *mapping,
loff_t pos, unsigned len, unsigned flags,
struct page **pagep, void **fsdata,
get_block_t *get_block)
{
int ret;

ret = nobh_write_begin_newtrunc(file, mapping, pos, len, flags,
pagep, fsdata, get_block);

/*
* prepare_write() may have instantiated a few blocks
* outside i_size. Trim these off again. Don't need
* i_size_read because we hold i_mutex.
*/
if (unlikely(ret)) {
loff_t isize = mapping->host->i_size;
if (pos + len > isize)
vmtruncate(mapping->host, isize);
}

return ret;
}
EXPORT_SYMBOL(nobh_write_begin);

int nobh_write_end(struct file *file, struct address_space *mapping,
Expand Down
9 changes: 2 additions & 7 deletions trunk/fs/ext2/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -806,13 +806,8 @@ ext2_nobh_write_begin(struct file *file, struct address_space *mapping,
{
int ret;

/*
* Dir-in-pagecache still uses ext2_write_begin. Would have to rework
* directory handling code to pass around offsets rather than struct
* pages in order to make this work easily.
*/
ret = nobh_write_begin_newtrunc(file, mapping, pos, len, flags, pagep,
fsdata, ext2_get_block);
ret = nobh_write_begin(mapping, pos, len, flags, pagep, fsdata,
ext2_get_block);
if (ret < 0)
ext2_write_failed(mapping, pos + len);
return ret;
Expand Down
11 changes: 10 additions & 1 deletion trunk/fs/jfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,17 @@ static int jfs_write_begin(struct file *file, struct address_space *mapping,
loff_t pos, unsigned len, unsigned flags,
struct page **pagep, void **fsdata)
{
return nobh_write_begin(file, mapping, pos, len, flags, pagep, fsdata,
int ret;

ret = nobh_write_begin(mapping, pos, len, flags, pagep, fsdata,
jfs_get_block);
if (unlikely(ret)) {
loff_t isize = mapping->host->i_size;
if (pos + len > isize)
vmtruncate(mapping->host, isize);
}

return ret;
}

static sector_t jfs_bmap(struct address_space *mapping, sector_t block)
Expand Down
6 changes: 1 addition & 5 deletions trunk/include/linux/buffer_head.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,7 @@ void block_sync_page(struct page *);
sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *);
int block_truncate_page(struct address_space *, loff_t, get_block_t *);
int file_fsync(struct file *, int);
int nobh_write_begin_newtrunc(struct file *, struct address_space *,
loff_t, unsigned, unsigned,
struct page **, void **, get_block_t*);
int nobh_write_begin(struct file *, struct address_space *,
loff_t, unsigned, unsigned,
int nobh_write_begin(struct address_space *, loff_t, unsigned, unsigned,
struct page **, void **, get_block_t*);
int nobh_write_end(struct file *, struct address_space *,
loff_t, unsigned, unsigned,
Expand Down

0 comments on commit 4c8af09

Please sign in to comment.