Younger Liu 2b1e55c389 ocfs2: lighten up allocate transaction
The issue scenario is as following:

When fallocating a very large disk space for a small file,
__ocfs2_extend_allocation attempts to get a very large transaction.  For
some journal sizes, there may be not enough room for this transaction,
and the fallocate will fail.

The patch below extends & restarts the transaction as necessary while
allocating space, and should work with even the smallest journal.  This
patch refers ext4 resize.

Test:
# mkfs.ocfs2 -b 4K -C 32K -T datafiles /dev/sdc
...(jounral size is 32M)
# mount.ocfs2 /dev/sdc /mnt/ocfs2/
# touch /mnt/ocfs2/1.log
# fallocate -o 0 -l 400G /mnt/ocfs2/1.log
fallocate: /mnt/ocfs2/1.log: fallocate failed: Cannot allocate memory
# tail -f /var/log/messages
[ 7372.278591] JBD: fallocate wants too many credits (2051 > 2048)
[ 7372.278597] (fallocate,6438,0):__ocfs2_extend_allocation:709 ERROR: status = -12
[ 7372.278603] (fallocate,6438,0):ocfs2_allocate_unwritten_extents:1504 ERROR: status = -12
[ 7372.278607] (fallocate,6438,0):__ocfs2_change_file_space:1955 ERROR: status = -12
^C
With this patch, the test works well.

Signed-off-by: Younger Liu <younger.liu@huawei.com>
Cc: Jie Liu <jeff.liu@oracle.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Mark Fasheh <mfasheh@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-09-11 15:56:28 -07:00
..
2013-06-29 12:56:55 +04:00
2013-09-04 09:23:46 -04:00
2013-07-05 18:59:33 +04:00
2013-06-29 12:56:46 +04:00
2013-08-12 15:22:43 -05:00
2013-07-09 10:33:25 -07:00
2013-06-29 12:56:53 +04:00
2013-09-07 10:38:29 +02:00
2013-06-29 12:56:47 +04:00
2013-09-09 09:19:15 -07:00
2013-06-29 12:56:37 +04:00
2013-06-29 12:56:32 +04:00
2013-06-29 12:56:38 +04:00
2013-06-29 12:56:39 +04:00
2013-09-09 11:19:09 -07:00
2013-06-29 12:56:29 +04:00
2013-06-29 12:56:28 +04:00
2013-09-09 11:19:09 -07:00
2013-07-03 16:08:06 -07:00
2013-06-29 12:57:04 +04:00
2013-07-10 18:11:34 -07:00
2013-07-10 18:11:34 -07:00
2013-04-29 15:40:23 -04:00
2013-09-04 09:23:46 -04:00
2012-10-22 08:50:37 +03:00
2013-06-29 12:57:05 +04:00
2013-03-03 23:00:23 -05:00
2013-09-03 23:04:44 -04:00
2013-09-03 22:52:45 -04:00
2013-02-22 23:31:31 -05:00
2013-04-17 13:25:09 +01:00
2013-05-07 20:16:25 -07:00
2013-05-31 15:16:33 -04:00
2013-06-29 12:57:05 +04:00
2013-09-07 19:54:56 -04:00
2013-05-29 12:57:34 -07:00