Skip to content

Commit b259896

Browse files
author
Andreas Gruenbacher
committed
gfs2: Don't search for unreserved space twice
If gfs2_inplace_reserve has chosen a resource group but it couldn't make a reservation there, there are too many other reservations in that resource group. In that case, don't even try to respect existing reservations in gfs2_alloc_blocks. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
1 parent 3d39fcd commit b259896

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

fs/gfs2/rgrp.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2384,11 +2384,12 @@ int gfs2_alloc_blocks(struct gfs2_inode *ip, u64 *bn, unsigned int *nblocks,
23842384
struct gfs2_rbm rbm = { .rgd = ip->i_res.rs_rgd, };
23852385
u64 block; /* block, within the file system scope */
23862386
u32 minext = 1;
2387-
int error;
2388-
2389-
gfs2_set_alloc_start(&rbm, ip, dinode);
2390-
error = gfs2_rbm_find(&rbm, GFS2_BLKST_FREE, &minext, &ip->i_res, false);
2387+
int error = -ENOSPC;
23912388

2389+
if (gfs2_rs_active(&ip->i_res)) {
2390+
gfs2_set_alloc_start(&rbm, ip, dinode);
2391+
error = gfs2_rbm_find(&rbm, GFS2_BLKST_FREE, &minext, &ip->i_res, false);
2392+
}
23922393
if (error == -ENOSPC) {
23932394
gfs2_set_alloc_start(&rbm, ip, dinode);
23942395
error = gfs2_rbm_find(&rbm, GFS2_BLKST_FREE, &minext, NULL, false);

0 commit comments

Comments
 (0)