From b5f5f235c13b22d83e26569ad6758c81df495b19 Mon Sep 17 00:00:00 2001 From: Dave Chinner Date: Mon, 21 Jan 2013 23:53:54 +1100 Subject: [PATCH] --- yaml --- r: 349349 b: refs/heads/master c: f2a459565b02b60408f3f2e5ca992a031319712b h: refs/heads/master i: 349347: 90d02eafaf53556b74115cf3f3b467b1a2415199 v: v3 --- [refs] | 2 +- trunk/fs/xfs/xfs_iomap.c | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index f4ba51cc46a9..1c880488db21 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: eb178619f930fa2ba2348de332a1ff1c66a31424 +refs/heads/master: f2a459565b02b60408f3f2e5ca992a031319712b diff --git a/trunk/fs/xfs/xfs_iomap.c b/trunk/fs/xfs/xfs_iomap.c index add06b4e9a63..364818eef40e 100644 --- a/trunk/fs/xfs/xfs_iomap.c +++ b/trunk/fs/xfs/xfs_iomap.c @@ -351,6 +351,15 @@ xfs_iomap_prealloc_size( } if (shift) alloc_blocks >>= shift; + + /* + * If we are still trying to allocate more space than is + * available, squash the prealloc hard. This can happen if we + * have a large file on a small filesystem and the above + * lowspace thresholds are smaller than MAXEXTLEN. + */ + while (alloc_blocks >= freesp) + alloc_blocks >>= 4; } if (alloc_blocks < mp->m_writeio_blocks)