diff options
Diffstat (limited to 'fs/gfs2/lops.c')
-rw-r--r-- | fs/gfs2/lops.c | 56 |
1 files changed, 35 insertions, 21 deletions
diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c index 4bd89c0781e7..430161a05a21 100644 --- a/fs/gfs2/lops.c +++ b/fs/gfs2/lops.c | |||
@@ -12,9 +12,12 @@ | |||
12 | #include <linux/spinlock.h> | 12 | #include <linux/spinlock.h> |
13 | #include <linux/completion.h> | 13 | #include <linux/completion.h> |
14 | #include <linux/buffer_head.h> | 14 | #include <linux/buffer_head.h> |
15 | #include <linux/gfs2_ondisk.h> | ||
15 | #include <asm/semaphore.h> | 16 | #include <asm/semaphore.h> |
16 | 17 | ||
17 | #include "gfs2.h" | 18 | #include "gfs2.h" |
19 | #include "lm_interface.h" | ||
20 | #include "incore.h" | ||
18 | #include "glock.h" | 21 | #include "glock.h" |
19 | #include "log.h" | 22 | #include "log.h" |
20 | #include "lops.h" | 23 | #include "lops.h" |
@@ -22,12 +25,14 @@ | |||
22 | #include "recovery.h" | 25 | #include "recovery.h" |
23 | #include "rgrp.h" | 26 | #include "rgrp.h" |
24 | #include "trans.h" | 27 | #include "trans.h" |
28 | #include "util.h" | ||
25 | 29 | ||
26 | static void glock_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le) | 30 | static void glock_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le) |
27 | { | 31 | { |
28 | struct gfs2_glock *gl; | 32 | struct gfs2_glock *gl; |
33 | struct gfs2_trans *tr = current->journal_info; | ||
29 | 34 | ||
30 | get_transaction->tr_touched = 1; | 35 | tr->tr_touched = 1; |
31 | 36 | ||
32 | if (!list_empty(&le->le_list)) | 37 | if (!list_empty(&le->le_list)) |
33 | return; | 38 | return; |
@@ -68,7 +73,7 @@ static void buf_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le) | |||
68 | if (!list_empty(&bd->bd_list_tr)) | 73 | if (!list_empty(&bd->bd_list_tr)) |
69 | return; | 74 | return; |
70 | 75 | ||
71 | tr = get_transaction; | 76 | tr = current->journal_info; |
72 | tr->tr_touched = 1; | 77 | tr->tr_touched = 1; |
73 | tr->tr_num_buf++; | 78 | tr->tr_num_buf++; |
74 | list_add(&bd->bd_list_tr, &tr->tr_list_buf); | 79 | list_add(&bd->bd_list_tr, &tr->tr_list_buf); |
@@ -179,7 +184,8 @@ static void buf_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_ail *ai) | |||
179 | static void buf_lo_before_scan(struct gfs2_jdesc *jd, | 184 | static void buf_lo_before_scan(struct gfs2_jdesc *jd, |
180 | struct gfs2_log_header *head, int pass) | 185 | struct gfs2_log_header *head, int pass) |
181 | { | 186 | { |
182 | struct gfs2_sbd *sdp = get_v2ip(jd->jd_inode)->i_sbd; | 187 | struct gfs2_inode *ip = jd->jd_inode->u.generic_ip; |
188 | struct gfs2_sbd *sdp = ip->i_sbd; | ||
183 | 189 | ||
184 | if (pass != 0) | 190 | if (pass != 0) |
185 | return; | 191 | return; |
@@ -192,8 +198,9 @@ static int buf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start, | |||
192 | struct gfs2_log_descriptor *ld, __be64 *ptr, | 198 | struct gfs2_log_descriptor *ld, __be64 *ptr, |
193 | int pass) | 199 | int pass) |
194 | { | 200 | { |
195 | struct gfs2_sbd *sdp = get_v2ip(jd->jd_inode)->i_sbd; | 201 | struct gfs2_inode *ip = jd->jd_inode->u.generic_ip; |
196 | struct gfs2_glock *gl = get_v2ip(jd->jd_inode)->i_gl; | 202 | struct gfs2_sbd *sdp = ip->i_sbd; |
203 | struct gfs2_glock *gl = ip->i_gl; | ||
197 | unsigned int blks = be32_to_cpu(ld->ld_data1); | 204 | unsigned int blks = be32_to_cpu(ld->ld_data1); |
198 | struct buffer_head *bh_log, *bh_ip; | 205 | struct buffer_head *bh_log, *bh_ip; |
199 | uint64_t blkno; | 206 | uint64_t blkno; |
@@ -238,17 +245,18 @@ static int buf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start, | |||
238 | 245 | ||
239 | static void buf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass) | 246 | static void buf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass) |
240 | { | 247 | { |
241 | struct gfs2_sbd *sdp = get_v2ip(jd->jd_inode)->i_sbd; | 248 | struct gfs2_inode *ip = jd->jd_inode->u.generic_ip; |
249 | struct gfs2_sbd *sdp = ip->i_sbd; | ||
242 | 250 | ||
243 | if (error) { | 251 | if (error) { |
244 | gfs2_meta_sync(get_v2ip(jd->jd_inode)->i_gl, | 252 | gfs2_meta_sync(ip->i_gl, |
245 | DIO_START | DIO_WAIT); | 253 | DIO_START | DIO_WAIT); |
246 | return; | 254 | return; |
247 | } | 255 | } |
248 | if (pass != 1) | 256 | if (pass != 1) |
249 | return; | 257 | return; |
250 | 258 | ||
251 | gfs2_meta_sync(get_v2ip(jd->jd_inode)->i_gl, DIO_START | DIO_WAIT); | 259 | gfs2_meta_sync(ip->i_gl, DIO_START | DIO_WAIT); |
252 | 260 | ||
253 | fs_info(sdp, "jid=%u: Replayed %u of %u blocks\n", | 261 | fs_info(sdp, "jid=%u: Replayed %u of %u blocks\n", |
254 | jd->jd_jid, sdp->sd_replayed_blocks, sdp->sd_found_blocks); | 262 | jd->jd_jid, sdp->sd_replayed_blocks, sdp->sd_found_blocks); |
@@ -258,7 +266,7 @@ static void revoke_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le) | |||
258 | { | 266 | { |
259 | struct gfs2_trans *tr; | 267 | struct gfs2_trans *tr; |
260 | 268 | ||
261 | tr = get_transaction; | 269 | tr = current->journal_info; |
262 | tr->tr_touched = 1; | 270 | tr->tr_touched = 1; |
263 | tr->tr_num_revoke++; | 271 | tr->tr_num_revoke++; |
264 | 272 | ||
@@ -324,7 +332,8 @@ static void revoke_lo_before_commit(struct gfs2_sbd *sdp) | |||
324 | static void revoke_lo_before_scan(struct gfs2_jdesc *jd, | 332 | static void revoke_lo_before_scan(struct gfs2_jdesc *jd, |
325 | struct gfs2_log_header *head, int pass) | 333 | struct gfs2_log_header *head, int pass) |
326 | { | 334 | { |
327 | struct gfs2_sbd *sdp = get_v2ip(jd->jd_inode)->i_sbd; | 335 | struct gfs2_inode *ip = jd->jd_inode->u.generic_ip; |
336 | struct gfs2_sbd *sdp = ip->i_sbd; | ||
328 | 337 | ||
329 | if (pass != 0) | 338 | if (pass != 0) |
330 | return; | 339 | return; |
@@ -337,7 +346,8 @@ static int revoke_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start, | |||
337 | struct gfs2_log_descriptor *ld, __be64 *ptr, | 346 | struct gfs2_log_descriptor *ld, __be64 *ptr, |
338 | int pass) | 347 | int pass) |
339 | { | 348 | { |
340 | struct gfs2_sbd *sdp = get_v2ip(jd->jd_inode)->i_sbd; | 349 | struct gfs2_inode *ip = jd->jd_inode->u.generic_ip; |
350 | struct gfs2_sbd *sdp = ip->i_sbd; | ||
341 | unsigned int blks = be32_to_cpu(ld->ld_length); | 351 | unsigned int blks = be32_to_cpu(ld->ld_length); |
342 | unsigned int revokes = be32_to_cpu(ld->ld_data1); | 352 | unsigned int revokes = be32_to_cpu(ld->ld_data1); |
343 | struct buffer_head *bh; | 353 | struct buffer_head *bh; |
@@ -383,7 +393,8 @@ static int revoke_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start, | |||
383 | 393 | ||
384 | static void revoke_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass) | 394 | static void revoke_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass) |
385 | { | 395 | { |
386 | struct gfs2_sbd *sdp = get_v2ip(jd->jd_inode)->i_sbd; | 396 | struct gfs2_inode *ip = jd->jd_inode->u.generic_ip; |
397 | struct gfs2_sbd *sdp = ip->i_sbd; | ||
387 | 398 | ||
388 | if (error) { | 399 | if (error) { |
389 | gfs2_revoke_clean(sdp); | 400 | gfs2_revoke_clean(sdp); |
@@ -401,8 +412,9 @@ static void revoke_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass) | |||
401 | static void rg_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le) | 412 | static void rg_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le) |
402 | { | 413 | { |
403 | struct gfs2_rgrpd *rgd; | 414 | struct gfs2_rgrpd *rgd; |
415 | struct gfs2_trans *tr = current->journal_info; | ||
404 | 416 | ||
405 | get_transaction->tr_touched = 1; | 417 | tr->tr_touched = 1; |
406 | 418 | ||
407 | if (!list_empty(&le->le_list)) | 419 | if (!list_empty(&le->le_list)) |
408 | return; | 420 | return; |
@@ -451,9 +463,9 @@ static void rg_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_ail *ai) | |||
451 | static void databuf_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le) | 463 | static void databuf_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le) |
452 | { | 464 | { |
453 | struct gfs2_bufdata *bd = container_of(le, struct gfs2_bufdata, bd_le); | 465 | struct gfs2_bufdata *bd = container_of(le, struct gfs2_bufdata, bd_le); |
454 | struct gfs2_trans *tr = get_transaction; | 466 | struct gfs2_trans *tr = current->journal_info; |
455 | struct address_space *mapping = bd->bd_bh->b_page->mapping; | 467 | struct address_space *mapping = bd->bd_bh->b_page->mapping; |
456 | struct gfs2_inode *ip = get_v2ip(mapping->host); | 468 | struct gfs2_inode *ip = mapping->host->u.generic_ip; |
457 | 469 | ||
458 | tr->tr_touched = 1; | 470 | tr->tr_touched = 1; |
459 | if (!list_empty(&bd->bd_list_tr) && | 471 | if (!list_empty(&bd->bd_list_tr) && |
@@ -633,7 +645,7 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp) | |||
633 | 645 | ||
634 | bh = bd1->bd_bh; | 646 | bh = bd1->bd_bh; |
635 | if (bh) { | 647 | if (bh) { |
636 | set_v2bd(bh, NULL); | 648 | bh->b_private = NULL; |
637 | gfs2_log_unlock(sdp); | 649 | gfs2_log_unlock(sdp); |
638 | wait_on_buffer(bh); | 650 | wait_on_buffer(bh); |
639 | brelse(bh); | 651 | brelse(bh); |
@@ -651,8 +663,9 @@ static int databuf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start, | |||
651 | struct gfs2_log_descriptor *ld, | 663 | struct gfs2_log_descriptor *ld, |
652 | __be64 *ptr, int pass) | 664 | __be64 *ptr, int pass) |
653 | { | 665 | { |
654 | struct gfs2_sbd *sdp = get_v2ip(jd->jd_inode)->i_sbd; | 666 | struct gfs2_inode *ip = jd->jd_inode->u.generic_ip; |
655 | struct gfs2_glock *gl = get_v2ip(jd->jd_inode)->i_gl; | 667 | struct gfs2_sbd *sdp = ip->i_sbd; |
668 | struct gfs2_glock *gl = ip->i_gl; | ||
656 | unsigned int blks = be32_to_cpu(ld->ld_data1); | 669 | unsigned int blks = be32_to_cpu(ld->ld_data1); |
657 | struct buffer_head *bh_log, *bh_ip; | 670 | struct buffer_head *bh_log, *bh_ip; |
658 | uint64_t blkno; | 671 | uint64_t blkno; |
@@ -701,10 +714,11 @@ static int databuf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start, | |||
701 | 714 | ||
702 | static void databuf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass) | 715 | static void databuf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass) |
703 | { | 716 | { |
704 | struct gfs2_sbd *sdp = get_v2ip(jd->jd_inode)->i_sbd; | 717 | struct gfs2_inode *ip = jd->jd_inode->u.generic_ip; |
718 | struct gfs2_sbd *sdp = ip->i_sbd; | ||
705 | 719 | ||
706 | if (error) { | 720 | if (error) { |
707 | gfs2_meta_sync(get_v2ip(jd->jd_inode)->i_gl, | 721 | gfs2_meta_sync(ip->i_gl, |
708 | DIO_START | DIO_WAIT); | 722 | DIO_START | DIO_WAIT); |
709 | return; | 723 | return; |
710 | } | 724 | } |
@@ -712,7 +726,7 @@ static void databuf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass) | |||
712 | return; | 726 | return; |
713 | 727 | ||
714 | /* data sync? */ | 728 | /* data sync? */ |
715 | gfs2_meta_sync(get_v2ip(jd->jd_inode)->i_gl, DIO_START | DIO_WAIT); | 729 | gfs2_meta_sync(ip->i_gl, DIO_START | DIO_WAIT); |
716 | 730 | ||
717 | fs_info(sdp, "jid=%u: Replayed %u of %u data blocks\n", | 731 | fs_info(sdp, "jid=%u: Replayed %u of %u data blocks\n", |
718 | jd->jd_jid, sdp->sd_replayed_blocks, sdp->sd_found_blocks); | 732 | jd->jd_jid, sdp->sd_replayed_blocks, sdp->sd_found_blocks); |