xfs
[Top] [All Lists]

[PATCH v2 3/7] xfs: cap prealloc size to free space before shift

To: xfs@xxxxxxxxxxx
Subject: [PATCH v2 3/7] xfs: cap prealloc size to free space before shift
From: Brian Foster <bfoster@xxxxxxxxxx>
Date: Wed, 2 Jan 2013 13:08:07 -0500
In-reply-to: <1357150091-37530-1-git-send-email-bfoster@xxxxxxxxxx>
References: <1357150091-37530-1-git-send-email-bfoster@xxxxxxxxxx>
With the addition of quota preallocation throttling, we want to
support a general algorithm that considers the maximum allowable
prealloc size and recommended shift modifier from various sources
(i.e., global fs state and all applicable quotas for an inode).

Update the current global free space throttle algorithm to cap the
preallocation size to the free space available in the filesystem.

Signed-off-by: Brian Foster <bfoster@xxxxxxxxxx>
---
 fs/xfs/xfs_iomap.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index b2002a5..5232954 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -351,6 +351,9 @@ xfs_iomap_prealloc_size(
                if (freesp < mp->m_low_space[XFS_LOWSP_1_PCNT])
                        shift++;
        }
+       if (alloc_blocks > freesp)
+               alloc_blocks = freesp;
+
        if (shift)
                alloc_blocks >>= shift;
        /*
-- 
1.7.7.6

<Prev in Thread] Current Thread [Next in Thread>