aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/rgrp.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/gfs2/rgrp.c')
-rw-r--r--fs/gfs2/rgrp.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index d4d10fadab79..4f0984a607b3 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -1422,12 +1422,12 @@ static void rs_insert(struct gfs2_inode *ip)
1422 * rg_mblk_search - find a group of multiple free blocks to form a reservation 1422 * rg_mblk_search - find a group of multiple free blocks to form a reservation
1423 * @rgd: the resource group descriptor 1423 * @rgd: the resource group descriptor
1424 * @ip: pointer to the inode for which we're reserving blocks 1424 * @ip: pointer to the inode for which we're reserving blocks
1425 * @requested: number of blocks required for this allocation 1425 * @ap: the allocation parameters
1426 * 1426 *
1427 */ 1427 */
1428 1428
1429static void rg_mblk_search(struct gfs2_rgrpd *rgd, struct gfs2_inode *ip, 1429static void rg_mblk_search(struct gfs2_rgrpd *rgd, struct gfs2_inode *ip,
1430 unsigned requested) 1430 const struct gfs2_alloc_parms *ap)
1431{ 1431{
1432 struct gfs2_rbm rbm = { .rgd = rgd, }; 1432 struct gfs2_rbm rbm = { .rgd = rgd, };
1433 u64 goal; 1433 u64 goal;
@@ -1440,7 +1440,7 @@ static void rg_mblk_search(struct gfs2_rgrpd *rgd, struct gfs2_inode *ip,
1440 if (S_ISDIR(inode->i_mode)) 1440 if (S_ISDIR(inode->i_mode))
1441 extlen = 1; 1441 extlen = 1;
1442 else { 1442 else {
1443 extlen = max_t(u32, atomic_read(&rs->rs_sizehint), requested); 1443 extlen = max_t(u32, atomic_read(&rs->rs_sizehint), ap->target);
1444 extlen = clamp(extlen, RGRP_RSRV_MINBLKS, free_blocks); 1444 extlen = clamp(extlen, RGRP_RSRV_MINBLKS, free_blocks);
1445 } 1445 }
1446 if ((rgd->rd_free_clone < rgd->rd_reserved) || (free_blocks < extlen)) 1446 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
1831/** 1831/**
1832 * gfs2_inplace_reserve - Reserve space in the filesystem 1832 * gfs2_inplace_reserve - Reserve space in the filesystem
1833 * @ip: the inode to reserve space for 1833 * @ip: the inode to reserve space for
1834 * @requested: the number of blocks to be reserved 1834 * @ap: the allocation parameters
1835 * 1835 *
1836 * Returns: errno 1836 * Returns: errno
1837 */ 1837 */
1838 1838
1839int gfs2_inplace_reserve(struct gfs2_inode *ip, u32 requested, u32 aflags) 1839int gfs2_inplace_reserve(struct gfs2_inode *ip, const struct gfs2_alloc_parms *ap)
1840{ 1840{
1841 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); 1841 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
1842 struct gfs2_rgrpd *begin = NULL; 1842 struct gfs2_rgrpd *begin = NULL;
@@ -1848,7 +1848,7 @@ int gfs2_inplace_reserve(struct gfs2_inode *ip, u32 requested, u32 aflags)
1848 1848
1849 if (sdp->sd_args.ar_rgrplvb) 1849 if (sdp->sd_args.ar_rgrplvb)
1850 flags |= GL_SKIP; 1850 flags |= GL_SKIP;
1851 if (gfs2_assert_warn(sdp, requested)) 1851 if (gfs2_assert_warn(sdp, ap->target))
1852 return -EINVAL; 1852 return -EINVAL;
1853 if (gfs2_rs_active(rs)) { 1853 if (gfs2_rs_active(rs)) {
1854 begin = rs->rs_rbm.rgd; 1854 begin = rs->rs_rbm.rgd;
@@ -1857,7 +1857,7 @@ int gfs2_inplace_reserve(struct gfs2_inode *ip, u32 requested, u32 aflags)
1857 } else { 1857 } else {
1858 rs->rs_rbm.rgd = begin = gfs2_blk2rgrpd(sdp, ip->i_goal, 1); 1858 rs->rs_rbm.rgd = begin = gfs2_blk2rgrpd(sdp, ip->i_goal, 1);
1859 } 1859 }
1860 if (S_ISDIR(ip->i_inode.i_mode) && (aflags & GFS2_AF_ORLOV)) 1860 if (S_ISDIR(ip->i_inode.i_mode) && (ap->aflags & GFS2_AF_ORLOV))
1861 skip = gfs2_orlov_skip(ip); 1861 skip = gfs2_orlov_skip(ip);
1862 if (rs->rs_rbm.rgd == NULL) 1862 if (rs->rs_rbm.rgd == NULL)
1863 return -EBADSLT; 1863 return -EBADSLT;
@@ -1899,14 +1899,14 @@ int gfs2_inplace_reserve(struct gfs2_inode *ip, u32 requested, u32 aflags)
1899 1899
1900 /* Get a reservation if we don't already have one */ 1900 /* Get a reservation if we don't already have one */
1901 if (!gfs2_rs_active(rs)) 1901 if (!gfs2_rs_active(rs))
1902 rg_mblk_search(rs->rs_rbm.rgd, ip, requested); 1902 rg_mblk_search(rs->rs_rbm.rgd, ip, ap);
1903 1903
1904 /* Skip rgrps when we can't get a reservation on first pass */ 1904 /* Skip rgrps when we can't get a reservation on first pass */
1905 if (!gfs2_rs_active(rs) && (loops < 1)) 1905 if (!gfs2_rs_active(rs) && (loops < 1))
1906 goto check_rgrp; 1906 goto check_rgrp;
1907 1907
1908 /* If rgrp has enough free space, use it */ 1908 /* If rgrp has enough free space, use it */
1909 if (rs->rs_rbm.rgd->rd_free_clone >= requested) { 1909 if (rs->rs_rbm.rgd->rd_free_clone >= ap->target) {
1910 ip->i_rgd = rs->rs_rbm.rgd; 1910 ip->i_rgd = rs->rs_rbm.rgd;
1911 return 0; 1911 return 0;
1912 } 1912 }