On Fri, Aug 21, 2020 at 7:33 PM Bob Peterson <rpete...@redhat.com> wrote: > Before this patch, function gfs2_evict_inode would start a transaction > in order to write some unknown number of revokes. Instead of calculating > the value, it used sdp->sd_jdesc->jd_blocks, the number of blocks in the > entire journal. You can fit a lot of revokes in a block (in a 4K block > you can fit 503 of them). For a 512MB journal has 131072 blocks, it would > ask for 261 free blocks. > > This patch changes it to calculate the number of revokes based on the > nrpages values of the address space plus glock address space. Note that > since it does this after clearing out the ail list, we don't need to > use the number of (old) revokes in the calculation. We calculate it from > the number of standing new items that need revoking. > > Signed-off-by: Bob Peterson <rpete...@redhat.com> > --- > fs/gfs2/super.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c > index 9f4d9e7be839..80ac446f0110 100644 > --- a/fs/gfs2/super.c > +++ b/fs/gfs2/super.c > @@ -1336,6 +1336,7 @@ static void gfs2_evict_inode(struct inode *inode) > struct gfs2_inode *ip = GFS2_I(inode); > struct gfs2_holder gh; > struct address_space *metamapping; > + int nr_revokes; > int error; > > if (test_bit(GIF_FREE_VFS_INODE, &ip->i_flags)) { > @@ -1434,7 +1435,11 @@ static void gfs2_evict_inode(struct inode *inode) > write_inode_now(inode, 1); > gfs2_ail_flush(ip->i_gl, 0); > > - error = gfs2_trans_begin(sdp, 0, sdp->sd_jdesc->jd_blocks); > + nr_revokes = inode->i_mapping->nrpages + metamapping->nrpages;
We could surely use a more realistic number of revokes here, but this approach really doesn't make any sense, sorry. > + if (!nr_revokes) > + goto out_unlock; > + > + error = gfs2_trans_begin(sdp, 0, nr_revokes); > if (error) > goto out_unlock; > /* Needs to be done before glock release & also in a transaction */ > -- > 2.26.2 Thanks, Andreas