From 711f48ddb60f7c63647a5e714435f7e30899d680 Mon Sep 17 00:00:00 2001 From: Dave Chinner Date: Mon, 21 Jan 2013 23:53:54 +1100 Subject: [PATCH] --- yaml --- r: 352923 b: refs/heads/master c: 4d559a3bcb7383f34334092af07e68fb60910684 h: refs/heads/master i: 352921: 6e876811377cd41976c9d044bb358f938358ccab 352919: 3e9b0e8edc3fd58a27bb59368d3b635be3c9bd68 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 62583bd34152..74e6f97b6a3c 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 10616b806d1d7835b1d23b8d75ef638f92cb98b6 +refs/heads/master: 4d559a3bcb7383f34334092af07e68fb60910684 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)