aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-07-22 05:06:13 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-08-13 04:26:25 -0400
commit1f28681ad34a0c7e51dc5070c84b53f7bd34f44c (patch)
tree11f5d3142a76e2e6723c7ae8612ba81cef446249
parentfbfa6c884aae2aff479eb8c996c564b1a34eae30 (diff)
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: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
-rw-r--r--fs/ubifs/journal.c19
-rw-r--r--fs/ubifs/super.c4
-rw-r--r--fs/ubifs/ubifs.h3
3 files changed, 10 insertions, 16 deletions
diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c
index 283155abe5f5..666ad82ec51a 100644
--- a/fs/ubifs/journal.c
+++ b/fs/ubifs/journal.c
@@ -750,30 +750,25 @@ out_free:
750 * ubifs_jnl_write_inode - flush inode to the journal. 750 * ubifs_jnl_write_inode - flush inode to the journal.
751 * @c: UBIFS file-system description object 751 * @c: UBIFS file-system description object
752 * @inode: inode to flush 752 * @inode: inode to flush
753 * @deletion: inode has been deleted
754 * 753 *
755 * This function writes inode @inode to the journal. If the inode is 754 * This function writes inode @inode to the journal. If the inode is
756 * synchronous, it also synchronizes the write-buffer. Returns zero in case of 755 * synchronous, it also synchronizes the write-buffer. Returns zero in case of
757 * success and a negative error code in case of failure. 756 * success and a negative error code in case of failure.
758 */ 757 */
759int ubifs_jnl_write_inode(struct ubifs_info *c, const struct inode *inode, 758int ubifs_jnl_write_inode(struct ubifs_info *c, const struct inode *inode)
760 int deletion)
761{ 759{
762 int err, len, lnum, offs, sync = 0; 760 int err, lnum, offs;
763 struct ubifs_ino_node *ino; 761 struct ubifs_ino_node *ino;
764 struct ubifs_inode *ui = ubifs_inode(inode); 762 struct ubifs_inode *ui = ubifs_inode(inode);
763 int sync = 0, len = UBIFS_INO_NODE_SZ, last_reference = !inode->i_nlink;
765 764
766 dbg_jnl("ino %lu%s", inode->i_ino, 765 dbg_jnl("ino %lu, nlink %u", inode->i_ino, inode->i_nlink);
767 deletion ? " (last reference)" : "");
768 if (deletion)
769 ubifs_assert(inode->i_nlink == 0);
770 766
771 len = UBIFS_INO_NODE_SZ;
772 /* 767 /*
773 * If the inode is being deleted, do not write the attached data. No 768 * If the inode is being deleted, do not write the attached data. No
774 * need to synchronize the write-buffer either. 769 * need to synchronize the write-buffer either.
775 */ 770 */
776 if (!deletion) { 771 if (!last_reference) {
777 len += ui->data_len; 772 len += ui->data_len;
778 sync = IS_SYNC(inode); 773 sync = IS_SYNC(inode);
779 } 774 }
@@ -786,7 +781,7 @@ int ubifs_jnl_write_inode(struct ubifs_info *c, const struct inode *inode,
786 if (err) 781 if (err)
787 goto out_free; 782 goto out_free;
788 783
789 pack_inode(c, ino, inode, 1, deletion); 784 pack_inode(c, ino, inode, 1, last_reference);
790 err = write_head(c, BASEHD, ino, len, &lnum, &offs, sync); 785 err = write_head(c, BASEHD, ino, len, &lnum, &offs, sync);
791 if (err) 786 if (err)
792 goto out_release; 787 goto out_release;
@@ -795,7 +790,7 @@ int ubifs_jnl_write_inode(struct ubifs_info *c, const struct inode *inode,
795 inode->i_ino); 790 inode->i_ino);
796 release_head(c, BASEHD); 791 release_head(c, BASEHD);
797 792
798 if (deletion) { 793 if (last_reference) {
799 err = ubifs_tnc_remove_ino(c, inode->i_ino); 794 err = ubifs_tnc_remove_ino(c, inode->i_ino);
800 if (err) 795 if (err)
801 goto out_ro; 796 goto out_ro;
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 13e90b0dd95d..cf1fb6cffa09 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -306,7 +306,7 @@ static int ubifs_write_inode(struct inode *inode, int wait)
306 dbg_gen("inode %lu, mode %#x, nlink %u", 306 dbg_gen("inode %lu, mode %#x, nlink %u",
307 inode->i_ino, (int)inode->i_mode, inode->i_nlink); 307 inode->i_ino, (int)inode->i_mode, inode->i_nlink);
308 if (inode->i_nlink) { 308 if (inode->i_nlink) {
309 err = ubifs_jnl_write_inode(c, inode, 0); 309 err = ubifs_jnl_write_inode(c, inode);
310 if (err) 310 if (err)
311 ubifs_err("can't write inode %lu, error %d", 311 ubifs_err("can't write inode %lu, error %d",
312 inode->i_ino, err); 312 inode->i_ino, err);
@@ -341,7 +341,7 @@ static void ubifs_delete_inode(struct inode *inode)
341 goto out; 341 goto out;
342 342
343 ui->ui_size = inode->i_size = 0; 343 ui->ui_size = inode->i_size = 0;
344 err = ubifs_jnl_write_inode(c, inode, 1); 344 err = ubifs_jnl_write_inode(c, inode);
345 if (err) 345 if (err)
346 /* 346 /*
347 * Worst case we have a lost orphan inode wasting space, so a 347 * Worst case we have a lost orphan inode wasting space, so a
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index c488d43b6359..6ddd1de2ea64 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -1400,8 +1400,7 @@ int ubifs_jnl_update(struct ubifs_info *c, const struct inode *dir,
1400 int deletion, int xent); 1400 int deletion, int xent);
1401int ubifs_jnl_write_data(struct ubifs_info *c, const struct inode *inode, 1401int ubifs_jnl_write_data(struct ubifs_info *c, const struct inode *inode,
1402 const union ubifs_key *key, const void *buf, int len); 1402 const union ubifs_key *key, const void *buf, int len);
1403int ubifs_jnl_write_inode(struct ubifs_info *c, const struct inode *inode, 1403int ubifs_jnl_write_inode(struct ubifs_info *c, const struct inode *inode);
1404 int last_reference);
1405int ubifs_jnl_rename(struct ubifs_info *c, const struct inode *old_dir, 1404int ubifs_jnl_rename(struct ubifs_info *c, const struct inode *old_dir,
1406 const struct dentry *old_dentry, 1405 const struct dentry *old_dentry,
1407 const struct inode *new_dir, 1406 const struct inode *new_dir,