@@ -983,38 +983,33 @@ static void empty_ail1_list(struct gfs2_sbd *sdp)
983983 }
984984}
985985
986+ static void gfs2_trans_drain_list (struct list_head * list )
987+ {
988+ struct gfs2_bufdata * bd ;
989+
990+ while (!list_empty (list )) {
991+ bd = list_first_entry (list , struct gfs2_bufdata , bd_list );
992+ list_del_init (& bd -> bd_list );
993+ if (!list_empty (& bd -> bd_ail_st_list ))
994+ gfs2_remove_from_ail (bd );
995+ kmem_cache_free (gfs2_bufdata_cachep , bd );
996+ }
997+ }
998+
986999/**
987- * trans_drain - drain the buf and databuf queue for a failed transaction
1000+ * gfs2_trans_drain - drain the buf and databuf queue for a failed transaction
9881001 * @tr: the transaction to drain
9891002 *
9901003 * When this is called, we're taking an error exit for a log write that failed
9911004 * but since we bypassed the after_commit functions, we need to remove the
9921005 * items from the buf and databuf queue.
9931006 */
994- static void trans_drain (struct gfs2_trans * tr )
1007+ static void gfs2_trans_drain (struct gfs2_trans * tr )
9951008{
996- struct gfs2_bufdata * bd ;
997- struct list_head * head ;
998-
9991009 if (!tr )
10001010 return ;
1001-
1002- head = & tr -> tr_buf ;
1003- while (!list_empty (head )) {
1004- bd = list_first_entry (head , struct gfs2_bufdata , bd_list );
1005- list_del_init (& bd -> bd_list );
1006- if (!list_empty (& bd -> bd_ail_st_list ))
1007- gfs2_remove_from_ail (bd );
1008- kmem_cache_free (gfs2_bufdata_cachep , bd );
1009- }
1010- head = & tr -> tr_databuf ;
1011- while (!list_empty (head )) {
1012- bd = list_first_entry (head , struct gfs2_bufdata , bd_list );
1013- list_del_init (& bd -> bd_list );
1014- if (!list_empty (& bd -> bd_ail_st_list ))
1015- gfs2_remove_from_ail (bd );
1016- kmem_cache_free (gfs2_bufdata_cachep , bd );
1017- }
1011+ gfs2_trans_drain_list (& tr -> tr_buf );
1012+ gfs2_trans_drain_list (& tr -> tr_databuf );
10181013}
10191014
10201015void gfs2_remove_from_journal (struct buffer_head * bh , int meta )
@@ -1186,7 +1181,7 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl, u32 flags)
11861181 return ;
11871182
11881183out_withdraw :
1189- trans_drain (tr );
1184+ gfs2_trans_drain (tr );
11901185 /**
11911186 * If the tr_list is empty, we're withdrawing during a log
11921187 * flush that targets a transaction, but the transaction was
0 commit comments