summaryrefslogtreecommitdiff
path: root/fs/xfs/libxfs/xfs_ag_resv.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2017-10-03 02:35:04 +0300
committerDave Airlie <airlied@redhat.com>2017-10-03 02:35:04 +0300
commitebec44a2456fbe5fe18aae88f6010f6878f0cb4a (patch)
tree427734722bdf3e807333329f33a6dbd6e95ec747 /fs/xfs/libxfs/xfs_ag_resv.c
parent659333de48268550b5f09fcd45f76459d737b946 (diff)
parent9e66317d3c92ddaab330c125dfe9d06eee268aff (diff)
downloadlinux-ebec44a2456fbe5fe18aae88f6010f6878f0cb4a.tar.xz
BackMerge tag 'v4.14-rc3' into drm-next
Linux 4.14-rc3 Requested by Daniel for the tracing build fix in fixes.
Diffstat (limited to 'fs/xfs/libxfs/xfs_ag_resv.c')
-rw-r--r--fs/xfs/libxfs/xfs_ag_resv.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/fs/xfs/libxfs/xfs_ag_resv.c b/fs/xfs/libxfs/xfs_ag_resv.c
index b008ff3250eb..df3e600835e8 100644
--- a/fs/xfs/libxfs/xfs_ag_resv.c
+++ b/fs/xfs/libxfs/xfs_ag_resv.c
@@ -156,7 +156,8 @@ __xfs_ag_resv_free(
trace_xfs_ag_resv_free(pag, type, 0);
resv = xfs_perag_resv(pag, type);
- pag->pag_mount->m_ag_max_usable += resv->ar_asked;
+ if (pag->pag_agno == 0)
+ pag->pag_mount->m_ag_max_usable += resv->ar_asked;
/*
* AGFL blocks are always considered "free", so whatever
* was reserved at mount time must be given back at umount.
@@ -216,7 +217,14 @@ __xfs_ag_resv_init(
return error;
}
- mp->m_ag_max_usable -= ask;
+ /*
+ * Reduce the maximum per-AG allocation length by however much we're
+ * trying to reserve for an AG. Since this is a filesystem-wide
+ * counter, we only make the adjustment for AG 0. This assumes that
+ * there aren't any AGs hungrier for per-AG reservation than AG 0.
+ */
+ if (pag->pag_agno == 0)
+ mp->m_ag_max_usable -= ask;
resv = xfs_perag_resv(pag, type);
resv->ar_asked = ask;