[GFS2] Remove gfs2_databuf in favour of gfs2_bufdata structure
authorSteven Whitehouse <steve@chygwyn.com>
Wed, 18 Jan 2006 13:14:40 +0000 (13:14 +0000)
committerSteven Whitehouse <steve@chygwyn.com>
Wed, 18 Jan 2006 13:14:40 +0000 (13:14 +0000)
Removing the gfs2_databuf structure and using gfs2_bufdata instead
is a step towards allowing journaling of data without requiring the
metadata header on each journaled block. The idea is to merge the
code paths for ordered data with that of journaled data, with the
log operations in lops.c tacking account of the different types of
buffers as they are presented to it. Largely the code path for
metadata will be similar too, but obviously through a different set
of log operations.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
fs/gfs2/gfs2.h
fs/gfs2/incore.h
fs/gfs2/lops.c
fs/gfs2/ops_address.c
fs/gfs2/trans.c

index a5d1182384669241a65cfd7ce54ccd7878ba4266..6c53d080675c3ca15425503318077c0110aa8e00 100644 (file)
@@ -45,8 +45,6 @@ enum {
 #define set_v2fp(file, fp) (file)->private_data = (fp)
 #define get_v2bd(bh) ((struct gfs2_bufdata *)(bh)->b_private)
 #define set_v2bd(bh, bd) (bh)->b_private = (bd)
-#define get_v2db(bh) ((struct gfs2_databuf *)(bh)->b_private)
-#define set_v2db(bh, db) (bh)->b_private = (db)
 
 #define get_transaction ((struct gfs2_trans *)(current->journal_info))
 #define set_transaction(tr) (current->journal_info) = (tr)
index 3ed0a7f26e45ab900cc0e3649a39b5ec79404ce4..3bc40ff5fdf95046ec5e3b9bab11ce45d249c059 100644 (file)
@@ -25,7 +25,6 @@ struct gfs2_log_element;
 struct gfs2_bitmap;
 struct gfs2_rgrpd;
 struct gfs2_bufdata;
-struct gfs2_databuf;
 struct gfs2_glock_operations;
 struct gfs2_holder;
 struct gfs2_glock;
@@ -116,11 +115,6 @@ struct gfs2_bufdata {
        struct list_head bd_ail_gl_list;
 };
 
-struct gfs2_databuf {
-       struct gfs2_log_element db_le;
-       struct buffer_head *db_bh;
-};
-
 struct gfs2_glock_operations {
        void (*go_xmote_th) (struct gfs2_glock * gl, unsigned int state,
                             int flags);
index d501e8224ed0c02164d8e9d008f4fc2ec43cb361..efb1087d0fa881ad99b9d63643c3898100e96dff 100644 (file)
@@ -442,15 +442,15 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp)
 {
        struct list_head *head = &sdp->sd_log_le_databuf;
        LIST_HEAD(started);
-       struct gfs2_databuf *db;
+       struct gfs2_bufdata *bd;
        struct buffer_head *bh;
 
        while (!list_empty(head)) {
-               db = list_entry(head->prev, struct gfs2_databuf, db_le.le_list);
-               list_move(&db->db_le.le_list, &started);
+               bd = list_entry(head->prev, struct gfs2_bufdata, bd_le.le_list);
+               list_move(&bd->bd_le.le_list, &started);
 
                gfs2_log_lock(sdp);
-               bh = db->db_bh;
+               bh = bd->bd_bh;
                if (bh) {
                        get_bh(bh);
                        gfs2_log_unlock(sdp);
@@ -464,22 +464,22 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp)
        }
 
        while (!list_empty(&started)) {
-               db = list_entry(started.next, struct gfs2_databuf,
-                               db_le.le_list);
-               list_del(&db->db_le.le_list);
+               bd = list_entry(started.next, struct gfs2_bufdata,
+                               bd_le.le_list);
+               list_del(&bd->bd_le.le_list);
                sdp->sd_log_num_databuf--;
 
                gfs2_log_lock(sdp);
-               bh = db->db_bh;
+               bh = bd->bd_bh;
                if (bh) {
-                       set_v2db(bh, NULL);
+                       set_v2bd(bh, NULL);
                        gfs2_log_unlock(sdp);
                        wait_on_buffer(bh);
                        brelse(bh);
                } else
                        gfs2_log_unlock(sdp);
 
-               kfree(db);
+               kfree(bd);
        }
 
        gfs2_assert_warn(sdp, !sdp->sd_log_num_databuf);
index d352b3528f5e23fd66cef38842a0408f9b4f753b..db66d3287550466ce7d68b067062a81fbc1e22a0 100644 (file)
@@ -429,13 +429,13 @@ static sector_t gfs2_bmap(struct address_space *mapping, sector_t lblock)
 
 static void discard_buffer(struct gfs2_sbd *sdp, struct buffer_head *bh)
 {
-       struct gfs2_databuf *db;
+       struct gfs2_bufdata *bd;
 
        gfs2_log_lock(sdp);
-       db = get_v2db(bh);
-       if (db) {
-               db->db_bh = NULL;
-               set_v2db(bh, NULL);
+       bd = get_v2bd(bh);
+       if (bd) {
+               bd->bd_bh = NULL;
+               set_v2bd(bh, NULL);
                gfs2_log_unlock(sdp);
                brelse(bh);
        } else
index a9df4a34ebad5fbe4246c7da4d6e2048b613e0ca..b014591fa4a45db665495774856dc0f2d79b8f2e 100644 (file)
@@ -199,17 +199,17 @@ void gfs2_trans_add_rg(struct gfs2_rgrpd *rgd)
 
 void gfs2_trans_add_databuf(struct gfs2_sbd *sdp, struct buffer_head *bh)
 {
-       struct gfs2_databuf *db;
+       struct gfs2_bufdata *bd;
 
-       db = get_v2db(bh);
-       if (!db) {
-               db = kmalloc(sizeof(struct gfs2_databuf),
-                            GFP_KERNEL | __GFP_NOFAIL);
-               lops_init_le(&db->db_le, &gfs2_databuf_lops);
+       bd = get_v2bd(bh);
+       if (!bd) {
+               bd = kmalloc(sizeof(struct gfs2_bufdata),
+                            GFP_NOFS | __GFP_NOFAIL);
+               lops_init_le(&bd->bd_le, &gfs2_databuf_lops);
                get_bh(bh);
-               db->db_bh = bh;
-               set_v2db(bh, db);
-               lops_add(sdp, &db->db_le);
+               bd->bd_bh = bh;
+               set_v2bd(bh, bd);
+               lops_add(sdp, &bd->bd_le);
        }
 }