hc
2024-05-10 9999e48639b3cecb08ffb37358bcba3b48161b29
kernel/fs/gfs2/lops.c
....@@ -1,10 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
34 * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
4
- *
5
- * This copyrighted material is made available to anyone wishing to use,
6
- * modify, copy, or redistribute it subject to the terms and conditions
7
- * of the GNU General Public License version 2.
85 */
96
107 #include <linux/sched.h>
....@@ -17,12 +14,15 @@
1714 #include <linux/bio.h>
1815 #include <linux/fs.h>
1916 #include <linux/list_sort.h>
17
+#include <linux/blkdev.h>
2018
19
+#include "bmap.h"
2120 #include "dir.h"
2221 #include "gfs2.h"
2322 #include "incore.h"
2423 #include "inode.h"
2524 #include "glock.h"
25
+#include "glops.h"
2626 #include "log.h"
2727 #include "lops.h"
2828 #include "meta_io.h"
....@@ -81,7 +81,7 @@
8181 if (sdp->sd_args.ar_discard)
8282 gfs2_rgrp_send_discards(sdp, rgd->rd_data0, bd->bd_bh, bi, 1, NULL);
8383 memcpy(bi->bi_clone + bi->bi_offset,
84
- bd->bd_bh->b_data + bi->bi_offset, bi->bi_len);
84
+ bd->bd_bh->b_data + bi->bi_offset, bi->bi_bytes);
8585 clear_bit(GBF_FULL, &bi->bi_flags);
8686 rgd->rd_free_clone = rgd->rd_free;
8787 rgd->rd_extfail_pt = rgd->rd_free;
....@@ -130,7 +130,7 @@
130130 atomic_dec(&sdp->sd_log_pinned);
131131 }
132132
133
-static void gfs2_log_incr_head(struct gfs2_sbd *sdp)
133
+void gfs2_log_incr_head(struct gfs2_sbd *sdp)
134134 {
135135 BUG_ON((sdp->sd_log_flush_head == sdp->sd_log_tail) &&
136136 (sdp->sd_log_flush_head != sdp->sd_log_head));
....@@ -139,18 +139,13 @@
139139 sdp->sd_log_flush_head = 0;
140140 }
141141
142
-u64 gfs2_log_bmap(struct gfs2_sbd *sdp)
142
+u64 gfs2_log_bmap(struct gfs2_jdesc *jd, unsigned int lblock)
143143 {
144
- unsigned int lbn = sdp->sd_log_flush_head;
145144 struct gfs2_journal_extent *je;
146
- u64 block;
147145
148
- list_for_each_entry(je, &sdp->sd_jdesc->extent_list, list) {
149
- if ((lbn >= je->lblock) && (lbn < (je->lblock + je->blocks))) {
150
- block = je->dblock + lbn - je->lblock;
151
- gfs2_log_incr_head(sdp);
152
- return block;
153
- }
146
+ list_for_each_entry(je, &jd->extent_list, list) {
147
+ if (lblock >= je->lblock && lblock < je->lblock + je->blocks)
148
+ return je->dblock + lblock - je->lblock;
154149 }
155150
156151 return -1;
....@@ -168,7 +163,8 @@
168163 * that is pinned in the pagecache.
169164 */
170165
171
-static void gfs2_end_log_write_bh(struct gfs2_sbd *sdp, struct bio_vec *bvec,
166
+static void gfs2_end_log_write_bh(struct gfs2_sbd *sdp,
167
+ struct bio_vec *bvec,
172168 blk_status_t error)
173169 {
174170 struct buffer_head *bh, *next;
....@@ -193,7 +189,6 @@
193189 /**
194190 * gfs2_end_log_write - end of i/o to the log
195191 * @bio: The bio
196
- * @error: Status of i/o request
197192 *
198193 * Each bio_vec contains either data from the pagecache or data
199194 * relating to the log itself. Here we iterate over the bio_vec
....@@ -206,15 +201,19 @@
206201 struct gfs2_sbd *sdp = bio->bi_private;
207202 struct bio_vec *bvec;
208203 struct page *page;
209
- int i;
204
+ struct bvec_iter_all iter_all;
210205
211206 if (bio->bi_status) {
212
- fs_err(sdp, "Error %d writing to journal, jid=%u\n",
213
- bio->bi_status, sdp->sd_jdesc->jd_jid);
207
+ if (!cmpxchg(&sdp->sd_log_error, 0, (int)bio->bi_status))
208
+ fs_err(sdp, "Error %d writing to journal, jid=%u\n",
209
+ bio->bi_status, sdp->sd_jdesc->jd_jid);
210
+ gfs2_withdraw_delayed(sdp);
211
+ /* prevent more writes to the journal */
212
+ clear_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags);
214213 wake_up(&sdp->sd_logd_waitq);
215214 }
216215
217
- bio_for_each_segment_all(bvec, bio, i) {
216
+ bio_for_each_segment_all(bvec, bio, iter_all) {
218217 page = bvec->bv_page;
219218 if (page_has_buffers(page))
220219 gfs2_end_log_write_bh(sdp, bvec, bio->bi_status);
....@@ -228,83 +227,86 @@
228227 }
229228
230229 /**
231
- * gfs2_log_flush_bio - Submit any pending log bio
232
- * @sdp: The superblock
233
- * @op: REQ_OP
234
- * @op_flags: req_flag_bits
230
+ * gfs2_log_submit_bio - Submit any pending log bio
231
+ * @biop: Address of the bio pointer
232
+ * @opf: REQ_OP | op_flags
235233 *
236234 * Submit any pending part-built or full bio to the block device. If
237235 * there is no pending bio, then this is a no-op.
238236 */
239237
240
-void gfs2_log_flush_bio(struct gfs2_sbd *sdp, int op, int op_flags)
238
+void gfs2_log_submit_bio(struct bio **biop, int opf)
241239 {
242
- if (sdp->sd_log_bio) {
240
+ struct bio *bio = *biop;
241
+ if (bio) {
242
+ struct gfs2_sbd *sdp = bio->bi_private;
243243 atomic_inc(&sdp->sd_log_in_flight);
244
- bio_set_op_attrs(sdp->sd_log_bio, op, op_flags);
245
- submit_bio(sdp->sd_log_bio);
246
- sdp->sd_log_bio = NULL;
244
+ bio->bi_opf = opf;
245
+ submit_bio(bio);
246
+ *biop = NULL;
247247 }
248248 }
249249
250250 /**
251
- * gfs2_log_alloc_bio - Allocate a new bio for log writing
252
- * @sdp: The superblock
253
- * @blkno: The next device block number we want to write to
251
+ * gfs2_log_alloc_bio - Allocate a bio
252
+ * @sdp: The super block
253
+ * @blkno: The device block number we want to write to
254
+ * @end_io: The bi_end_io callback
254255 *
255
- * This should never be called when there is a cached bio in the
256
- * super block. When it returns, there will be a cached bio in the
257
- * super block which will have as many bio_vecs as the device is
258
- * happy to handle.
256
+ * Allocate a new bio, initialize it with the given parameters and return it.
259257 *
260
- * Returns: Newly allocated bio
258
+ * Returns: The newly allocated bio
261259 */
262260
263
-static struct bio *gfs2_log_alloc_bio(struct gfs2_sbd *sdp, u64 blkno)
261
+static struct bio *gfs2_log_alloc_bio(struct gfs2_sbd *sdp, u64 blkno,
262
+ bio_end_io_t *end_io)
264263 {
265264 struct super_block *sb = sdp->sd_vfs;
266
- struct bio *bio;
265
+ struct bio *bio = bio_alloc(GFP_NOIO, BIO_MAX_PAGES);
267266
268
- BUG_ON(sdp->sd_log_bio);
269
-
270
- bio = bio_alloc(GFP_NOIO, BIO_MAX_PAGES);
271
- bio->bi_iter.bi_sector = blkno * (sb->s_blocksize >> 9);
267
+ bio->bi_iter.bi_sector = blkno << sdp->sd_fsb2bb_shift;
272268 bio_set_dev(bio, sb->s_bdev);
273
- bio->bi_end_io = gfs2_end_log_write;
269
+ bio->bi_end_io = end_io;
274270 bio->bi_private = sdp;
275
-
276
- sdp->sd_log_bio = bio;
277271
278272 return bio;
279273 }
280274
281275 /**
282276 * gfs2_log_get_bio - Get cached log bio, or allocate a new one
283
- * @sdp: The superblock
277
+ * @sdp: The super block
284278 * @blkno: The device block number we want to write to
279
+ * @bio: The bio to get or allocate
280
+ * @op: REQ_OP
281
+ * @end_io: The bi_end_io callback
282
+ * @flush: Always flush the current bio and allocate a new one?
285283 *
286284 * If there is a cached bio, then if the next block number is sequential
287285 * with the previous one, return it, otherwise flush the bio to the
288
- * device. If there is not a cached bio, or we just flushed it, then
286
+ * device. If there is no cached bio, or we just flushed it, then
289287 * allocate a new one.
290288 *
291289 * Returns: The bio to use for log writes
292290 */
293291
294
-static struct bio *gfs2_log_get_bio(struct gfs2_sbd *sdp, u64 blkno)
292
+static struct bio *gfs2_log_get_bio(struct gfs2_sbd *sdp, u64 blkno,
293
+ struct bio **biop, int op,
294
+ bio_end_io_t *end_io, bool flush)
295295 {
296
- struct bio *bio = sdp->sd_log_bio;
297
- u64 nblk;
296
+ struct bio *bio = *biop;
298297
299298 if (bio) {
299
+ u64 nblk;
300
+
300301 nblk = bio_end_sector(bio);
301302 nblk >>= sdp->sd_fsb2bb_shift;
302
- if (blkno == nblk)
303
+ if (blkno == nblk && !flush)
303304 return bio;
304
- gfs2_log_flush_bio(sdp, REQ_OP_WRITE, 0);
305
+ gfs2_log_submit_bio(biop, op);
305306 }
306307
307
- return gfs2_log_alloc_bio(sdp, blkno);
308
+ *biop = gfs2_log_alloc_bio(sdp, blkno, end_io);
309
+ return *biop;
308310 }
309311
310312 /**
....@@ -326,11 +328,12 @@
326328 struct bio *bio;
327329 int ret;
328330
329
- bio = gfs2_log_get_bio(sdp, blkno);
331
+ bio = gfs2_log_get_bio(sdp, blkno, &sdp->sd_log_bio, REQ_OP_WRITE,
332
+ gfs2_end_log_write, false);
330333 ret = bio_add_page(bio, page, size, offset);
331334 if (ret == 0) {
332
- gfs2_log_flush_bio(sdp, REQ_OP_WRITE, 0);
333
- bio = gfs2_log_alloc_bio(sdp, blkno);
335
+ bio = gfs2_log_get_bio(sdp, blkno, &sdp->sd_log_bio,
336
+ REQ_OP_WRITE, gfs2_end_log_write, true);
334337 ret = bio_add_page(bio, page, size, offset);
335338 WARN_ON(ret == 0);
336339 }
....@@ -348,8 +351,11 @@
348351
349352 static void gfs2_log_write_bh(struct gfs2_sbd *sdp, struct buffer_head *bh)
350353 {
351
- gfs2_log_write(sdp, bh->b_page, bh->b_size, bh_offset(bh),
352
- gfs2_log_bmap(sdp));
354
+ u64 dblock;
355
+
356
+ dblock = gfs2_log_bmap(sdp->sd_jdesc, sdp->sd_log_flush_head);
357
+ gfs2_log_incr_head(sdp);
358
+ gfs2_log_write(sdp, bh->b_page, bh->b_size, bh_offset(bh), dblock);
353359 }
354360
355361 /**
....@@ -366,8 +372,230 @@
366372 void gfs2_log_write_page(struct gfs2_sbd *sdp, struct page *page)
367373 {
368374 struct super_block *sb = sdp->sd_vfs;
369
- gfs2_log_write(sdp, page, sb->s_blocksize, 0,
370
- gfs2_log_bmap(sdp));
375
+ u64 dblock;
376
+
377
+ dblock = gfs2_log_bmap(sdp->sd_jdesc, sdp->sd_log_flush_head);
378
+ gfs2_log_incr_head(sdp);
379
+ gfs2_log_write(sdp, page, sb->s_blocksize, 0, dblock);
380
+}
381
+
382
+/**
383
+ * gfs2_end_log_read - end I/O callback for reads from the log
384
+ * @bio: The bio
385
+ *
386
+ * Simply unlock the pages in the bio. The main thread will wait on them and
387
+ * process them in order as necessary.
388
+ */
389
+
390
+static void gfs2_end_log_read(struct bio *bio)
391
+{
392
+ struct page *page;
393
+ struct bio_vec *bvec;
394
+ struct bvec_iter_all iter_all;
395
+
396
+ bio_for_each_segment_all(bvec, bio, iter_all) {
397
+ page = bvec->bv_page;
398
+ if (bio->bi_status) {
399
+ int err = blk_status_to_errno(bio->bi_status);
400
+
401
+ SetPageError(page);
402
+ mapping_set_error(page->mapping, err);
403
+ }
404
+ unlock_page(page);
405
+ }
406
+
407
+ bio_put(bio);
408
+}
409
+
410
+/**
411
+ * gfs2_jhead_pg_srch - Look for the journal head in a given page.
412
+ * @jd: The journal descriptor
413
+ * @page: The page to look in
414
+ *
415
+ * Returns: 1 if found, 0 otherwise.
416
+ */
417
+
418
+static bool gfs2_jhead_pg_srch(struct gfs2_jdesc *jd,
419
+ struct gfs2_log_header_host *head,
420
+ struct page *page)
421
+{
422
+ struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
423
+ struct gfs2_log_header_host lh;
424
+ void *kaddr = kmap_atomic(page);
425
+ unsigned int offset;
426
+ bool ret = false;
427
+
428
+ for (offset = 0; offset < PAGE_SIZE; offset += sdp->sd_sb.sb_bsize) {
429
+ if (!__get_log_header(sdp, kaddr + offset, 0, &lh)) {
430
+ if (lh.lh_sequence >= head->lh_sequence)
431
+ *head = lh;
432
+ else {
433
+ ret = true;
434
+ break;
435
+ }
436
+ }
437
+ }
438
+ kunmap_atomic(kaddr);
439
+ return ret;
440
+}
441
+
442
+/**
443
+ * gfs2_jhead_process_page - Search/cleanup a page
444
+ * @jd: The journal descriptor
445
+ * @index: Index of the page to look into
446
+ * @done: If set, perform only cleanup, else search and set if found.
447
+ *
448
+ * Find the page with 'index' in the journal's mapping. Search the page for
449
+ * the journal head if requested (cleanup == false). Release refs on the
450
+ * page so the page cache can reclaim it (put_page() twice). We grabbed a
451
+ * reference on this page two times, first when we did a find_or_create_page()
452
+ * to obtain the page to add it to the bio and second when we do a
453
+ * find_get_page() here to get the page to wait on while I/O on it is being
454
+ * completed.
455
+ * This function is also used to free up a page we might've grabbed but not
456
+ * used. Maybe we added it to a bio, but not submitted it for I/O. Or we
457
+ * submitted the I/O, but we already found the jhead so we only need to drop
458
+ * our references to the page.
459
+ */
460
+
461
+static void gfs2_jhead_process_page(struct gfs2_jdesc *jd, unsigned long index,
462
+ struct gfs2_log_header_host *head,
463
+ bool *done)
464
+{
465
+ struct page *page;
466
+
467
+ page = find_get_page(jd->jd_inode->i_mapping, index);
468
+ wait_on_page_locked(page);
469
+
470
+ if (PageError(page))
471
+ *done = true;
472
+
473
+ if (!*done)
474
+ *done = gfs2_jhead_pg_srch(jd, head, page);
475
+
476
+ put_page(page); /* Once for find_get_page */
477
+ put_page(page); /* Once more for find_or_create_page */
478
+}
479
+
480
+static struct bio *gfs2_chain_bio(struct bio *prev, unsigned int nr_iovecs)
481
+{
482
+ struct bio *new;
483
+
484
+ new = bio_alloc(GFP_NOIO, nr_iovecs);
485
+ bio_copy_dev(new, prev);
486
+ new->bi_iter.bi_sector = bio_end_sector(prev);
487
+ new->bi_opf = prev->bi_opf;
488
+ new->bi_write_hint = prev->bi_write_hint;
489
+ bio_chain(new, prev);
490
+ submit_bio(prev);
491
+ return new;
492
+}
493
+
494
+/**
495
+ * gfs2_find_jhead - find the head of a log
496
+ * @jd: The journal descriptor
497
+ * @head: The log descriptor for the head of the log is returned here
498
+ *
499
+ * Do a search of a journal by reading it in large chunks using bios and find
500
+ * the valid log entry with the highest sequence number. (i.e. the log head)
501
+ *
502
+ * Returns: 0 on success, errno otherwise
503
+ */
504
+int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head,
505
+ bool keep_cache)
506
+{
507
+ struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
508
+ struct address_space *mapping = jd->jd_inode->i_mapping;
509
+ unsigned int block = 0, blocks_submitted = 0, blocks_read = 0;
510
+ unsigned int bsize = sdp->sd_sb.sb_bsize, off;
511
+ unsigned int bsize_shift = sdp->sd_sb.sb_bsize_shift;
512
+ unsigned int shift = PAGE_SHIFT - bsize_shift;
513
+ unsigned int max_blocks = 2 * 1024 * 1024 >> bsize_shift;
514
+ struct gfs2_journal_extent *je;
515
+ int sz, ret = 0;
516
+ struct bio *bio = NULL;
517
+ struct page *page = NULL;
518
+ bool done = false;
519
+ errseq_t since;
520
+
521
+ memset(head, 0, sizeof(*head));
522
+ if (list_empty(&jd->extent_list))
523
+ gfs2_map_journal_extents(sdp, jd);
524
+
525
+ since = filemap_sample_wb_err(mapping);
526
+ list_for_each_entry(je, &jd->extent_list, list) {
527
+ u64 dblock = je->dblock;
528
+
529
+ for (; block < je->lblock + je->blocks; block++, dblock++) {
530
+ if (!page) {
531
+ page = find_or_create_page(mapping,
532
+ block >> shift, GFP_NOFS);
533
+ if (!page) {
534
+ ret = -ENOMEM;
535
+ done = true;
536
+ goto out;
537
+ }
538
+ off = 0;
539
+ }
540
+
541
+ if (bio && (off || block < blocks_submitted + max_blocks)) {
542
+ sector_t sector = dblock << sdp->sd_fsb2bb_shift;
543
+
544
+ if (bio_end_sector(bio) == sector) {
545
+ sz = bio_add_page(bio, page, bsize, off);
546
+ if (sz == bsize)
547
+ goto block_added;
548
+ }
549
+ if (off) {
550
+ unsigned int blocks =
551
+ (PAGE_SIZE - off) >> bsize_shift;
552
+
553
+ bio = gfs2_chain_bio(bio, blocks);
554
+ goto add_block_to_new_bio;
555
+ }
556
+ }
557
+
558
+ if (bio) {
559
+ blocks_submitted = block;
560
+ submit_bio(bio);
561
+ }
562
+
563
+ bio = gfs2_log_alloc_bio(sdp, dblock, gfs2_end_log_read);
564
+ bio->bi_opf = REQ_OP_READ;
565
+add_block_to_new_bio:
566
+ sz = bio_add_page(bio, page, bsize, off);
567
+ BUG_ON(sz != bsize);
568
+block_added:
569
+ off += bsize;
570
+ if (off == PAGE_SIZE)
571
+ page = NULL;
572
+ if (blocks_submitted <= blocks_read + max_blocks) {
573
+ /* Keep at least one bio in flight */
574
+ continue;
575
+ }
576
+
577
+ gfs2_jhead_process_page(jd, blocks_read >> shift, head, &done);
578
+ blocks_read += PAGE_SIZE >> bsize_shift;
579
+ if (done)
580
+ goto out; /* found */
581
+ }
582
+ }
583
+
584
+out:
585
+ if (bio)
586
+ submit_bio(bio);
587
+ while (blocks_read < block) {
588
+ gfs2_jhead_process_page(jd, blocks_read >> shift, head, &done);
589
+ blocks_read += PAGE_SIZE >> bsize_shift;
590
+ }
591
+
592
+ if (!ret)
593
+ ret = filemap_check_wb_err(mapping, since);
594
+
595
+ if (!keep_cache)
596
+ truncate_inode_pages(mapping, 0);
597
+
598
+ return ret;
371599 }
372600
373601 static struct page *gfs2_get_log_desc(struct gfs2_sbd *sdp, u32 ld_type,
....@@ -507,7 +735,7 @@
507735
508736 head = &tr->tr_buf;
509737 while (!list_empty(head)) {
510
- bd = list_entry(head->next, struct gfs2_bufdata, bd_list);
738
+ bd = list_first_entry(head, struct gfs2_bufdata, bd_list);
511739 list_del_init(&bd->bd_list);
512740 gfs2_unpin(sdp, bd->bd_bh, tr);
513741 }
....@@ -523,7 +751,7 @@
523751 jd->jd_replayed_blocks = 0;
524752 }
525753
526
-static int buf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
754
+static int buf_lo_scan_elements(struct gfs2_jdesc *jd, u32 start,
527755 struct gfs2_log_descriptor *ld, __be64 *ptr,
528756 int pass)
529757 {
....@@ -557,9 +785,27 @@
557785
558786 if (gfs2_meta_check(sdp, bh_ip))
559787 error = -EIO;
560
- else
561
- mark_buffer_dirty(bh_ip);
788
+ else {
789
+ struct gfs2_meta_header *mh =
790
+ (struct gfs2_meta_header *)bh_ip->b_data;
562791
792
+ if (mh->mh_type == cpu_to_be32(GFS2_METATYPE_RG)) {
793
+ struct gfs2_rgrpd *rgd;
794
+
795
+ rgd = gfs2_blk2rgrpd(sdp, blkno, false);
796
+ if (rgd && rgd->rd_addr == blkno &&
797
+ rgd->rd_bits && rgd->rd_bits->bi_bh) {
798
+ fs_info(sdp, "Replaying 0x%llx but we "
799
+ "already have a bh!\n",
800
+ (unsigned long long)blkno);
801
+ fs_info(sdp, "busy:%d, pinned:%d\n",
802
+ buffer_busy(rgd->rd_bits->bi_bh) ? 1 : 0,
803
+ buffer_pinned(rgd->rd_bits->bi_bh));
804
+ gfs2_dump_glock(NULL, rgd->rd_gl, true);
805
+ }
806
+ }
807
+ mark_buffer_dirty(bh_ip);
808
+ }
563809 brelse(bh_log);
564810 brelse(bh_ip);
565811
....@@ -572,41 +818,19 @@
572818 return error;
573819 }
574820
575
-/**
576
- * gfs2_meta_sync - Sync all buffers associated with a glock
577
- * @gl: The glock
578
- *
579
- */
580
-
581
-static void gfs2_meta_sync(struct gfs2_glock *gl)
582
-{
583
- struct address_space *mapping = gfs2_glock2aspace(gl);
584
- struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
585
- int error;
586
-
587
- if (mapping == NULL)
588
- mapping = &sdp->sd_aspace;
589
-
590
- filemap_fdatawrite(mapping);
591
- error = filemap_fdatawait(mapping);
592
-
593
- if (error)
594
- gfs2_io_error(gl->gl_name.ln_sbd);
595
-}
596
-
597821 static void buf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass)
598822 {
599823 struct gfs2_inode *ip = GFS2_I(jd->jd_inode);
600824 struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
601825
602826 if (error) {
603
- gfs2_meta_sync(ip->i_gl);
827
+ gfs2_inode_metasync(ip->i_gl);
604828 return;
605829 }
606830 if (pass != 1)
607831 return;
608832
609
- gfs2_meta_sync(ip->i_gl);
833
+ gfs2_inode_metasync(ip->i_gl);
610834
611835 fs_info(sdp, "jid=%u: Replayed %u of %u blocks\n",
612836 jd->jd_jid, jd->jd_replayed_blocks, jd->jd_found_blocks);
....@@ -616,7 +840,7 @@
616840 {
617841 struct gfs2_meta_header *mh;
618842 unsigned int offset;
619
- struct list_head *head = &sdp->sd_log_le_revoke;
843
+ struct list_head *head = &sdp->sd_log_revokes;
620844 struct gfs2_bufdata *bd;
621845 struct page *page;
622846 unsigned int length;
....@@ -625,7 +849,7 @@
625849 if (!sdp->sd_log_num_revoke)
626850 return;
627851
628
- length = gfs2_struct2blk(sdp, sdp->sd_log_num_revoke, sizeof(u64));
852
+ length = gfs2_struct2blk(sdp, sdp->sd_log_num_revoke);
629853 page = gfs2_get_log_desc(sdp, GFS2_LOG_DESC_REVOKE, length, sdp->sd_log_num_revoke);
630854 offset = sizeof(struct gfs2_log_descriptor);
631855
....@@ -654,12 +878,12 @@
654878
655879 static void revoke_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
656880 {
657
- struct list_head *head = &sdp->sd_log_le_revoke;
881
+ struct list_head *head = &sdp->sd_log_revokes;
658882 struct gfs2_bufdata *bd;
659883 struct gfs2_glock *gl;
660884
661885 while (!list_empty(head)) {
662
- bd = list_entry(head->next, struct gfs2_bufdata, bd_list);
886
+ bd = list_first_entry(head, struct gfs2_bufdata, bd_list);
663887 list_del_init(&bd->bd_list);
664888 gl = bd->bd_gl;
665889 gfs2_glock_remove_revoke(gl);
....@@ -677,7 +901,7 @@
677901 jd->jd_replay_tail = head->lh_tail;
678902 }
679903
680
-static int revoke_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
904
+static int revoke_lo_scan_elements(struct gfs2_jdesc *jd, u32 start,
681905 struct gfs2_log_descriptor *ld, __be64 *ptr,
682906 int pass)
683907 {
....@@ -759,7 +983,7 @@
759983 gfs2_before_commit(sdp, limit, nbuf, &tr->tr_databuf, 1);
760984 }
761985
762
-static int databuf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
986
+static int databuf_lo_scan_elements(struct gfs2_jdesc *jd, u32 start,
763987 struct gfs2_log_descriptor *ld,
764988 __be64 *ptr, int pass)
765989 {
....@@ -815,14 +1039,14 @@
8151039 struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
8161040
8171041 if (error) {
818
- gfs2_meta_sync(ip->i_gl);
1042
+ gfs2_inode_metasync(ip->i_gl);
8191043 return;
8201044 }
8211045 if (pass != 1)
8221046 return;
8231047
8241048 /* data sync? */
825
- gfs2_meta_sync(ip->i_gl);
1049
+ gfs2_inode_metasync(ip->i_gl);
8261050
8271051 fs_info(sdp, "jid=%u: Replayed %u of %u data blocks\n",
8281052 jd->jd_jid, jd->jd_replayed_blocks, jd->jd_found_blocks);
....@@ -838,14 +1062,14 @@
8381062
8391063 head = &tr->tr_databuf;
8401064 while (!list_empty(head)) {
841
- bd = list_entry(head->next, struct gfs2_bufdata, bd_list);
1065
+ bd = list_first_entry(head, struct gfs2_bufdata, bd_list);
8421066 list_del_init(&bd->bd_list);
8431067 gfs2_unpin(sdp, bd->bd_bh, tr);
8441068 }
8451069 }
8461070
8471071
848
-const struct gfs2_log_operations gfs2_buf_lops = {
1072
+static const struct gfs2_log_operations gfs2_buf_lops = {
8491073 .lo_before_commit = buf_lo_before_commit,
8501074 .lo_after_commit = buf_lo_after_commit,
8511075 .lo_before_scan = buf_lo_before_scan,
....@@ -854,7 +1078,7 @@
8541078 .lo_name = "buf",
8551079 };
8561080
857
-const struct gfs2_log_operations gfs2_revoke_lops = {
1081
+static const struct gfs2_log_operations gfs2_revoke_lops = {
8581082 .lo_before_commit = revoke_lo_before_commit,
8591083 .lo_after_commit = revoke_lo_after_commit,
8601084 .lo_before_scan = revoke_lo_before_scan,
....@@ -863,7 +1087,7 @@
8631087 .lo_name = "revoke",
8641088 };
8651089
866
-const struct gfs2_log_operations gfs2_databuf_lops = {
1090
+static const struct gfs2_log_operations gfs2_databuf_lops = {
8671091 .lo_before_commit = databuf_lo_before_commit,
8681092 .lo_after_commit = databuf_lo_after_commit,
8691093 .lo_scan_elements = databuf_lo_scan_elements,