On Thu, 23 May 2019 at 15:05, Bob Peterson <rpete...@redhat.com> wrote: > > This patch replaces a few leftover printk errors with calls to > fs_info and similar, so that the file system having the error is > properly logged. > > Signed-off-by: Bob Peterson <rpete...@redhat.com> > --- > fs/gfs2/bmap.c | 2 +- > fs/gfs2/glops.c | 3 ++- > fs/gfs2/rgrp.c | 27 ++++++++++++++------------- > fs/gfs2/super.c | 6 +++--- > 4 files changed, 20 insertions(+), 18 deletions(-) > > diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c > index f42718dd292f..a809aa887521 100644 > --- a/fs/gfs2/bmap.c > +++ b/fs/gfs2/bmap.c > @@ -1862,7 +1862,7 @@ static int punch_hole(struct gfs2_inode *ip, u64 > offset, u64 length) > gfs2_assert_withdraw(sdp, bh); > if (gfs2_assert_withdraw(sdp, > prev_bnr != bh->b_blocknr)) { > - printk(KERN_EMERG "GFS2: fsid=%s:inode %llu, " > + fs_emerg(sdp, "GFS2: fsid=%s:inode %llu, " > "block:%llu, i_h:%u, s_h:%u, > mp_h:%u\n", > sdp->sd_fsname, > (unsigned long long)ip->i_no_addr,
The fsid is printed twice here; that won't help. > diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c > index 84a403ed6e77..1e5720e50e9c 100644 > --- a/fs/gfs2/glops.c > +++ b/fs/gfs2/glops.c > @@ -509,7 +509,8 @@ static void freeze_go_sync(struct gfs2_glock *gl) > atomic_set(&sdp->sd_freeze_state, SFS_STARTING_FREEZE); > error = freeze_super(sdp->sd_vfs); > if (error) { > - printk(KERN_INFO "GFS2: couldn't freeze filesystem: > %d\n", error); > + fs_info(sdp, "GFS2: couldn't freeze filesystem: %d\n", > + error); > gfs2_assert_withdraw(sdp, 0); > } > queue_work(gfs2_freeze_wq, &sdp->sd_freeze_work); > diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c > index ed3a6d3973a9..985d968b042c 100644 > --- a/fs/gfs2/rgrp.c > +++ b/fs/gfs2/rgrp.c > @@ -1115,32 +1115,33 @@ static int gfs2_rgrp_lvb_valid(struct gfs2_rgrpd *rgd) > { > struct gfs2_rgrp_lvb *rgl = rgd->rd_rgl; > struct gfs2_rgrp *str = (struct gfs2_rgrp > *)rgd->rd_bits[0].bi_bh->b_data; > + struct gfs2_sbd *sdp = rgd->rd_sbd; > int valid = 1; > > if (rgl->rl_flags != str->rg_flags) { > - printk(KERN_WARNING "GFS2: rgd: %llu lvb flag mismatch %u/%u", > - (unsigned long long)rgd->rd_addr, > + fs_warn(sdp, "GFS2: rgd: %llu lvb flag mismatch %u/%u", > + (unsigned long long)rgd->rd_addr, > be32_to_cpu(rgl->rl_flags), > be32_to_cpu(str->rg_flags)); > valid = 0; > } > if (rgl->rl_free != str->rg_free) { > - printk(KERN_WARNING "GFS2: rgd: %llu lvb free mismatch %u/%u", > - (unsigned long long)rgd->rd_addr, > - be32_to_cpu(rgl->rl_free), be32_to_cpu(str->rg_free)); > + fs_warn(sdp, "GFS2: rgd: %llu lvb free mismatch %u/%u", > + (unsigned long long)rgd->rd_addr, > + be32_to_cpu(rgl->rl_free), be32_to_cpu(str->rg_free)); > valid = 0; > } > if (rgl->rl_dinodes != str->rg_dinodes) { > - printk(KERN_WARNING "GFS2: rgd: %llu lvb dinode mismatch > %u/%u", > - (unsigned long long)rgd->rd_addr, > - be32_to_cpu(rgl->rl_dinodes), > - be32_to_cpu(str->rg_dinodes)); > + fs_warn(sdp, "GFS2: rgd: %llu lvb dinode mismatch %u/%u", > + (unsigned long long)rgd->rd_addr, > + be32_to_cpu(rgl->rl_dinodes), > + be32_to_cpu(str->rg_dinodes)); > valid = 0; > } > if (rgl->rl_igeneration != str->rg_igeneration) { > - printk(KERN_WARNING "GFS2: rgd: %llu lvb igen mismatch " > - "%llu/%llu", (unsigned long long)rgd->rd_addr, > - (unsigned long long)be64_to_cpu(rgl->rl_igeneration), > - (unsigned long long)be64_to_cpu(str->rg_igeneration)); > + fs_warn(sdp, "GFS2: rgd: %llu lvb igen mismatch %llu/%llu", > + (unsigned long long)rgd->rd_addr, > + (unsigned long long)be64_to_cpu(rgl->rl_igeneration), > + (unsigned long long)be64_to_cpu(str->rg_igeneration)); > valid = 0; > } > return valid; > diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c > index 6e3a318edccd..62cc451f30d5 100644 > --- a/fs/gfs2/super.c > +++ b/fs/gfs2/super.c > @@ -981,14 +981,14 @@ void gfs2_freeze_func(struct work_struct *work) > error = gfs2_glock_nq_init(sdp->sd_freeze_gl, LM_ST_SHARED, 0, > &freeze_gh); > if (error) { > - printk(KERN_INFO "GFS2: couldn't get freeze lock : %d\n", > error); > + fs_info(sdp, "GFS2: couldn't get freeze lock : %d\n", error); > gfs2_assert_withdraw(sdp, 0); > } else { > atomic_set(&sdp->sd_freeze_state, SFS_UNFROZEN); > error = thaw_super(sb); > if (error) { > - printk(KERN_INFO "GFS2: couldn't thaw filesystem: > %d\n", > - error); > + fs_info(sdp, "GFS2: couldn't thaw filesystem: %d\n", > + error); > gfs2_assert_withdraw(sdp, 0); > } > if (!test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) > -- > 2.21.0 > Thanks, Andreas