Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 347792
b: refs/heads/master
c: 83f6e37
h: refs/heads/master
v: v3
  • Loading branch information
Marco Stornelli authored and Al Viro committed Dec 20, 2012
1 parent 9234429 commit d82376b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 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: 72651cac884b1e285fa8e8314b10e9f1b8458802
refs/heads/master: 83f6e3710a932d400100767ad445a4bd9476e083
15 changes: 10 additions & 5 deletions trunk/fs/ufs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,14 @@ int ufs_prepare_chunk(struct page *page, loff_t pos, unsigned len)
return __block_write_begin(page, pos, len, ufs_getfrag_block);
}

static void ufs_write_failed(struct address_space *mapping, loff_t to)
{
struct inode *inode = mapping->host;

if (to > inode->i_size)
truncate_pagecache(inode, to, inode->i_size);
}

static int ufs_write_begin(struct file *file, struct address_space *mapping,
loff_t pos, unsigned len, unsigned flags,
struct page **pagep, void **fsdata)
Expand All @@ -534,11 +542,8 @@ static int ufs_write_begin(struct file *file, struct address_space *mapping,

ret = block_write_begin(mapping, pos, len, flags, pagep,
ufs_getfrag_block);
if (unlikely(ret)) {
loff_t isize = mapping->host->i_size;
if (pos + len > isize)
vmtruncate(mapping->host, isize);
}
if (unlikely(ret))
ufs_write_failed(mapping, pos + len);

return ret;
}
Expand Down

0 comments on commit d82376b

Please sign in to comment.