Skip to content

Commit

Permalink
reiserfs: cleanup, remove nblocks argument from journal_end
Browse files Browse the repository at this point in the history
journal_end takes a block count argument but doesn't actually use it
for anything. We can remove it.

Signed-off-by: Jeff Mahoney <[email protected]>
Signed-off-by: Jan Kara <[email protected]>
  • Loading branch information
jeffmahoney authored and jankara committed May 6, 2014
1 parent 098297b commit 706a532
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 90 deletions.
4 changes: 2 additions & 2 deletions fs/reiserfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ static int reiserfs_file_release(struct inode *inode, struct file *filp)
#ifdef REISERFS_PREALLOCATE
reiserfs_discard_prealloc(&th, inode);
#endif
err = journal_end(&th, inode->i_sb, 1);
err = journal_end(&th, inode->i_sb);

/* copy back the error code from journal_begin */
if (!err)
Expand Down Expand Up @@ -227,7 +227,7 @@ int reiserfs_commit_page(struct inode *inode, struct page *page,
}
}
if (logit) {
ret = journal_end(&th, s, bh_per_page + 1);
ret = journal_end(&th, s);
drop_write_lock:
reiserfs_write_unlock(s);
}
Expand Down
33 changes: 15 additions & 18 deletions fs/reiserfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void reiserfs_evict_inode(struct inode *inode)
reiserfs_write_lock_nested(inode->i_sb, depth);
}

if (journal_end(&th, inode->i_sb, jbegin_count))
if (journal_end(&th, inode->i_sb))
goto out;

/*
Expand Down Expand Up @@ -252,7 +252,6 @@ static int restart_transaction(struct reiserfs_transaction_handle *th,
struct inode *inode, struct treepath *path)
{
struct super_block *s = th->t_super;
int len = th->t_blocks_allocated;
int err;

BUG_ON(!th->t_trans_id);
Expand All @@ -265,7 +264,7 @@ static int restart_transaction(struct reiserfs_transaction_handle *th,
return 0;
}
reiserfs_update_sd(th, inode);
err = journal_end(th, s, len);
err = journal_end(th, s);
if (!err) {
err = journal_begin(th, s, JOURNAL_PER_BALANCE_CNT * 6);
if (!err)
Expand Down Expand Up @@ -1791,7 +1790,7 @@ int reiserfs_write_inode(struct inode *inode, struct writeback_control *wbc)
reiserfs_write_lock(inode->i_sb);
if (!journal_begin(&th, inode->i_sb, jbegin_count)) {
reiserfs_update_sd(&th, inode);
journal_end_sync(&th, inode->i_sb, jbegin_count);
journal_end_sync(&th, inode->i_sb);
}
reiserfs_write_unlock(inode->i_sb);
}
Expand Down Expand Up @@ -2098,7 +2097,7 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
if (retval) {
err = retval;
reiserfs_check_path(&path_to_key);
journal_end(th, th->t_super, th->t_blocks_allocated);
journal_end(th, th->t_super);
goto out_inserted_sd;
}

Expand All @@ -2109,7 +2108,7 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
if (retval) {
err = retval;
reiserfs_check_path(&path_to_key);
journal_end(th, th->t_super, th->t_blocks_allocated);
journal_end(th, th->t_super);
goto out_inserted_sd;
}
} else if (inode->i_sb->s_flags & MS_POSIXACL) {
Expand All @@ -2126,8 +2125,7 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
if (retval) {
err = retval;
reiserfs_check_path(&path_to_key);
retval = journal_end(th, th->t_super,
th->t_blocks_allocated);
retval = journal_end(th, th->t_super);
if (retval)
err = retval;
goto out_inserted_sd;
Expand All @@ -2149,7 +2147,7 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
reiserfs_write_lock_nested(inode->i_sb, depth);

out_end_trans:
journal_end(th, th->t_super, th->t_blocks_allocated);
journal_end(th, th->t_super);
/*
* Drop can be outside and it needs more credits so it's better
* to have it outside
Expand Down Expand Up @@ -2319,8 +2317,7 @@ int reiserfs_truncate_file(struct inode *inode, int update_timestamps)
*/
add_save_link(&th, inode, 1);
err2 = reiserfs_do_truncate(&th, inode, page, update_timestamps);
error =
journal_end(&th, inode->i_sb, JOURNAL_PER_BALANCE_CNT * 2 + 1);
error = journal_end(&th, inode->i_sb);
if (error)
goto out;

Expand Down Expand Up @@ -2483,7 +2480,7 @@ static int map_block_for_writepage(struct inode *inode,
out:
pathrelse(&path);
if (trans_running) {
int err = journal_end(&th, inode->i_sb, jbegin_count);
int err = journal_end(&th, inode->i_sb);
if (err)
retval = err;
trans_running = 0;
Expand Down Expand Up @@ -2653,7 +2650,7 @@ static int reiserfs_write_full_page(struct page *page,
} while ((bh = bh->b_this_page) != head);

if (checked) {
error = journal_end(&th, s, bh_per_page + 1);
error = journal_end(&th, s);
reiserfs_write_unlock(s);
if (error)
goto fail;
Expand Down Expand Up @@ -2956,7 +2953,7 @@ static int reiserfs_write_end(struct file *file, struct address_space *mapping,
mark_inode_dirty(inode);
reiserfs_update_sd(&myth, inode);
update_sd = 1;
ret = journal_end(&myth, inode->i_sb, 1);
ret = journal_end(&myth, inode->i_sb);
if (ret)
goto journal_error;
}
Expand Down Expand Up @@ -3045,7 +3042,7 @@ int reiserfs_commit_write(struct file *f, struct page *page,
mark_inode_dirty(inode);
reiserfs_update_sd(&myth, inode);
update_sd = 1;
ret = journal_end(&myth, inode->i_sb, 1);
ret = journal_end(&myth, inode->i_sb);
if (ret)
goto journal_error;
}
Expand Down Expand Up @@ -3349,7 +3346,7 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
err = journal_begin(&th, inode->i_sb, 4);
if (!err) {
reiserfs_discard_prealloc(&th, inode);
err = journal_end(&th, inode->i_sb, 4);
err = journal_end(&th, inode->i_sb);
}
if (err)
error = err;
Expand Down Expand Up @@ -3401,7 +3398,7 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
error = dquot_transfer(inode, attr);
reiserfs_write_lock(inode->i_sb);
if (error) {
journal_end(&th, inode->i_sb, jbegin_count);
journal_end(&th, inode->i_sb);
reiserfs_write_unlock(inode->i_sb);
goto out;
}
Expand All @@ -3415,7 +3412,7 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
if (attr->ia_valid & ATTR_GID)
inode->i_gid = attr->ia_gid;
mark_inode_dirty(inode);
error = journal_end(&th, inode->i_sb, jbegin_count);
error = journal_end(&th, inode->i_sb);
reiserfs_write_unlock(inode->i_sb);
if (error)
goto out;
Expand Down
38 changes: 17 additions & 21 deletions fs/reiserfs/journal.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@
#define WAIT 4 /* wait for the log blocks to hit the disk */

static int do_journal_end(struct reiserfs_transaction_handle *,
struct super_block *, unsigned long nblocks,
int flags);
struct super_block *, int flags);
static int flush_journal_list(struct super_block *s,
struct reiserfs_journal_list *jl, int flushall);
static int flush_commit_list(struct super_block *s,
Expand Down Expand Up @@ -1921,7 +1920,7 @@ static int do_journal_release(struct reiserfs_transaction_handle *th,
if (!error && !(sb->s_flags & MS_RDONLY)) {
/* end the current trans */
BUG_ON(!th->t_trans_id);
do_journal_end(th, sb, 10, FLUSH_ALL);
do_journal_end(th, sb, FLUSH_ALL);

/*
* make sure something gets logged to force
Expand All @@ -1933,7 +1932,7 @@ static int do_journal_release(struct reiserfs_transaction_handle *th,
1);
journal_mark_dirty(&myth, sb,
SB_BUFFER_WITH_SB(sb));
do_journal_end(&myth, sb, 1, FLUSH_ALL);
do_journal_end(&myth, sb, FLUSH_ALL);
flushed = 1;
}
}
Expand All @@ -1947,7 +1946,7 @@ static int do_journal_release(struct reiserfs_transaction_handle *th,
1);
journal_mark_dirty(&myth, sb,
SB_BUFFER_WITH_SB(sb));
do_journal_end(&myth, sb, 1, FLUSH_ALL);
do_journal_end(&myth, sb, FLUSH_ALL);
}
}

Expand Down Expand Up @@ -3102,9 +3101,9 @@ static int do_journal_begin_r(struct reiserfs_transaction_handle *th,

/* someone might have ended the transaction while we joined */
if (old_trans_id != journal->j_trans_id) {
retval = do_journal_end(&myth, sb, 1, 0);
retval = do_journal_end(&myth, sb, 0);
} else {
retval = do_journal_end(&myth, sb, 1, COMMIT_NOW);
retval = do_journal_end(&myth, sb, COMMIT_NOW);
}

if (retval)
Expand Down Expand Up @@ -3174,7 +3173,7 @@ int reiserfs_end_persistent_transaction(struct reiserfs_transaction_handle *th)
struct super_block *s = th->t_super;
int ret = 0;
if (th->t_trans_id)
ret = journal_end(th, th->t_super, th->t_blocks_allocated);
ret = journal_end(th, th->t_super);
else
ret = -EIO;
if (th->t_refcount == 0) {
Expand Down Expand Up @@ -3375,8 +3374,7 @@ int journal_mark_dirty(struct reiserfs_transaction_handle *th,
return 0;
}

int journal_end(struct reiserfs_transaction_handle *th,
struct super_block *sb, unsigned long nblocks)
int journal_end(struct reiserfs_transaction_handle *th, struct super_block *sb)
{
if (!current->journal_info && th->t_refcount > 1)
reiserfs_warning(sb, "REISER-NESTING",
Expand Down Expand Up @@ -3404,7 +3402,7 @@ int journal_end(struct reiserfs_transaction_handle *th,
}
return 0;
} else {
return do_journal_end(th, sb, nblocks, 0);
return do_journal_end(th, sb, 0);
}
}

Expand Down Expand Up @@ -3514,7 +3512,7 @@ static int can_dirty(struct reiserfs_journal_cnode *cn)
* will wait until the current transaction is done/committed before returning
*/
int journal_end_sync(struct reiserfs_transaction_handle *th,
struct super_block *sb, unsigned long nblocks)
struct super_block *sb)
{
struct reiserfs_journal *journal = SB_JOURNAL(sb);

Expand All @@ -3526,7 +3524,7 @@ int journal_end_sync(struct reiserfs_transaction_handle *th,
1);
journal_mark_dirty(th, sb, SB_BUFFER_WITH_SB(sb));
}
return do_journal_end(th, sb, nblocks, COMMIT_NOW | WAIT);
return do_journal_end(th, sb, COMMIT_NOW | WAIT);
}

/* writeback the pending async commits to disk */
Expand Down Expand Up @@ -3586,7 +3584,7 @@ void reiserfs_flush_old_commits(struct super_block *sb)
* no sense to do an async commit so that kreiserfsd
* can do it later
*/
do_journal_end(&th, sb, 1, COMMIT_NOW | WAIT);
do_journal_end(&th, sb, COMMIT_NOW | WAIT);
}
}
}
Expand All @@ -3607,8 +3605,7 @@ void reiserfs_flush_old_commits(struct super_block *sb)
* writers in the log.
*/
static int check_journal_end(struct reiserfs_transaction_handle *th,
struct super_block *sb, unsigned long nblocks,
int flags)
struct super_block *sb, int flags)
{

time_t now;
Expand Down Expand Up @@ -3867,11 +3864,11 @@ static int __commit_trans_jl(struct inode *inode, unsigned long id,
reiserfs_prepare_for_journal(sb, SB_BUFFER_WITH_SB(sb),
1);
journal_mark_dirty(&th, sb, SB_BUFFER_WITH_SB(sb));
ret = journal_end(&th, sb, 1);
ret = journal_end(&th, sb);
goto flush_commit_only;
}

ret = journal_end_sync(&th, sb, 1);
ret = journal_end_sync(&th, sb);
if (!ret)
ret = 1;

Expand Down Expand Up @@ -3978,8 +3975,7 @@ int reiserfs_prepare_for_journal(struct super_block *sb,
* journal lists, etc just won't happen.
*/
static int do_journal_end(struct reiserfs_transaction_handle *th,
struct super_block *sb, unsigned long nblocks,
int flags)
struct super_block *sb, int flags)
{
struct reiserfs_journal *journal = SB_JOURNAL(sb);
struct reiserfs_journal_cnode *cn, *next, *jl_cn;
Expand Down Expand Up @@ -4035,7 +4031,7 @@ static int do_journal_end(struct reiserfs_transaction_handle *th,
* not return 1 it tells us if we should continue with the
* journal_end, or just return
*/
if (!check_journal_end(th, sb, nblocks, flags)) {
if (!check_journal_end(th, sb, flags)) {
reiserfs_schedule_old_flush(sb);
wake_queued_writers(sb);
reiserfs_async_progress_wait(sb);
Expand Down
Loading

0 comments on commit 706a532

Please sign in to comment.