Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 253705
b: refs/heads/master
c: 5e7f233
h: refs/heads/master
i:
  253703: 790ca16
v: v3
  • Loading branch information
Anton Blanchard authored and Al Viro committed Jun 16, 2011
1 parent 307c284 commit 8b7211b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 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: 8aef18845266f5c05904c610088f2d1ed58f6be3
refs/heads/master: 5e7f23373bf9a853e9256e81e86724cdd0a33c29
21 changes: 9 additions & 12 deletions trunk/fs/afs/write.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,23 +84,21 @@ void afs_put_writeback(struct afs_writeback *wb)
* partly or wholly fill a page that's under preparation for writing
*/
static int afs_fill_page(struct afs_vnode *vnode, struct key *key,
loff_t pos, unsigned len, struct page *page)
loff_t pos, struct page *page)
{
loff_t i_size;
unsigned eof;
int ret;
int len;

_enter(",,%llu,%u", (unsigned long long)pos, len);

ASSERTCMP(len, <=, PAGE_CACHE_SIZE);
_enter(",,%llu", (unsigned long long)pos);

i_size = i_size_read(&vnode->vfs_inode);
if (pos + len > i_size)
eof = i_size;
if (pos + PAGE_CACHE_SIZE > i_size)
len = i_size - pos;
else
eof = PAGE_CACHE_SIZE;
len = PAGE_CACHE_SIZE;

ret = afs_vnode_fetch_data(vnode, key, 0, eof, page);
ret = afs_vnode_fetch_data(vnode, key, pos, len, page);
if (ret < 0) {
if (ret == -ENOENT) {
_debug("got NOENT from server"
Expand Down Expand Up @@ -153,9 +151,8 @@ int afs_write_begin(struct file *file, struct address_space *mapping,
*pagep = page;
/* page won't leak in error case: it eventually gets cleaned off LRU */

if (!PageUptodate(page)) {
_debug("not up to date");
ret = afs_fill_page(vnode, key, pos, len, page);
if (!PageUptodate(page) && len != PAGE_CACHE_SIZE) {
ret = afs_fill_page(vnode, key, index << PAGE_CACHE_SHIFT, page);
if (ret < 0) {
kfree(candidate);
_leave(" = %d [prep]", ret);
Expand Down

0 comments on commit 8b7211b

Please sign in to comment.