···983983 }984984}985985986986+static void gfs2_trans_drain_list(struct list_head *list)987987+{988988+ struct gfs2_bufdata *bd;989989+990990+ while (!list_empty(list)) {991991+ bd = list_first_entry(list, struct gfs2_bufdata, bd_list);992992+ list_del_init(&bd->bd_list);993993+ if (!list_empty(&bd->bd_ail_st_list))994994+ gfs2_remove_from_ail(bd);995995+ kmem_cache_free(gfs2_bufdata_cachep, bd);996996+ }997997+}998998+986999/**987987- * trans_drain - drain the buf and databuf queue for a failed transaction10001000+ * gfs2_trans_drain - drain the buf and databuf queue for a failed transaction9881001 * @tr: the transaction to drain9891002 *9901003 * When this is called, we're taking an error exit for a log write that failed9911004 * but since we bypassed the after_commit functions, we need to remove the9921005 * items from the buf and databuf queue.9931006 */994994-static void trans_drain(struct gfs2_trans *tr)10071007+static void gfs2_trans_drain(struct gfs2_trans *tr)9951008{996996- struct gfs2_bufdata *bd;997997- struct list_head *head;998998-9991009 if (!tr)10001010 return;10011001-10021002- head = &tr->tr_buf;10031003- while (!list_empty(head)) {10041004- bd = list_first_entry(head, struct gfs2_bufdata, bd_list);10051005- list_del_init(&bd->bd_list);10061006- if (!list_empty(&bd->bd_ail_st_list))10071007- gfs2_remove_from_ail(bd);10081008- kmem_cache_free(gfs2_bufdata_cachep, bd);10091009- }10101010- head = &tr->tr_databuf;10111011- while (!list_empty(head)) {10121012- bd = list_first_entry(head, struct gfs2_bufdata, bd_list);10131013- list_del_init(&bd->bd_list);10141014- if (!list_empty(&bd->bd_ail_st_list))10151015- gfs2_remove_from_ail(bd);10161016- kmem_cache_free(gfs2_bufdata_cachep, bd);10171017- }10111011+ gfs2_trans_drain_list(&tr->tr_buf);10121012+ gfs2_trans_drain_list(&tr->tr_databuf);10181013}1019101410201015void gfs2_remove_from_journal(struct buffer_head *bh, int meta)···11811186 return;1182118711831188out_withdraw:11841184- trans_drain(tr);11891189+ gfs2_trans_drain(tr);11851190 /**11861191 * If the tr_list is empty, we're withdrawing during a log11871192 * flush that targets a transaction, but the transaction was