Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 155437
b: refs/heads/master
c: ffacfa7
h: refs/heads/master
i:
  155435: ad8ff7a
v: v3
  • Loading branch information
Jan Kara authored and Theodore Ts'o committed Jul 13, 2009
1 parent ba2b55e commit 8fa54fc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 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: f91d1d04171026e56c7e343ee3cdcc801dd85cfb
refs/heads/master: ffacfa7a79d6c00624196b2d13b0a7f72f2b8227
26 changes: 13 additions & 13 deletions trunk/fs/ext4/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1513,14 +1513,14 @@ static int ext4_write_begin(struct file *file, struct address_space *mapping,
* Add inode to orphan list in case we crash before
* truncate finishes
*/
if (pos + len > inode->i_size)
if (pos + len > inode->i_size && ext4_can_truncate(inode))
ext4_orphan_add(handle, inode);

ext4_journal_stop(handle);
if (pos + len > inode->i_size) {
vmtruncate(inode, inode->i_size);
ext4_truncate(inode);
/*
* If vmtruncate failed early the inode might
* If truncate failed early the inode might
* still be on the orphan list; we need to
* make sure the inode is removed from the
* orphan list in that case.
Expand Down Expand Up @@ -1614,7 +1614,7 @@ static int ext4_ordered_write_end(struct file *file,
ret2 = ext4_generic_write_end(file, mapping, pos, len, copied,
page, fsdata);
copied = ret2;
if (pos + len > inode->i_size)
if (pos + len > inode->i_size && ext4_can_truncate(inode))
/* if we have allocated more blocks and copied
* less. We will have blocks allocated outside
* inode->i_size. So truncate them
Expand All @@ -1628,9 +1628,9 @@ static int ext4_ordered_write_end(struct file *file,
ret = ret2;

if (pos + len > inode->i_size) {
vmtruncate(inode, inode->i_size);
ext4_truncate(inode);
/*
* If vmtruncate failed early the inode might still be
* If truncate failed early the inode might still be
* on the orphan list; we need to make sure the inode
* is removed from the orphan list in that case.
*/
Expand All @@ -1655,7 +1655,7 @@ static int ext4_writeback_write_end(struct file *file,
ret2 = ext4_generic_write_end(file, mapping, pos, len, copied,
page, fsdata);
copied = ret2;
if (pos + len > inode->i_size)
if (pos + len > inode->i_size && ext4_can_truncate(inode))
/* if we have allocated more blocks and copied
* less. We will have blocks allocated outside
* inode->i_size. So truncate them
Expand All @@ -1670,9 +1670,9 @@ static int ext4_writeback_write_end(struct file *file,
ret = ret2;

if (pos + len > inode->i_size) {
vmtruncate(inode, inode->i_size);
ext4_truncate(inode);
/*
* If vmtruncate failed early the inode might still be
* If truncate failed early the inode might still be
* on the orphan list; we need to make sure the inode
* is removed from the orphan list in that case.
*/
Expand Down Expand Up @@ -1722,7 +1722,7 @@ static int ext4_journalled_write_end(struct file *file,

unlock_page(page);
page_cache_release(page);
if (pos + len > inode->i_size)
if (pos + len > inode->i_size && ext4_can_truncate(inode))
/* if we have allocated more blocks and copied
* less. We will have blocks allocated outside
* inode->i_size. So truncate them
Expand All @@ -1733,9 +1733,9 @@ static int ext4_journalled_write_end(struct file *file,
if (!ret)
ret = ret2;
if (pos + len > inode->i_size) {
vmtruncate(inode, inode->i_size);
ext4_truncate(inode);
/*
* If vmtruncate failed early the inode might still be
* If truncate failed early the inode might still be
* on the orphan list; we need to make sure the inode
* is removed from the orphan list in that case.
*/
Expand Down Expand Up @@ -2907,7 +2907,7 @@ static int ext4_da_write_begin(struct file *file, struct address_space *mapping,
* i_size_read because we hold i_mutex.
*/
if (pos + len > inode->i_size)
vmtruncate(inode, inode->i_size);
ext4_truncate(inode);
}

if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))
Expand Down

0 comments on commit 8fa54fc

Please sign in to comment.