WorkStruct: make allyesconfig
[deliverable/linux.git] / fs / ocfs2 / alloc.c
index edaab05a93e02af3059d059af59e72243f024e83..0b2ad163005ea8d31a61b482fce0b624987c332c 100644 (file)
@@ -1205,10 +1205,12 @@ int ocfs2_flush_truncate_log(struct ocfs2_super *osb)
        return status;
 }
 
-static void ocfs2_truncate_log_worker(void *data)
+static void ocfs2_truncate_log_worker(struct work_struct *work)
 {
        int status;
-       struct ocfs2_super *osb = data;
+       struct ocfs2_super *osb =
+               container_of(work, struct ocfs2_super,
+                            osb_truncate_log_wq.work);
 
        mlog_entry_void();
 
@@ -1441,7 +1443,8 @@ int ocfs2_truncate_log_init(struct ocfs2_super *osb)
        /* ocfs2_truncate_log_shutdown keys on the existence of
         * osb->osb_tl_inode so we don't set any of the osb variables
         * until we're sure all is well. */
-       INIT_WORK(&osb->osb_truncate_log_wq, ocfs2_truncate_log_worker, osb);
+       INIT_DELAYED_WORK(&osb->osb_truncate_log_wq,
+                         ocfs2_truncate_log_worker);
        osb->osb_tl_bh    = tl_bh;
        osb->osb_tl_inode = tl_inode;
 
@@ -1717,17 +1720,29 @@ static int ocfs2_do_truncate(struct ocfs2_super *osb,
 
                        ocfs2_remove_from_cache(inode, eb_bh);
 
-                       BUG_ON(eb->h_suballoc_slot);
                        BUG_ON(el->l_recs[0].e_clusters);
                        BUG_ON(el->l_recs[0].e_cpos);
                        BUG_ON(el->l_recs[0].e_blkno);
-                       status = ocfs2_free_extent_block(handle,
-                                                        tc->tc_ext_alloc_inode,
-                                                        tc->tc_ext_alloc_bh,
-                                                        eb);
-                       if (status < 0) {
-                               mlog_errno(status);
-                               goto bail;
+                       if (eb->h_suballoc_slot == 0) {
+                               /*
+                                * This code only understands how to
+                                * lock the suballocator in slot 0,
+                                * which is fine because allocation is
+                                * only ever done out of that
+                                * suballocator too. A future version
+                                * might change that however, so avoid
+                                * a free if we don't know how to
+                                * handle it. This way an fs incompat
+                                * bit will not be necessary.
+                                */
+                               status = ocfs2_free_extent_block(handle,
+                                                                tc->tc_ext_alloc_inode,
+                                                                tc->tc_ext_alloc_bh,
+                                                                eb);
+                               if (status < 0) {
+                                       mlog_errno(status);
+                                       goto bail;
+                               }
                        }
                }
                brelse(eb_bh);
This page took 0.029626 seconds and 5 git commands to generate.