ocfs2: Remove unused structure field
[cascardo/linux.git] / fs / ocfs2 / alloc.c
index 778a850..c91706f 100644 (file)
@@ -354,7 +354,6 @@ struct ocfs2_insert_type {
        enum ocfs2_append_type  ins_appending;
        enum ocfs2_contig_type  ins_contig;
        int                     ins_contig_index;
-       int                     ins_free_records;
        int                     ins_tree_depth;
 };
 
@@ -362,7 +361,6 @@ struct ocfs2_merge_ctxt {
        enum ocfs2_contig_type  c_contig_type;
        int                     c_has_empty_extent;
        int                     c_split_covers_rec;
-       int                     c_used_tail_recs;
 };
 
 /*
@@ -2808,36 +2806,28 @@ static int ocfs2_try_to_merge_extent(struct inode *inode,
                                     struct ocfs2_merge_ctxt *ctxt)
 
 {
-       int ret = 0, delete_tail_recs = 0;
+       int ret = 0;
        struct ocfs2_extent_list *el = path_leaf_el(left_path);
        struct ocfs2_extent_rec *rec = &el->l_recs[split_index];
 
        BUG_ON(ctxt->c_contig_type == CONTIG_NONE);
 
-       if (ctxt->c_split_covers_rec) {
-               delete_tail_recs++;
-
-               if (ctxt->c_contig_type == CONTIG_LEFTRIGHT ||
-                   ctxt->c_has_empty_extent)
-                       delete_tail_recs++;
-
-               if (ctxt->c_has_empty_extent) {
-                       /*
-                        * The merge code will need to create an empty
-                        * extent to take the place of the newly
-                        * emptied slot. Remove any pre-existing empty
-                        * extents - having more than one in a leaf is
-                        * illegal.
-                        */
-                       ret = ocfs2_rotate_tree_left(inode, handle, left_path,
-                                                    dealloc);
-                       if (ret) {
-                               mlog_errno(ret);
-                               goto out;
-                       }
-                       split_index--;
-                       rec = &el->l_recs[split_index];
+       if (ctxt->c_split_covers_rec && ctxt->c_has_empty_extent) {
+               /*
+                * The merge code will need to create an empty
+                * extent to take the place of the newly
+                * emptied slot. Remove any pre-existing empty
+                * extents - having more than one in a leaf is
+                * illegal.
+                */
+               ret = ocfs2_rotate_tree_left(inode, handle, left_path,
+                                            dealloc);
+               if (ret) {
+                       mlog_errno(ret);
+                       goto out;
                }
+               split_index--;
+               rec = &el->l_recs[split_index];
        }
 
        if (ctxt->c_contig_type == CONTIG_LEFTRIGHT) {
@@ -3593,6 +3583,7 @@ static int ocfs2_figure_insert_type(struct inode *inode,
                                    struct buffer_head *di_bh,
                                    struct buffer_head **last_eb_bh,
                                    struct ocfs2_extent_rec *insert_rec,
+                                   int *free_records,
                                    struct ocfs2_insert_type *insert)
 {
        int ret;
@@ -3633,7 +3624,7 @@ static int ocfs2_figure_insert_type(struct inode *inode,
         * XXX: This test is simplistic, we can search for empty
         * extent records too.
         */
-       insert->ins_free_records = le16_to_cpu(el->l_count) -
+       *free_records = le16_to_cpu(el->l_count) -
                le16_to_cpu(el->l_next_free_rec);
 
        if (!insert->ins_tree_depth) {
@@ -3730,6 +3721,7 @@ int ocfs2_insert_extent(struct ocfs2_super *osb,
                        struct ocfs2_alloc_context *meta_ac)
 {
        int status;
+       int uninitialized_var(free_records);
        struct buffer_head *last_eb_bh = NULL;
        struct ocfs2_insert_type insert = {0, };
        struct ocfs2_extent_rec rec;
@@ -3752,7 +3744,7 @@ int ocfs2_insert_extent(struct ocfs2_super *osb,
        rec.e_flags = flags;
 
        status = ocfs2_figure_insert_type(inode, fe_bh, &last_eb_bh, &rec,
-                                         &insert);
+                                         &free_records, &insert);
        if (status < 0) {
                mlog_errno(status);
                goto bail;
@@ -3762,9 +3754,9 @@ int ocfs2_insert_extent(struct ocfs2_super *osb,
             "Insert.contig_index: %d, Insert.free_records: %d, "
             "Insert.tree_depth: %d\n",
             insert.ins_appending, insert.ins_contig, insert.ins_contig_index,
-            insert.ins_free_records, insert.ins_tree_depth);
+            free_records, insert.ins_tree_depth);
 
-       if (insert.ins_contig == CONTIG_NONE && insert.ins_free_records == 0) {
+       if (insert.ins_contig == CONTIG_NONE && free_records == 0) {
                status = ocfs2_grow_tree(inode, handle, fe_bh,
                                         &insert.ins_tree_depth, &last_eb_bh,
                                         meta_ac);
@@ -3847,26 +3839,17 @@ leftright:
 
        if (le16_to_cpu(rightmost_el->l_next_free_rec) ==
            le16_to_cpu(rightmost_el->l_count)) {
-               int old_depth = depth;
-
                ret = ocfs2_grow_tree(inode, handle, di_bh, &depth, last_eb_bh,
                                      meta_ac);
                if (ret) {
                        mlog_errno(ret);
                        goto out;
                }
-
-               if (old_depth != depth) {
-                       eb = (struct ocfs2_extent_block *)(*last_eb_bh)->b_data;
-                       rightmost_el = &eb->h_list;
-               }
        }
 
        memset(&insert, 0, sizeof(struct ocfs2_insert_type));
        insert.ins_appending = APPEND_NONE;
        insert.ins_contig = CONTIG_NONE;
-       insert.ins_free_records = le16_to_cpu(rightmost_el->l_count)
-               - le16_to_cpu(rightmost_el->l_next_free_rec);
        insert.ins_tree_depth = depth;
 
        insert_range = le32_to_cpu(split_rec.e_cpos) +
@@ -4015,11 +3998,6 @@ static int __ocfs2_mark_extent_written(struct inode *inode,
        } else
                rightmost_el = path_root_el(path);
 
-       ctxt.c_used_tail_recs = le16_to_cpu(rightmost_el->l_next_free_rec);
-       if (ctxt.c_used_tail_recs > 0 &&
-           ocfs2_is_empty_extent(&rightmost_el->l_recs[0]))
-               ctxt.c_used_tail_recs--;
-
        if (rec->e_cpos == split_rec->e_cpos &&
            rec->e_leaf_clusters == split_rec->e_leaf_clusters)
                ctxt.c_split_covers_rec = 1;
@@ -4028,10 +4006,9 @@ static int __ocfs2_mark_extent_written(struct inode *inode,
 
        ctxt.c_has_empty_extent = ocfs2_is_empty_extent(&el->l_recs[0]);
 
-       mlog(0, "index: %d, contig: %u, used_tail_recs: %u, "
-            "has_empty: %u, split_covers: %u\n", split_index,
-            ctxt.c_contig_type, ctxt.c_used_tail_recs,
-            ctxt.c_has_empty_extent, ctxt.c_split_covers_rec);
+       mlog(0, "index: %d, contig: %u, has_empty: %u, split_covers: %u\n",
+            split_index, ctxt.c_contig_type, ctxt.c_has_empty_extent,
+            ctxt.c_split_covers_rec);
 
        if (ctxt.c_contig_type == CONTIG_NONE) {
                if (ctxt.c_split_covers_rec)
@@ -4180,27 +4157,18 @@ static int ocfs2_split_tree(struct inode *inode, struct buffer_head *di_bh,
 
        if (le16_to_cpu(rightmost_el->l_next_free_rec) ==
            le16_to_cpu(rightmost_el->l_count)) {
-               int old_depth = depth;
-
                ret = ocfs2_grow_tree(inode, handle, di_bh, &depth, &last_eb_bh,
                                      meta_ac);
                if (ret) {
                        mlog_errno(ret);
                        goto out;
                }
-
-               if (old_depth != depth) {
-                       eb = (struct ocfs2_extent_block *)last_eb_bh->b_data;
-                       rightmost_el = &eb->h_list;
-               }
        }
 
        memset(&insert, 0, sizeof(struct ocfs2_insert_type));
        insert.ins_appending = APPEND_NONE;
        insert.ins_contig = CONTIG_NONE;
        insert.ins_split = SPLIT_RIGHT;
-       insert.ins_free_records = le16_to_cpu(rightmost_el->l_count)
-               - le16_to_cpu(rightmost_el->l_next_free_rec);
        insert.ins_tree_depth = depth;
 
        ret = ocfs2_do_insert_extent(inode, handle, di_bh, &split_rec, &insert);