diff options
author | Steven Whitehouse <steve@chygwyn.com> | 2006-01-18 08:14:40 -0500 |
---|---|---|
committer | Steven Whitehouse <steve@chygwyn.com> | 2006-01-18 08:14:40 -0500 |
commit | 64fb4eb7d4cc9de89f4d9b9061adde46ed3b5641 (patch) | |
tree | 973c910cdf963f2e546ef0e8fcc93c16a7c04905 /fs/gfs2 | |
parent | 586dfdaaf328d79bb356d760db963b03a75a4131 (diff) |
[GFS2] Remove gfs2_databuf in favour of gfs2_bufdata structure
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>
Diffstat (limited to 'fs/gfs2')
-rw-r--r-- | fs/gfs2/gfs2.h | 2 | ||||
-rw-r--r-- | fs/gfs2/incore.h | 6 | ||||
-rw-r--r-- | fs/gfs2/lops.c | 20 | ||||
-rw-r--r-- | fs/gfs2/ops_address.c | 10 | ||||
-rw-r--r-- | fs/gfs2/trans.c | 18 |
5 files changed, 24 insertions, 32 deletions
diff --git a/fs/gfs2/gfs2.h b/fs/gfs2/gfs2.h index a5d11823846..6c53d080675 100644 --- a/fs/gfs2/gfs2.h +++ b/fs/gfs2/gfs2.h | |||
@@ -45,8 +45,6 @@ enum { | |||
45 | #define set_v2fp(file, fp) (file)->private_data = (fp) | 45 | #define set_v2fp(file, fp) (file)->private_data = (fp) |
46 | #define get_v2bd(bh) ((struct gfs2_bufdata *)(bh)->b_private) | 46 | #define get_v2bd(bh) ((struct gfs2_bufdata *)(bh)->b_private) |
47 | #define set_v2bd(bh, bd) (bh)->b_private = (bd) | 47 | #define set_v2bd(bh, bd) (bh)->b_private = (bd) |
48 | #define get_v2db(bh) ((struct gfs2_databuf *)(bh)->b_private) | ||
49 | #define set_v2db(bh, db) (bh)->b_private = (db) | ||
50 | 48 | ||
51 | #define get_transaction ((struct gfs2_trans *)(current->journal_info)) | 49 | #define get_transaction ((struct gfs2_trans *)(current->journal_info)) |
52 | #define set_transaction(tr) (current->journal_info) = (tr) | 50 | #define set_transaction(tr) (current->journal_info) = (tr) |
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h index 3ed0a7f26e4..3bc40ff5fdf 100644 --- a/fs/gfs2/incore.h +++ b/fs/gfs2/incore.h | |||
@@ -25,7 +25,6 @@ struct gfs2_log_element; | |||
25 | struct gfs2_bitmap; | 25 | struct gfs2_bitmap; |
26 | struct gfs2_rgrpd; | 26 | struct gfs2_rgrpd; |
27 | struct gfs2_bufdata; | 27 | struct gfs2_bufdata; |
28 | struct gfs2_databuf; | ||
29 | struct gfs2_glock_operations; | 28 | struct gfs2_glock_operations; |
30 | struct gfs2_holder; | 29 | struct gfs2_holder; |
31 | struct gfs2_glock; | 30 | struct gfs2_glock; |
@@ -116,11 +115,6 @@ struct gfs2_bufdata { | |||
116 | struct list_head bd_ail_gl_list; | 115 | struct list_head bd_ail_gl_list; |
117 | }; | 116 | }; |
118 | 117 | ||
119 | struct gfs2_databuf { | ||
120 | struct gfs2_log_element db_le; | ||
121 | struct buffer_head *db_bh; | ||
122 | }; | ||
123 | |||
124 | struct gfs2_glock_operations { | 118 | struct gfs2_glock_operations { |
125 | void (*go_xmote_th) (struct gfs2_glock * gl, unsigned int state, | 119 | void (*go_xmote_th) (struct gfs2_glock * gl, unsigned int state, |
126 | int flags); | 120 | int flags); |
diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c index d501e8224ed..efb1087d0fa 100644 --- a/fs/gfs2/lops.c +++ b/fs/gfs2/lops.c | |||
@@ -442,15 +442,15 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp) | |||
442 | { | 442 | { |
443 | struct list_head *head = &sdp->sd_log_le_databuf; | 443 | struct list_head *head = &sdp->sd_log_le_databuf; |
444 | LIST_HEAD(started); | 444 | LIST_HEAD(started); |
445 | struct gfs2_databuf *db; | 445 | struct gfs2_bufdata *bd; |
446 | struct buffer_head *bh; | 446 | struct buffer_head *bh; |
447 | 447 | ||
448 | while (!list_empty(head)) { | 448 | while (!list_empty(head)) { |
449 | db = list_entry(head->prev, struct gfs2_databuf, db_le.le_list); | 449 | bd = list_entry(head->prev, struct gfs2_bufdata, bd_le.le_list); |
450 | list_move(&db->db_le.le_list, &started); | 450 | list_move(&bd->bd_le.le_list, &started); |
451 | 451 | ||
452 | gfs2_log_lock(sdp); | 452 | gfs2_log_lock(sdp); |
453 | bh = db->db_bh; | 453 | bh = bd->bd_bh; |
454 | if (bh) { | 454 | if (bh) { |
455 | get_bh(bh); | 455 | get_bh(bh); |
456 | gfs2_log_unlock(sdp); | 456 | gfs2_log_unlock(sdp); |
@@ -464,22 +464,22 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp) | |||
464 | } | 464 | } |
465 | 465 | ||
466 | while (!list_empty(&started)) { | 466 | while (!list_empty(&started)) { |
467 | db = list_entry(started.next, struct gfs2_databuf, | 467 | bd = list_entry(started.next, struct gfs2_bufdata, |
468 | db_le.le_list); | 468 | bd_le.le_list); |
469 | list_del(&db->db_le.le_list); | 469 | list_del(&bd->bd_le.le_list); |
470 | sdp->sd_log_num_databuf--; | 470 | sdp->sd_log_num_databuf--; |
471 | 471 | ||
472 | gfs2_log_lock(sdp); | 472 | gfs2_log_lock(sdp); |
473 | bh = db->db_bh; | 473 | bh = bd->bd_bh; |
474 | if (bh) { | 474 | if (bh) { |
475 | set_v2db(bh, NULL); | 475 | set_v2bd(bh, NULL); |
476 | gfs2_log_unlock(sdp); | 476 | gfs2_log_unlock(sdp); |
477 | wait_on_buffer(bh); | 477 | wait_on_buffer(bh); |
478 | brelse(bh); | 478 | brelse(bh); |
479 | } else | 479 | } else |
480 | gfs2_log_unlock(sdp); | 480 | gfs2_log_unlock(sdp); |
481 | 481 | ||
482 | kfree(db); | 482 | kfree(bd); |
483 | } | 483 | } |
484 | 484 | ||
485 | gfs2_assert_warn(sdp, !sdp->sd_log_num_databuf); | 485 | gfs2_assert_warn(sdp, !sdp->sd_log_num_databuf); |
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c index d352b3528f5..db66d328755 100644 --- a/fs/gfs2/ops_address.c +++ b/fs/gfs2/ops_address.c | |||
@@ -429,13 +429,13 @@ static sector_t gfs2_bmap(struct address_space *mapping, sector_t lblock) | |||
429 | 429 | ||
430 | static void discard_buffer(struct gfs2_sbd *sdp, struct buffer_head *bh) | 430 | static void discard_buffer(struct gfs2_sbd *sdp, struct buffer_head *bh) |
431 | { | 431 | { |
432 | struct gfs2_databuf *db; | 432 | struct gfs2_bufdata *bd; |
433 | 433 | ||
434 | gfs2_log_lock(sdp); | 434 | gfs2_log_lock(sdp); |
435 | db = get_v2db(bh); | 435 | bd = get_v2bd(bh); |
436 | if (db) { | 436 | if (bd) { |
437 | db->db_bh = NULL; | 437 | bd->bd_bh = NULL; |
438 | set_v2db(bh, NULL); | 438 | set_v2bd(bh, NULL); |
439 | gfs2_log_unlock(sdp); | 439 | gfs2_log_unlock(sdp); |
440 | brelse(bh); | 440 | brelse(bh); |
441 | } else | 441 | } else |
diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c index a9df4a34eba..b014591fa4a 100644 --- a/fs/gfs2/trans.c +++ b/fs/gfs2/trans.c | |||
@@ -199,17 +199,17 @@ void gfs2_trans_add_rg(struct gfs2_rgrpd *rgd) | |||
199 | 199 | ||
200 | void gfs2_trans_add_databuf(struct gfs2_sbd *sdp, struct buffer_head *bh) | 200 | void gfs2_trans_add_databuf(struct gfs2_sbd *sdp, struct buffer_head *bh) |
201 | { | 201 | { |
202 | struct gfs2_databuf *db; | 202 | struct gfs2_bufdata *bd; |
203 | 203 | ||
204 | db = get_v2db(bh); | 204 | bd = get_v2bd(bh); |
205 | if (!db) { | 205 | if (!bd) { |
206 | db = kmalloc(sizeof(struct gfs2_databuf), | 206 | bd = kmalloc(sizeof(struct gfs2_bufdata), |
207 | GFP_KERNEL | __GFP_NOFAIL); | 207 | GFP_NOFS | __GFP_NOFAIL); |
208 | lops_init_le(&db->db_le, &gfs2_databuf_lops); | 208 | lops_init_le(&bd->bd_le, &gfs2_databuf_lops); |
209 | get_bh(bh); | 209 | get_bh(bh); |
210 | db->db_bh = bh; | 210 | bd->bd_bh = bh; |
211 | set_v2db(bh, db); | 211 | set_v2bd(bh, bd); |
212 | lops_add(sdp, &db->db_le); | 212 | lops_add(sdp, &bd->bd_le); |
213 | } | 213 | } |
214 | } | 214 | } |
215 | 215 | ||