aboutsummaryrefslogtreecommitdiffstats
path: root/fs/reiserfs/inode.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@tglx.tec.linutronix.de>2005-06-26 17:20:36 -0400
committerThomas Gleixner <tglx@mtd.linutronix.de>2005-06-26 17:20:36 -0400
commit7ca6448dbfb398bba36eda3c01bc14b86c3675be (patch)
tree82d934ebf07f22a2c64c3b6d82ec24082878b43a /fs/reiserfs/inode.c
parentf1f67a9874f1a4bba1adff6d694aa52e5f52ff1a (diff)
parent7d681b23d6cc14a8c026ea6756242cb522cbbcae (diff)
Merge with rsync://fileserver/linux
Update to Linus latest
Diffstat (limited to 'fs/reiserfs/inode.c')
-rw-r--r--fs/reiserfs/inode.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index 2711dff1b7b4..289d864fe731 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -28,7 +28,7 @@ static int reiserfs_prepare_write(struct file *f, struct page *page,
28void reiserfs_delete_inode (struct inode * inode) 28void reiserfs_delete_inode (struct inode * inode)
29{ 29{
30 /* We need blocks for transaction + (user+group) quota update (possibly delete) */ 30 /* We need blocks for transaction + (user+group) quota update (possibly delete) */
31 int jbegin_count = JOURNAL_PER_BALANCE_CNT * 2 + 2 * REISERFS_QUOTA_INIT_BLOCKS; 31 int jbegin_count = JOURNAL_PER_BALANCE_CNT * 2 + 2 * REISERFS_QUOTA_INIT_BLOCKS(inode->i_sb);
32 struct reiserfs_transaction_handle th ; 32 struct reiserfs_transaction_handle th ;
33 33
34 reiserfs_write_lock(inode->i_sb); 34 reiserfs_write_lock(inode->i_sb);
@@ -254,6 +254,7 @@ static int _get_block_create_0 (struct inode * inode, long block,
254 char * p = NULL; 254 char * p = NULL;
255 int chars; 255 int chars;
256 int ret ; 256 int ret ;
257 int result ;
257 int done = 0 ; 258 int done = 0 ;
258 unsigned long offset ; 259 unsigned long offset ;
259 260
@@ -262,10 +263,13 @@ static int _get_block_create_0 (struct inode * inode, long block,
262 (loff_t)block * inode->i_sb->s_blocksize + 1, TYPE_ANY, 3); 263 (loff_t)block * inode->i_sb->s_blocksize + 1, TYPE_ANY, 3);
263 264
264research: 265research:
265 if (search_for_position_by_key (inode->i_sb, &key, &path) != POSITION_FOUND) { 266 result = search_for_position_by_key (inode->i_sb, &key, &path) ;
267 if (result != POSITION_FOUND) {
266 pathrelse (&path); 268 pathrelse (&path);
267 if (p) 269 if (p)
268 kunmap(bh_result->b_page) ; 270 kunmap(bh_result->b_page) ;
271 if (result == IO_ERROR)
272 return -EIO;
269 // We do not return -ENOENT if there is a hole but page is uptodate, because it means 273 // We do not return -ENOENT if there is a hole but page is uptodate, because it means
270 // That there is some MMAPED data associated with it that is yet to be written to disk. 274 // That there is some MMAPED data associated with it that is yet to be written to disk.
271 if ((args & GET_BLOCK_NO_HOLE) && !PageUptodate(bh_result->b_page) ) { 275 if ((args & GET_BLOCK_NO_HOLE) && !PageUptodate(bh_result->b_page) ) {
@@ -382,8 +386,9 @@ research:
382 386
383 // update key to look for the next piece 387 // update key to look for the next piece
384 set_cpu_key_k_offset (&key, cpu_key_k_offset (&key) + chars); 388 set_cpu_key_k_offset (&key, cpu_key_k_offset (&key) + chars);
385 if (search_for_position_by_key (inode->i_sb, &key, &path) != POSITION_FOUND) 389 result = search_for_position_by_key (inode->i_sb, &key, &path);
386 // we read something from tail, even if now we got IO_ERROR 390 if (result != POSITION_FOUND)
391 // i/o error most likely
387 break; 392 break;
388 bh = get_last_bh (&path); 393 bh = get_last_bh (&path);
389 ih = get_ih (&path); 394 ih = get_ih (&path);
@@ -394,6 +399,10 @@ research:
394 399
395finished: 400finished:
396 pathrelse (&path); 401 pathrelse (&path);
402
403 if (result == IO_ERROR)
404 return -EIO;
405
397 /* this buffer has valid data, but isn't valid for io. mapping it to 406 /* this buffer has valid data, but isn't valid for io. mapping it to
398 * block #0 tells the rest of reiserfs it just has a tail in it 407 * block #0 tells the rest of reiserfs it just has a tail in it
399 */ 408 */
@@ -591,7 +600,7 @@ int reiserfs_get_block (struct inode * inode, sector_t block,
591 XXX in practically impossible worst case direct2indirect() 600 XXX in practically impossible worst case direct2indirect()
592 can incur (much) more than 3 balancings. 601 can incur (much) more than 3 balancings.
593 quota update for user, group */ 602 quota update for user, group */
594 int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 1 + 2 * REISERFS_QUOTA_TRANS_BLOCKS; 603 int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 1 + 2 * REISERFS_QUOTA_TRANS_BLOCKS(inode->i_sb);
595 int version; 604 int version;
596 int dangle = 1; 605 int dangle = 1;
597 loff_t new_offset = (((loff_t)block) << inode->i_sb->s_blocksize_bits) + 1 ; 606 loff_t new_offset = (((loff_t)block) << inode->i_sb->s_blocksize_bits) + 1 ;
@@ -2796,12 +2805,15 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) {
2796 2805
2797 if (!error) { 2806 if (!error) {
2798 struct reiserfs_transaction_handle th; 2807 struct reiserfs_transaction_handle th;
2808 int jbegin_count = 2*(REISERFS_QUOTA_INIT_BLOCKS(inode->i_sb)+REISERFS_QUOTA_DEL_BLOCKS(inode->i_sb))+2;
2799 2809
2800 /* (user+group)*(old+new) structure - we count quota info and , inode write (sb, inode) */ 2810 /* (user+group)*(old+new) structure - we count quota info and , inode write (sb, inode) */
2801 journal_begin(&th, inode->i_sb, 4*REISERFS_QUOTA_INIT_BLOCKS+2); 2811 error = journal_begin(&th, inode->i_sb, jbegin_count);
2812 if (error)
2813 goto out;
2802 error = DQUOT_TRANSFER(inode, attr) ? -EDQUOT : 0; 2814 error = DQUOT_TRANSFER(inode, attr) ? -EDQUOT : 0;
2803 if (error) { 2815 if (error) {
2804 journal_end(&th, inode->i_sb, 4*REISERFS_QUOTA_INIT_BLOCKS+2); 2816 journal_end(&th, inode->i_sb, jbegin_count);
2805 goto out; 2817 goto out;
2806 } 2818 }
2807 /* Update corresponding info in inode so that everything is in 2819 /* Update corresponding info in inode so that everything is in
@@ -2811,7 +2823,7 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) {
2811 if (attr->ia_valid & ATTR_GID) 2823 if (attr->ia_valid & ATTR_GID)
2812 inode->i_gid = attr->ia_gid; 2824 inode->i_gid = attr->ia_gid;
2813 mark_inode_dirty(inode); 2825 mark_inode_dirty(inode);
2814 journal_end(&th, inode->i_sb, 4*REISERFS_QUOTA_INIT_BLOCKS+2); 2826 error = journal_end(&th, inode->i_sb, jbegin_count);
2815 } 2827 }
2816 } 2828 }
2817 if (!error) 2829 if (!error)