diff options
Diffstat (limited to 'fs/reiserfs/file.c')
-rw-r--r-- | fs/reiserfs/file.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c index 26950113af8c..2230afff1870 100644 --- a/fs/reiserfs/file.c +++ b/fs/reiserfs/file.c | |||
@@ -166,7 +166,7 @@ static int reiserfs_allocate_blocks_for_region( | |||
166 | struct cpu_key key; // cpu key of item that we are going to deal with | 166 | struct cpu_key key; // cpu key of item that we are going to deal with |
167 | struct item_head *ih; // pointer to item head that we are going to deal with | 167 | struct item_head *ih; // pointer to item head that we are going to deal with |
168 | struct buffer_head *bh; // Buffer head that contains items that we are going to deal with | 168 | struct buffer_head *bh; // Buffer head that contains items that we are going to deal with |
169 | __u32 * item; // pointer to item we are going to deal with | 169 | __le32 * item; // pointer to item we are going to deal with |
170 | INITIALIZE_PATH(path); // path to item, that we are going to deal with. | 170 | INITIALIZE_PATH(path); // path to item, that we are going to deal with. |
171 | b_blocknr_t *allocated_blocks; // Pointer to a place where allocated blocknumbers would be stored. | 171 | b_blocknr_t *allocated_blocks; // Pointer to a place where allocated blocknumbers would be stored. |
172 | reiserfs_blocknr_hint_t hint; // hint structure for block allocator. | 172 | reiserfs_blocknr_hint_t hint; // hint structure for block allocator. |
@@ -891,7 +891,7 @@ static int reiserfs_prepare_file_region_for_write( | |||
891 | struct item_head *ih = NULL; // pointer to item head that we are going to deal with | 891 | struct item_head *ih = NULL; // pointer to item head that we are going to deal with |
892 | struct buffer_head *itembuf=NULL; // Buffer head that contains items that we are going to deal with | 892 | struct buffer_head *itembuf=NULL; // Buffer head that contains items that we are going to deal with |
893 | INITIALIZE_PATH(path); // path to item, that we are going to deal with. | 893 | INITIALIZE_PATH(path); // path to item, that we are going to deal with. |
894 | __u32 * item=NULL; // pointer to item we are going to deal with | 894 | __le32 * item=NULL; // pointer to item we are going to deal with |
895 | int item_pos=-1; /* Position in indirect item */ | 895 | int item_pos=-1; /* Position in indirect item */ |
896 | 896 | ||
897 | 897 | ||
@@ -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. |