Change gfs2_log_flush_bio to accept a pointer to the struct bio* to be flushed. Change gfs2_log_alloc_bio and gfs2_log_get_bio to take a struct gfs2_jdesc* instead of gfs2_sbd.
Signed-off-by: Abhi Das <a...@redhat.com> --- fs/gfs2/log.c | 4 ++-- fs/gfs2/lops.c | 34 +++++++++++++++++++--------------- fs/gfs2/lops.h | 2 +- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c index ee20ea42..b80fb30 100644 --- a/fs/gfs2/log.c +++ b/fs/gfs2/log.c @@ -731,7 +731,7 @@ void gfs2_write_log_header(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd, lh->lh_crc = cpu_to_be32(crc); gfs2_log_write(sdp, page, sb->s_blocksize, 0, addr); - gfs2_log_flush_bio(sdp, REQ_OP_WRITE, op_flags); + gfs2_log_flush_bio(&sdp->sd_log_bio, REQ_OP_WRITE, op_flags); log_flush_wait(sdp); } @@ -808,7 +808,7 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl, u32 flags) gfs2_ordered_write(sdp); lops_before_commit(sdp, tr); - gfs2_log_flush_bio(sdp, REQ_OP_WRITE, 0); + gfs2_log_flush_bio(&sdp->sd_log_bio, REQ_OP_WRITE, 0); if (sdp->sd_log_head != sdp->sd_log_flush_head) { log_flush_wait(sdp); diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c index f2567f9..4cc19af 100644 --- a/fs/gfs2/lops.c +++ b/fs/gfs2/lops.c @@ -229,7 +229,7 @@ static void gfs2_end_log_write(struct bio *bio) /** * gfs2_log_flush_bio - Submit any pending log bio - * @sdp: The superblock + * @biop: Address of the bio pointer * @op: REQ_OP * @op_flags: req_flag_bits * @@ -237,19 +237,21 @@ static void gfs2_end_log_write(struct bio *bio) * there is no pending bio, then this is a no-op. */ -void gfs2_log_flush_bio(struct gfs2_sbd *sdp, int op, int op_flags) +void gfs2_log_flush_bio(struct bio **biop, int op, int op_flags) { - if (sdp->sd_log_bio) { + struct bio *bio = *biop; + if (bio) { + struct gfs2_sbd *sdp = bio->bi_private; atomic_inc(&sdp->sd_log_in_flight); - bio_set_op_attrs(sdp->sd_log_bio, op, op_flags); - submit_bio(sdp->sd_log_bio); - sdp->sd_log_bio = NULL; + bio_set_op_attrs(bio, op, op_flags); + submit_bio(bio); + *biop = NULL; } } /** * gfs2_log_alloc_bio - Allocate a new bio for log writing - * @sdp: The superblock + * @jd: The journal descriptor * @blkno: The next device block number we want to write to * * This should never be called when there is a cached bio in the @@ -260,8 +262,9 @@ void gfs2_log_flush_bio(struct gfs2_sbd *sdp, int op, int op_flags) * Returns: Newly allocated bio */ -static struct bio *gfs2_log_alloc_bio(struct gfs2_sbd *sdp, u64 blkno) +static struct bio *gfs2_log_alloc_bio(struct gfs2_jdesc *jd, u64 blkno) { + struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode); struct super_block *sb = sdp->sd_vfs; struct bio *bio; @@ -280,7 +283,7 @@ static struct bio *gfs2_log_alloc_bio(struct gfs2_sbd *sdp, u64 blkno) /** * gfs2_log_get_bio - Get cached log bio, or allocate a new one - * @sdp: The superblock + * @jd: The journal descriptor * @blkno: The device block number we want to write to * * If there is a cached bio, then if the next block number is sequential @@ -291,8 +294,9 @@ static struct bio *gfs2_log_alloc_bio(struct gfs2_sbd *sdp, u64 blkno) * Returns: The bio to use for log writes */ -static struct bio *gfs2_log_get_bio(struct gfs2_sbd *sdp, u64 blkno) +static struct bio *gfs2_log_get_bio(struct gfs2_jdesc *jd, u64 blkno) { + struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode); struct bio *bio = sdp->sd_log_bio; u64 nblk; @@ -301,10 +305,10 @@ static struct bio *gfs2_log_get_bio(struct gfs2_sbd *sdp, u64 blkno) nblk >>= sdp->sd_fsb2bb_shift; if (blkno == nblk) return bio; - gfs2_log_flush_bio(sdp, REQ_OP_WRITE, 0); + gfs2_log_flush_bio(&sdp->sd_log_bio, REQ_OP_WRITE, 0); } - return gfs2_log_alloc_bio(sdp, blkno); + return gfs2_log_alloc_bio(sdp->sd_jdesc, blkno); } /** @@ -326,11 +330,11 @@ void gfs2_log_write(struct gfs2_sbd *sdp, struct page *page, struct bio *bio; int ret; - bio = gfs2_log_get_bio(sdp, blkno); + bio = gfs2_log_get_bio(sdp->sd_jdesc, blkno); ret = bio_add_page(bio, page, size, offset); if (ret == 0) { - gfs2_log_flush_bio(sdp, REQ_OP_WRITE, 0); - bio = gfs2_log_alloc_bio(sdp, blkno); + gfs2_log_flush_bio(&sdp->sd_log_bio, REQ_OP_WRITE, 0); + bio = gfs2_log_alloc_bio(sdp->sd_jdesc, blkno); ret = bio_add_page(bio, page, size, offset); WARN_ON(ret == 0); } diff --git a/fs/gfs2/lops.h b/fs/gfs2/lops.h index e494939..d709d99 100644 --- a/fs/gfs2/lops.h +++ b/fs/gfs2/lops.h @@ -30,7 +30,7 @@ extern u64 gfs2_log_bmap(struct gfs2_sbd *sdp); extern void gfs2_log_write(struct gfs2_sbd *sdp, struct page *page, unsigned size, unsigned offset, u64 blkno); extern void gfs2_log_write_page(struct gfs2_sbd *sdp, struct page *page); -extern void gfs2_log_flush_bio(struct gfs2_sbd *sdp, int op, int op_flags); +extern void gfs2_log_flush_bio(struct bio **biop, int op, int op_flags); extern void gfs2_pin(struct gfs2_sbd *sdp, struct buffer_head *bh); static inline unsigned int buf_limit(struct gfs2_sbd *sdp) -- 2.4.11