aboutsummaryrefslogtreecommitdiffstats
path: root/fs/reiserfs
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2005-05-01 11:59:07 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-01 11:59:07 -0400
commit127144df4ce817ad648af15a3983c8d52aacf670 (patch)
treedf064ec8a482ac88686b8c183f4b99d1e769095d /fs/reiserfs
parent40be0c28b33ff0821594a3fa7126354dfe6eccd1 (diff)
[PATCH] Fix rewriting on a full reiserfs filesystem
Allow rewriting of a file and extending a file upto the end of the allocated block on a full filesystem. From: Chris Mason <mason@suse.com> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/reiserfs')
-rw-r--r--fs/reiserfs/file.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c
index 26950113af8c..f6860e83521d 100644
--- a/fs/reiserfs/file.c
+++ b/fs/reiserfs/file.c
@@ -1284,10 +1284,11 @@ static ssize_t reiserfs_file_write( struct file *file, /* the file we are going
1284 reiserfs_claim_blocks_to_be_allocated(inode->i_sb, num_pages << (PAGE_CACHE_SHIFT - inode->i_blkbits)); 1284 reiserfs_claim_blocks_to_be_allocated(inode->i_sb, num_pages << (PAGE_CACHE_SHIFT - inode->i_blkbits));
1285 reiserfs_write_unlock(inode->i_sb); 1285 reiserfs_write_unlock(inode->i_sb);
1286 1286
1287 if ( !num_pages ) { /* If we do not have enough space even for */ 1287 if ( !num_pages ) { /* If we do not have enough space even for a single page... */
1288 res = -ENOSPC; /* single page, return -ENOSPC */ 1288 if ( pos > inode->i_size+inode->i_sb->s_blocksize-(pos & (inode->i_sb->s_blocksize-1))) {
1289 if ( pos > (inode->i_size & (inode->i_sb->s_blocksize-1))) 1289 res = -ENOSPC;
1290 break; // In case we are writing past the file end, break. 1290 break; // In case we are writing past the end of the last file block, break.
1291 }
1291 // Otherwise we are possibly overwriting the file, so 1292 // Otherwise we are possibly overwriting the file, so
1292 // let's set write size to be equal or less than blocksize. 1293 // let's set write size to be equal or less than blocksize.
1293 // This way we get it correctly for file holes. 1294 // This way we get it correctly for file holes.