|
@@ -1422,12 +1422,12 @@ static void rs_insert(struct gfs2_inode *ip)
|
|
|
* rg_mblk_search - find a group of multiple free blocks to form a reservation
|
|
|
* @rgd: the resource group descriptor
|
|
|
* @ip: pointer to the inode for which we're reserving blocks
|
|
|
- * @requested: number of blocks required for this allocation
|
|
|
+ * @ap: the allocation parameters
|
|
|
*
|
|
|
*/
|
|
|
|
|
|
static void rg_mblk_search(struct gfs2_rgrpd *rgd, struct gfs2_inode *ip,
|
|
|
- unsigned requested)
|
|
|
+ const struct gfs2_alloc_parms *ap)
|
|
|
{
|
|
|
struct gfs2_rbm rbm = { .rgd = rgd, };
|
|
|
u64 goal;
|
|
@@ -1440,7 +1440,7 @@ static void rg_mblk_search(struct gfs2_rgrpd *rgd, struct gfs2_inode *ip,
|
|
|
if (S_ISDIR(inode->i_mode))
|
|
|
extlen = 1;
|
|
|
else {
|
|
|
- extlen = max_t(u32, atomic_read(&rs->rs_sizehint), requested);
|
|
|
+ extlen = max_t(u32, atomic_read(&rs->rs_sizehint), ap->target);
|
|
|
extlen = clamp(extlen, RGRP_RSRV_MINBLKS, free_blocks);
|
|
|
}
|
|
|
if ((rgd->rd_free_clone < rgd->rd_reserved) || (free_blocks < extlen))
|
|
@@ -1831,12 +1831,12 @@ static bool gfs2_select_rgrp(struct gfs2_rgrpd **pos, const struct gfs2_rgrpd *b
|
|
|
/**
|
|
|
* gfs2_inplace_reserve - Reserve space in the filesystem
|
|
|
* @ip: the inode to reserve space for
|
|
|
- * @requested: the number of blocks to be reserved
|
|
|
+ * @ap: the allocation parameters
|
|
|
*
|
|
|
* Returns: errno
|
|
|
*/
|
|
|
|
|
|
-int gfs2_inplace_reserve(struct gfs2_inode *ip, u32 requested, u32 aflags)
|
|
|
+int gfs2_inplace_reserve(struct gfs2_inode *ip, const struct gfs2_alloc_parms *ap)
|
|
|
{
|
|
|
struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
|
|
|
struct gfs2_rgrpd *begin = NULL;
|
|
@@ -1848,7 +1848,7 @@ int gfs2_inplace_reserve(struct gfs2_inode *ip, u32 requested, u32 aflags)
|
|
|
|
|
|
if (sdp->sd_args.ar_rgrplvb)
|
|
|
flags |= GL_SKIP;
|
|
|
- if (gfs2_assert_warn(sdp, requested))
|
|
|
+ if (gfs2_assert_warn(sdp, ap->target))
|
|
|
return -EINVAL;
|
|
|
if (gfs2_rs_active(rs)) {
|
|
|
begin = rs->rs_rbm.rgd;
|
|
@@ -1857,7 +1857,7 @@ int gfs2_inplace_reserve(struct gfs2_inode *ip, u32 requested, u32 aflags)
|
|
|
} else {
|
|
|
rs->rs_rbm.rgd = begin = gfs2_blk2rgrpd(sdp, ip->i_goal, 1);
|
|
|
}
|
|
|
- if (S_ISDIR(ip->i_inode.i_mode) && (aflags & GFS2_AF_ORLOV))
|
|
|
+ if (S_ISDIR(ip->i_inode.i_mode) && (ap->aflags & GFS2_AF_ORLOV))
|
|
|
skip = gfs2_orlov_skip(ip);
|
|
|
if (rs->rs_rbm.rgd == NULL)
|
|
|
return -EBADSLT;
|
|
@@ -1899,14 +1899,14 @@ int gfs2_inplace_reserve(struct gfs2_inode *ip, u32 requested, u32 aflags)
|
|
|
|
|
|
/* Get a reservation if we don't already have one */
|
|
|
if (!gfs2_rs_active(rs))
|
|
|
- rg_mblk_search(rs->rs_rbm.rgd, ip, requested);
|
|
|
+ rg_mblk_search(rs->rs_rbm.rgd, ip, ap);
|
|
|
|
|
|
/* Skip rgrps when we can't get a reservation on first pass */
|
|
|
if (!gfs2_rs_active(rs) && (loops < 1))
|
|
|
goto check_rgrp;
|
|
|
|
|
|
/* If rgrp has enough free space, use it */
|
|
|
- if (rs->rs_rbm.rgd->rd_free_clone >= requested) {
|
|
|
+ if (rs->rs_rbm.rgd->rd_free_clone >= ap->target) {
|
|
|
ip->i_rgd = rs->rs_rbm.rgd;
|
|
|
return 0;
|
|
|
}
|