X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=fs%2Freiserfs%2Ffile.c;h=ad6fa964b0e7e892de207307223a71887d1bc6ac;hb=222f1d69183f10d70a37de5785698fe0aa363c12;hp=c9f178fb494f511207ca93b982e599f62d7f481d;hpb=6c89cce75c6f93088a5a2a25bb9674a9194592cc;p=linux-2.6 diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c index c9f178fb49..ad6fa964b0 100644 --- a/fs/reiserfs/file.c +++ b/fs/reiserfs/file.c @@ -49,7 +49,7 @@ static int reiserfs_file_release(struct inode *inode, struct file *filp) } reiserfs_write_lock(inode->i_sb); - down(&inode->i_sem); + mutex_lock(&inode->i_mutex); /* freeing preallocation only involves relogging blocks that * are already in the current transaction. preallocation gets * freed at the end of each transaction, so it is impossible for @@ -100,7 +100,7 @@ static int reiserfs_file_release(struct inode *inode, struct file *filp) err = reiserfs_truncate_file(inode, 0); } out: - up(&inode->i_sem); + mutex_unlock(&inode->i_mutex); reiserfs_write_unlock(inode->i_sb); return err; } @@ -251,12 +251,12 @@ static int reiserfs_allocate_blocks_for_region(struct reiserfs_transaction_handl blocks_to_allocate, blocks_to_allocate); if (res != CARRY_ON) { - res = -ENOSPC; + res = res == QUOTA_EXCEEDED ? -EDQUOT : -ENOSPC; pathrelse(&path); goto error_exit; } } else { - res = -ENOSPC; + res = res == QUOTA_EXCEEDED ? -EDQUOT : -ENOSPC; pathrelse(&path); goto error_exit; } @@ -667,7 +667,7 @@ static int reiserfs_allocate_blocks_for_region(struct reiserfs_transaction_handl if (th->t_trans_id) { int err; // update any changes we made to blk count - reiserfs_update_sd(th, inode); + mark_inode_dirty(inode); err = journal_end(th, inode->i_sb, JOURNAL_PER_BALANCE_CNT * 3 + 1 + @@ -855,17 +855,18 @@ static int reiserfs_submit_file_region_for_write(struct reiserfs_transaction_han if (th->t_trans_id) { reiserfs_write_lock(inode->i_sb); - reiserfs_update_sd(th, inode); // And update on-disk metadata + // this sets the proper flags for O_SYNC to trigger a commit + mark_inode_dirty(inode); reiserfs_write_unlock(inode->i_sb); } else - inode->i_sb->s_op->dirty_inode(inode); + mark_inode_dirty(inode); sd_update = 1; } if (th->t_trans_id) { reiserfs_write_lock(inode->i_sb); if (!sd_update) - reiserfs_update_sd(th, inode); + mark_inode_dirty(inode); status = journal_end(th, th->t_super, th->t_blocks_allocated); if (status) retval = status; @@ -1320,7 +1321,7 @@ static ssize_t reiserfs_file_write(struct file *file, /* the file we are going t return err; } reiserfs_update_inode_transaction(inode); - reiserfs_update_sd(&th, inode); + mark_inode_dirty(inode); err = journal_end(&th, inode->i_sb, 1); if (err) { reiserfs_write_unlock(inode->i_sb); @@ -1341,7 +1342,7 @@ static ssize_t reiserfs_file_write(struct file *file, /* the file we are going t if (unlikely(!access_ok(VERIFY_READ, buf, count))) return -EFAULT; - down(&inode->i_sem); // locks the entire file for just us + mutex_lock(&inode->i_mutex); // locks the entire file for just us pos = *ppos; @@ -1359,7 +1360,7 @@ static ssize_t reiserfs_file_write(struct file *file, /* the file we are going t if (res) goto out; - inode_update_time(inode, 1); /* Both mtime and ctime */ + file_update_time(file); // Ok, we are done with all the checks. @@ -1531,12 +1532,12 @@ static ssize_t reiserfs_file_write(struct file *file, /* the file we are going t generic_osync_inode(inode, file->f_mapping, OSYNC_METADATA | OSYNC_DATA); - up(&inode->i_sem); + mutex_unlock(&inode->i_mutex); reiserfs_async_progress_wait(inode->i_sb); return (already_written != 0) ? already_written : res; out: - up(&inode->i_sem); // unlock the file on exit. + mutex_unlock(&inode->i_mutex); // unlock the file on exit. return res; }