diff options
author | Andreas Gruenbacher <agruenba@redhat.com> | 2020-12-06 14:04:36 +0100 |
---|---|---|
committer | Andreas Gruenbacher <agruenba@redhat.com> | 2021-02-03 18:37:25 +0100 |
commit | 297de3180dd7ecbb3798f32e58691168587a8f85 (patch) | |
tree | 44d329de72355bc7758dc8bf70da42e6c32d6514 /fs/gfs2 | |
parent | 5ae8fff8d031b5728f4c0e36e971bba42bb78bea (diff) |
gfs2: Use a tighter bound in gfs2_trans_begin
Use a tighter bound for the number of blocks required by transactions in
gfs2_trans_begin: in the worst case, we'll have mixed data and metadata,
so we'll need a log desciptor for each type.
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r-- | fs/gfs2/trans.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c index cac93b2004cf..f73d6b8f3b53 100644 --- a/fs/gfs2/trans.c +++ b/fs/gfs2/trans.c @@ -54,8 +54,14 @@ int __gfs2_trans_begin(struct gfs2_trans *tr, struct gfs2_sbd *sdp, tr->tr_blocks = blocks; tr->tr_revokes = revokes; tr->tr_reserved = 1; - if (blocks) - tr->tr_reserved += 6 + blocks; + if (blocks) { + /* + * The reserved blocks are either used for data or metadata. + * We can have mixed data and metadata, each with its own log + * descriptor block; see calc_reserved(). + */ + tr->tr_reserved += blocks + 1 + DIV_ROUND_UP(blocks - 1, databuf_limit(sdp)); + } if (revokes) tr->tr_reserved += gfs2_struct2blk(sdp, revokes); INIT_LIST_HEAD(&tr->tr_databuf); |