Commit 1f28681a authored by Artem Bityutskiy's avatar Artem Bityutskiy

UBIFS: remove unneeded function parameter

Simplify 'ubifs_jnl_write_inode()' by removing the 'deletion'
parameter which is not really needed because we may test
inode->i_nlink and check whether this is a deletion or not.
Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
parent fbfa6c88
...@@ -750,30 +750,25 @@ int ubifs_jnl_write_data(struct ubifs_info *c, const struct inode *inode, ...@@ -750,30 +750,25 @@ int ubifs_jnl_write_data(struct ubifs_info *c, const struct inode *inode,
* ubifs_jnl_write_inode - flush inode to the journal. * ubifs_jnl_write_inode - flush inode to the journal.
* @c: UBIFS file-system description object * @c: UBIFS file-system description object
* @inode: inode to flush * @inode: inode to flush
* @deletion: inode has been deleted
* *
* This function writes inode @inode to the journal. If the inode is * This function writes inode @inode to the journal. If the inode is
* synchronous, it also synchronizes the write-buffer. Returns zero in case of * synchronous, it also synchronizes the write-buffer. Returns zero in case of
* success and a negative error code in case of failure. * success and a negative error code in case of failure.
*/ */
int ubifs_jnl_write_inode(struct ubifs_info *c, const struct inode *inode, int ubifs_jnl_write_inode(struct ubifs_info *c, const struct inode *inode)
int deletion)
{ {
int err, len, lnum, offs, sync = 0; int err, lnum, offs;
struct ubifs_ino_node *ino; struct ubifs_ino_node *ino;
struct ubifs_inode *ui = ubifs_inode(inode); struct ubifs_inode *ui = ubifs_inode(inode);
int sync = 0, len = UBIFS_INO_NODE_SZ, last_reference = !inode->i_nlink;
dbg_jnl("ino %lu%s", inode->i_ino, dbg_jnl("ino %lu, nlink %u", inode->i_ino, inode->i_nlink);
deletion ? " (last reference)" : "");
if (deletion)
ubifs_assert(inode->i_nlink == 0);
len = UBIFS_INO_NODE_SZ;
/* /*
* If the inode is being deleted, do not write the attached data. No * If the inode is being deleted, do not write the attached data. No
* need to synchronize the write-buffer either. * need to synchronize the write-buffer either.
*/ */
if (!deletion) { if (!last_reference) {
len += ui->data_len; len += ui->data_len;
sync = IS_SYNC(inode); sync = IS_SYNC(inode);
} }
...@@ -786,7 +781,7 @@ int ubifs_jnl_write_inode(struct ubifs_info *c, const struct inode *inode, ...@@ -786,7 +781,7 @@ int ubifs_jnl_write_inode(struct ubifs_info *c, const struct inode *inode,
if (err) if (err)
goto out_free; goto out_free;
pack_inode(c, ino, inode, 1, deletion); pack_inode(c, ino, inode, 1, last_reference);
err = write_head(c, BASEHD, ino, len, &lnum, &offs, sync); err = write_head(c, BASEHD, ino, len, &lnum, &offs, sync);
if (err) if (err)
goto out_release; goto out_release;
...@@ -795,7 +790,7 @@ int ubifs_jnl_write_inode(struct ubifs_info *c, const struct inode *inode, ...@@ -795,7 +790,7 @@ int ubifs_jnl_write_inode(struct ubifs_info *c, const struct inode *inode,
inode->i_ino); inode->i_ino);
release_head(c, BASEHD); release_head(c, BASEHD);
if (deletion) { if (last_reference) {
err = ubifs_tnc_remove_ino(c, inode->i_ino); err = ubifs_tnc_remove_ino(c, inode->i_ino);
if (err) if (err)
goto out_ro; goto out_ro;
......
...@@ -306,7 +306,7 @@ static int ubifs_write_inode(struct inode *inode, int wait) ...@@ -306,7 +306,7 @@ static int ubifs_write_inode(struct inode *inode, int wait)
dbg_gen("inode %lu, mode %#x, nlink %u", dbg_gen("inode %lu, mode %#x, nlink %u",
inode->i_ino, (int)inode->i_mode, inode->i_nlink); inode->i_ino, (int)inode->i_mode, inode->i_nlink);
if (inode->i_nlink) { if (inode->i_nlink) {
err = ubifs_jnl_write_inode(c, inode, 0); err = ubifs_jnl_write_inode(c, inode);
if (err) if (err)
ubifs_err("can't write inode %lu, error %d", ubifs_err("can't write inode %lu, error %d",
inode->i_ino, err); inode->i_ino, err);
...@@ -341,7 +341,7 @@ static void ubifs_delete_inode(struct inode *inode) ...@@ -341,7 +341,7 @@ static void ubifs_delete_inode(struct inode *inode)
goto out; goto out;
ui->ui_size = inode->i_size = 0; ui->ui_size = inode->i_size = 0;
err = ubifs_jnl_write_inode(c, inode, 1); err = ubifs_jnl_write_inode(c, inode);
if (err) if (err)
/* /*
* Worst case we have a lost orphan inode wasting space, so a * Worst case we have a lost orphan inode wasting space, so a
......
...@@ -1400,8 +1400,7 @@ int ubifs_jnl_update(struct ubifs_info *c, const struct inode *dir, ...@@ -1400,8 +1400,7 @@ int ubifs_jnl_update(struct ubifs_info *c, const struct inode *dir,
int deletion, int xent); int deletion, int xent);
int ubifs_jnl_write_data(struct ubifs_info *c, const struct inode *inode, int ubifs_jnl_write_data(struct ubifs_info *c, const struct inode *inode,
const union ubifs_key *key, const void *buf, int len); const union ubifs_key *key, const void *buf, int len);
int ubifs_jnl_write_inode(struct ubifs_info *c, const struct inode *inode, int ubifs_jnl_write_inode(struct ubifs_info *c, const struct inode *inode);
int last_reference);
int ubifs_jnl_rename(struct ubifs_info *c, const struct inode *old_dir, int ubifs_jnl_rename(struct ubifs_info *c, const struct inode *old_dir,
const struct dentry *old_dentry, const struct dentry *old_dentry,
const struct inode *new_dir, const struct inode *new_dir,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment