Commit d12e3392 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] reiserfs: preallocation support

From: Chris Mason <mason@suse.com>

Enable preallocation for reiserfs_file_write when the write size is smaller
than the default preallocation size.
parent ec6f9553
...@@ -215,7 +215,13 @@ int reiserfs_allocate_blocks_for_region( ...@@ -215,7 +215,13 @@ int reiserfs_allocate_blocks_for_region(
hint.key = key.on_disk_key; // on disk key of file. hint.key = key.on_disk_key; // on disk key of file.
hint.block = inode->i_blocks>>(inode->i_sb->s_blocksize_bits-9); // Number of disk blocks this file occupies already. hint.block = inode->i_blocks>>(inode->i_sb->s_blocksize_bits-9); // Number of disk blocks this file occupies already.
hint.formatted_node = 0; // We are allocating blocks for unformatted node. hint.formatted_node = 0; // We are allocating blocks for unformatted node.
hint.preallocate = 0; // We do not do any preallocation for now.
/* only preallocate if this is a small write */
if (blocks_to_allocate <
REISERFS_SB(inode->i_sb)->s_alloc_options.preallocsize)
hint.preallocate = 1;
else
hint.preallocate = 0;
/* Call block allocator to allocate blocks */ /* Call block allocator to allocate blocks */
res = reiserfs_allocate_blocknrs(&hint, allocated_blocks, blocks_to_allocate, blocks_to_allocate); res = reiserfs_allocate_blocknrs(&hint, allocated_blocks, blocks_to_allocate, blocks_to_allocate);
......
...@@ -1298,8 +1298,8 @@ static int reiserfs_fill_super (struct super_block * s, void * data, int silent) ...@@ -1298,8 +1298,8 @@ static int reiserfs_fill_super (struct super_block * s, void * data, int silent)
REISERFS_SB(s)->s_alloc_options.bits = ( 1 << 5); REISERFS_SB(s)->s_alloc_options.bits = ( 1 << 5);
/* If file grew past 4 blocks, start preallocation blocks for it. */ /* If file grew past 4 blocks, start preallocation blocks for it. */
REISERFS_SB(s)->s_alloc_options.preallocmin = 4; REISERFS_SB(s)->s_alloc_options.preallocmin = 4;
/* Preallocate by 8 blocks (9-1) at once */ /* Preallocate by 16 blocks (17-1) at once */
REISERFS_SB(s)->s_alloc_options.preallocsize = 9; REISERFS_SB(s)->s_alloc_options.preallocsize = 17;
jdev_name = NULL; jdev_name = NULL;
if (reiserfs_parse_options (s, (char *) data, &(sbi->s_mount_opt), &blocks, &jdev_name, &commit_max_age) == 0) { if (reiserfs_parse_options (s, (char *) data, &(sbi->s_mount_opt), &blocks, &jdev_name, &commit_max_age) == 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment