]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
ocfs2: remove handle argument to ocfs2_start_trans()
authorMark Fasheh <mark.fasheh@oracle.com>
Tue, 10 Oct 2006 00:26:22 +0000 (17:26 -0700)
committerMark Fasheh <mark.fasheh@oracle.com>
Sat, 2 Dec 2006 02:28:23 +0000 (18:28 -0800)
All callers either pass in NULL directly, or a local variable that is
already set to NULL.

The internals of ocfs2_start_trans() get a nice cleanup as a result.

Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
fs/ocfs2/alloc.c
fs/ocfs2/aops.c
fs/ocfs2/dir.c
fs/ocfs2/file.c
fs/ocfs2/inode.c
fs/ocfs2/ioctl.c
fs/ocfs2/journal.c
fs/ocfs2/journal.h
fs/ocfs2/localalloc.c
fs/ocfs2/namei.c
fs/ocfs2/suballoc.c

index f3dbd31a85a1480f262c44d5daffaf7bcddf385b..354817acf8b381a8621c885ad094cd7ba0ee2b18 100644 (file)
@@ -1158,7 +1158,7 @@ static int __ocfs2_flush_truncate_log(struct ocfs2_super *osb)
                goto out_mutex;
        }
 
-       handle = ocfs2_start_trans(osb, NULL, OCFS2_TRUNCATE_LOG_UPDATE);
+       handle = ocfs2_start_trans(osb, OCFS2_TRUNCATE_LOG_UPDATE);
        if (IS_ERR(handle)) {
                status = PTR_ERR(handle);
                mlog_errno(status);
@@ -1365,8 +1365,7 @@ int ocfs2_complete_truncate_log_recovery(struct ocfs2_super *osb,
                        }
                }
 
-               handle = ocfs2_start_trans(osb, NULL,
-                                          OCFS2_TRUNCATE_LOG_UPDATE);
+               handle = ocfs2_start_trans(osb, OCFS2_TRUNCATE_LOG_UPDATE);
                if (IS_ERR(handle)) {
                        status = PTR_ERR(handle);
                        mlog_errno(status);
@@ -1860,7 +1859,7 @@ start:
 
        credits = ocfs2_calc_tree_trunc_credits(osb->sb, clusters_to_del,
                                                fe, el);
-       handle = ocfs2_start_trans(osb, NULL, credits);
+       handle = ocfs2_start_trans(osb, credits);
        if (IS_ERR(handle)) {
                status = PTR_ERR(handle);
                handle = NULL;
index c3693999694695fc4dddead542533a384de18861..fcdcdf6aa352f7073b9417e5a5faaf452455e307 100644 (file)
@@ -364,7 +364,7 @@ struct ocfs2_journal_handle *ocfs2_start_walk_page_trans(struct inode *inode,
        struct ocfs2_journal_handle *handle = NULL;
        int ret = 0;
 
-       handle = ocfs2_start_trans(osb, NULL, OCFS2_INODE_UPDATE_CREDITS);
+       handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
        if (!handle) {
                ret = -ENOMEM;
                mlog_errno(ret);
index 2bda5f345216f36654aaeee2cb56749c2beaa3c9..036c891c1e171204507fdc267167e5e1083fe895 100644 (file)
@@ -442,7 +442,7 @@ static int ocfs2_extend_dir(struct ocfs2_super *osb,
                credits = OCFS2_SIMPLE_DIR_EXTEND_CREDITS;
        }
 
-       handle = ocfs2_start_trans(osb, NULL, credits);
+       handle = ocfs2_start_trans(osb, credits);
        if (IS_ERR(handle)) {
                status = PTR_ERR(handle);
                handle = NULL;
index 9eb60f21968dbf2b357ba882315fa12a3c3bbbc2..100754de16b8ba110a535474583d39132cc224d0 100644 (file)
@@ -165,8 +165,7 @@ static int ocfs2_simple_size_update(struct inode *inode,
        struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
        struct ocfs2_journal_handle *handle = NULL;
 
-       handle = ocfs2_start_trans(osb, NULL,
-                                  OCFS2_INODE_UPDATE_CREDITS);
+       handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
        if (handle == NULL) {
                ret = -ENOMEM;
                mlog_errno(ret);
@@ -196,7 +195,7 @@ static int ocfs2_orphan_for_truncate(struct ocfs2_super *osb,
        /* TODO: This needs to actually orphan the inode in this
         * transaction. */
 
-       handle = ocfs2_start_trans(osb, NULL, OCFS2_INODE_UPDATE_CREDITS);
+       handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
        if (IS_ERR(handle)) {
                status = PTR_ERR(handle);
                mlog_errno(status);
@@ -496,7 +495,7 @@ restart_all:
        drop_alloc_sem = 1;
 
        credits = ocfs2_calc_extend_credits(osb->sb, fe, clusters_to_add);
-       handle = ocfs2_start_trans(osb, NULL, credits);
+       handle = ocfs2_start_trans(osb, credits);
        if (IS_ERR(handle)) {
                status = PTR_ERR(handle);
                handle = NULL;
@@ -832,7 +831,7 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
                }
        }
 
-       handle = ocfs2_start_trans(osb, NULL, OCFS2_INODE_UPDATE_CREDITS);
+       handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
        if (IS_ERR(handle)) {
                status = PTR_ERR(handle);
                mlog_errno(status);
@@ -905,7 +904,7 @@ static int ocfs2_write_remove_suid(struct inode *inode)
        mlog_entry("(Inode %llu, mode 0%o)\n",
                   (unsigned long long)oi->ip_blkno, inode->i_mode);
 
-       handle = ocfs2_start_trans(osb, NULL, OCFS2_INODE_UPDATE_CREDITS);
+       handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
        if (handle == NULL) {
                ret = -ENOMEM;
                mlog_errno(ret);
index 7708c63a35546ef7cf1f773bf3c14a99ccd8e3cd..ac78877ba14d5661397ecea4ff0b5891d620e4e4 100644 (file)
@@ -524,7 +524,7 @@ static int ocfs2_truncate_for_delete(struct ocfs2_super *osb,
        if (!fe->i_clusters)
                goto bail;
 
-       handle = ocfs2_start_trans(osb, handle, OCFS2_INODE_UPDATE_CREDITS);
+       handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
        if (IS_ERR(handle)) {
                status = PTR_ERR(handle);
                handle = NULL;
@@ -590,7 +590,7 @@ static int ocfs2_remove_inode(struct inode *inode,
                goto bail;
        }
 
-       handle = ocfs2_start_trans(osb, NULL, OCFS2_DELETE_INODE_CREDITS);
+       handle = ocfs2_start_trans(osb, OCFS2_DELETE_INODE_CREDITS);
        if (IS_ERR(handle)) {
                status = PTR_ERR(handle);
                mlog_errno(status);
index e927758e8cd392731ef74b0894de69e186858ca9..752735842b1d6bb1dff4d1171e6857687b3b046f 100644 (file)
@@ -67,7 +67,7 @@ static int ocfs2_set_inode_attr(struct inode *inode, unsigned flags,
        if (!S_ISDIR(inode->i_mode))
                flags &= ~OCFS2_DIRSYNC_FL;
 
-       handle = ocfs2_start_trans(osb, NULL, OCFS2_INODE_UPDATE_CREDITS);
+       handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
        if (IS_ERR(handle)) {
                status = PTR_ERR(handle);
                mlog_errno(status);
index 81fb917475fd70ba00b8c63d8592fea18cc8a864..6d9658b0c5db272a4c7b407dc5c635f72d79a71a 100644 (file)
@@ -129,20 +129,16 @@ static struct ocfs2_journal_handle *ocfs2_alloc_handle(struct ocfs2_super *osb)
  * you pass it a handle however, it may still return error, in which
  * case it has free'd the passed handle for you. */
 struct ocfs2_journal_handle *ocfs2_start_trans(struct ocfs2_super *osb,
-                                              struct ocfs2_journal_handle *handle,
                                               int max_buffs)
 {
        int ret;
        journal_t *journal = osb->journal->j_journal;
-
-       mlog_entry("(max_buffs = %d)\n", max_buffs);
+       struct ocfs2_journal_handle *handle;
 
        BUG_ON(!osb || !osb->journal->j_journal);
 
-       if (ocfs2_is_hard_readonly(osb)) {
-               ret = -EROFS;
-               goto done_free;
-       }
+       if (ocfs2_is_hard_readonly(osb))
+               return ERR_PTR(-EROFS);
 
        BUG_ON(osb->journal->j_state == OCFS2_JOURNAL_FREE);
        BUG_ON(max_buffs <= 0);
@@ -153,13 +149,11 @@ struct ocfs2_journal_handle *ocfs2_start_trans(struct ocfs2_super *osb,
                BUG();
        }
 
-       if (!handle)
-               handle = ocfs2_alloc_handle(osb);
+       handle = ocfs2_alloc_handle(osb);
        if (!handle) {
                ret = -ENOMEM;
-               mlog(ML_ERROR, "Failed to allocate memory for journal "
-                    "handle!\n");
-               goto done_free;
+               mlog_errno(ret);
+               return ERR_PTR(ret);
        }
 
        down_read(&osb->journal->j_trans_barrier);
@@ -168,6 +162,7 @@ struct ocfs2_journal_handle *ocfs2_start_trans(struct ocfs2_super *osb,
        handle->k_handle = journal_start(journal, max_buffs);
        if (IS_ERR(handle->k_handle)) {
                up_read(&osb->journal->j_trans_barrier);
+               kfree(handle);
 
                ret = PTR_ERR(handle->k_handle);
                handle->k_handle = NULL;
@@ -177,20 +172,12 @@ struct ocfs2_journal_handle *ocfs2_start_trans(struct ocfs2_super *osb,
                        ocfs2_abort(osb->sb, "Detected aborted journal");
                        ret = -EROFS;
                }
-               goto done_free;
+               return ERR_PTR(ret);
        }
 
        atomic_inc(&(osb->journal->j_num_trans));
 
-       mlog_exit_ptr(handle);
        return handle;
-
-done_free:
-       if (handle)
-               kfree(handle);
-
-       mlog_exit(ret);
-       return ERR_PTR(ret);
 }
 
 void ocfs2_commit_trans(struct ocfs2_super *osb,
index d96f61abd6685ebd60f6a66eecd0ce43041d8296..3c0d15c5e49c077f81401c72830877dac95861f2 100644 (file)
@@ -216,7 +216,6 @@ static inline void ocfs2_checkpoint_inode(struct inode *inode)
  * perfectly legal to go through an entire transaction without having
  * dirtied any buffers. */
 struct ocfs2_journal_handle *ocfs2_start_trans(struct ocfs2_super *osb,
-                                              struct ocfs2_journal_handle *handle,
                                               int max_buffs);
 void                        ocfs2_commit_trans(struct ocfs2_super *osb,
                                                struct ocfs2_journal_handle *handle);
index 9dd208dc5d7adbad6747143d52566807df0462be..2ae567a7042bbe46e923127d9a791272efbf2efa 100644 (file)
@@ -238,7 +238,7 @@ void ocfs2_shutdown_local_alloc(struct ocfs2_super *osb)
        }
 
        /* WINDOW_MOVE_CREDITS is a bit heavy... */
-       handle = ocfs2_start_trans(osb, NULL, OCFS2_WINDOW_MOVE_CREDITS);
+       handle = ocfs2_start_trans(osb, OCFS2_WINDOW_MOVE_CREDITS);
        if (IS_ERR(handle)) {
                mlog_errno(PTR_ERR(handle));
                handle = NULL;
@@ -405,7 +405,7 @@ int ocfs2_complete_local_alloc_recovery(struct ocfs2_super *osb,
                goto out_mutex;
        }
 
-       handle = ocfs2_start_trans(osb, NULL, OCFS2_WINDOW_MOVE_CREDITS);
+       handle = ocfs2_start_trans(osb, OCFS2_WINDOW_MOVE_CREDITS);
        if (IS_ERR(handle)) {
                status = PTR_ERR(handle);
                handle = NULL;
@@ -896,7 +896,7 @@ static int ocfs2_local_alloc_slide_window(struct ocfs2_super *osb,
                goto bail;
        }
 
-       handle = ocfs2_start_trans(osb, NULL, OCFS2_WINDOW_MOVE_CREDITS);
+       handle = ocfs2_start_trans(osb, OCFS2_WINDOW_MOVE_CREDITS);
        if (IS_ERR(handle)) {
                status = PTR_ERR(handle);
                handle = NULL;
index 9a56bfdf45c6cf69c8e46397e808c0f6303dc7b7..d63ab7be89a57914cc302d4bb4c8280eed3ba4b3 100644 (file)
@@ -379,7 +379,7 @@ static int ocfs2_mknod(struct inode *dir,
                }
        }
 
-       handle = ocfs2_start_trans(osb, NULL, OCFS2_MKNOD_CREDITS);
+       handle = ocfs2_start_trans(osb, OCFS2_MKNOD_CREDITS);
        if (IS_ERR(handle)) {
                status = PTR_ERR(handle);
                handle = NULL;
@@ -696,7 +696,7 @@ static int ocfs2_link(struct dentry *old_dentry,
                goto out_unlock_inode;
        }
 
-       handle = ocfs2_start_trans(osb, NULL, OCFS2_LINK_CREDITS);
+       handle = ocfs2_start_trans(osb, OCFS2_LINK_CREDITS);
        if (IS_ERR(handle)) {
                err = PTR_ERR(handle);
                handle = NULL;
@@ -886,7 +886,7 @@ static int ocfs2_unlink(struct inode *dir,
                }
        }
 
-       handle = ocfs2_start_trans(osb, NULL, OCFS2_UNLINK_CREDITS);
+       handle = ocfs2_start_trans(osb, OCFS2_UNLINK_CREDITS);
        if (IS_ERR(handle)) {
                status = PTR_ERR(handle);
                handle = NULL;
@@ -1284,7 +1284,7 @@ static int ocfs2_rename(struct inode *old_dir,
                }
        }
 
-       handle = ocfs2_start_trans(osb, NULL, OCFS2_RENAME_CREDITS);
+       handle = ocfs2_start_trans(osb, OCFS2_RENAME_CREDITS);
        if (IS_ERR(handle)) {
                status = PTR_ERR(handle);
                handle = NULL;
@@ -1652,7 +1652,7 @@ static int ocfs2_symlink(struct inode *dir,
                }
        }
 
-       handle = ocfs2_start_trans(osb, NULL, credits);
+       handle = ocfs2_start_trans(osb, credits);
        if (IS_ERR(handle)) {
                status = PTR_ERR(handle);
                handle = NULL;
index ea63a519167ddbdf2cbf4edf14f2f332d861ccbb..186d2c3d524dcc99a8d830e073eb2045dab4e867 100644 (file)
@@ -302,7 +302,7 @@ static int ocfs2_block_group_alloc(struct ocfs2_super *osb,
 
        credits = ocfs2_calc_group_alloc_credits(osb->sb,
                                                 le16_to_cpu(cl->cl_cpg));
-       handle = ocfs2_start_trans(osb, handle, credits);
+       handle = ocfs2_start_trans(osb, credits);
        if (IS_ERR(handle)) {
                status = PTR_ERR(handle);
                handle = NULL;