Skip to content

Commit 835e36b

Browse files
committed
Merge tag 'gfs2-v5.7-rc7.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2
Pull gfs2 fix from Andreas Gruenbacher: "Fix the previous, flawed gfs2_find_jhead commit" * tag 'gfs2-v5.7-rc7.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2: gfs2: Even more gfs2_find_jhead fixes
2 parents 4f23460 + 20be493 commit 835e36b

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

fs/gfs2/lops.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -509,12 +509,12 @@ int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head,
509509
unsigned int bsize = sdp->sd_sb.sb_bsize, off;
510510
unsigned int bsize_shift = sdp->sd_sb.sb_bsize_shift;
511511
unsigned int shift = PAGE_SHIFT - bsize_shift;
512-
unsigned int max_bio_size = 2 * 1024 * 1024;
512+
unsigned int max_blocks = 2 * 1024 * 1024 >> bsize_shift;
513513
struct gfs2_journal_extent *je;
514514
int sz, ret = 0;
515515
struct bio *bio = NULL;
516516
struct page *page = NULL;
517-
bool bio_chained = false, done = false;
517+
bool done = false;
518518
errseq_t since;
519519

520520
memset(head, 0, sizeof(*head));
@@ -537,10 +537,7 @@ int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head,
537537
off = 0;
538538
}
539539

540-
if (!bio || (bio_chained && !off) ||
541-
bio->bi_iter.bi_size >= max_bio_size) {
542-
/* start new bio */
543-
} else {
540+
if (bio && (off || block < blocks_submitted + max_blocks)) {
544541
sector_t sector = dblock << sdp->sd_fsb2bb_shift;
545542

546543
if (bio_end_sector(bio) == sector) {
@@ -553,27 +550,25 @@ int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head,
553550
(PAGE_SIZE - off) >> bsize_shift;
554551

555552
bio = gfs2_chain_bio(bio, blocks);
556-
bio_chained = true;
557553
goto add_block_to_new_bio;
558554
}
559555
}
560556

561557
if (bio) {
562-
blocks_submitted = block + 1;
558+
blocks_submitted = block;
563559
submit_bio(bio);
564560
}
565561

566562
bio = gfs2_log_alloc_bio(sdp, dblock, gfs2_end_log_read);
567563
bio->bi_opf = REQ_OP_READ;
568-
bio_chained = false;
569564
add_block_to_new_bio:
570565
sz = bio_add_page(bio, page, bsize, off);
571566
BUG_ON(sz != bsize);
572567
block_added:
573568
off += bsize;
574569
if (off == PAGE_SIZE)
575570
page = NULL;
576-
if (blocks_submitted < 2 * max_bio_size >> bsize_shift) {
571+
if (blocks_submitted <= blocks_read + max_blocks) {
577572
/* Keep at least one bio in flight */
578573
continue;
579574
}

0 commit comments

Comments
 (0)