diff options
author | Mark Fasheh <mfasheh@suse.com> | 2008-07-28 21:02:53 -0400 |
---|---|---|
committer | Mark Fasheh <mfasheh@suse.com> | 2008-10-13 16:57:57 -0400 |
commit | 9c7af40b210e87f8fddd97b0badc0a352862234a (patch) | |
tree | deb248e5295439b96ad9bd1789e8512f93803142 /fs/ocfs2/super.c | |
parent | ebcee4b5c9136096f64ee6f691a013d7c0a4bc34 (diff) |
ocfs2: throttle back local alloc when low on disk space
Ocfs2's local allocator disables itself for the duration of a mount point
when it has trouble allocating a large enough area from the primary bitmap.
That can cause performance problems, especially for disks which were only
temporarily full or fragmented. This patch allows for the allocator to
shrink it's window first, before being disabled. Later, it can also be
re-enabled so that any performance drop is minimized.
To do this, we allow the value of osb->local_alloc_bits to be shrunk when
needed. The default value is recorded in a mostly read-only variable so that
we can re-initialize when required.
Locking had to be updated so that we could protect changes to
local_alloc_bits. Mostly this involves protecting various local alloc values
with the osb spinlock. A new state is also added, OCFS2_LA_THROTTLED, which
is used when the local allocator is has shrunk, but is not disabled. If the
available space dips below 1 megabyte, the local alloc file is disabled. In
either case, local alloc is re-enabled 30 seconds after the event, or when
an appropriate amount of bits is seen in the primary bitmap.
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/ocfs2/super.c')
-rw-r--r-- | fs/ocfs2/super.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 3dee61ebd69a..a2d3dcf70252 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -637,7 +637,8 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) | |||
637 | osb->s_atime_quantum = parsed_options.atime_quantum; | 637 | osb->s_atime_quantum = parsed_options.atime_quantum; |
638 | osb->preferred_slot = parsed_options.slot; | 638 | osb->preferred_slot = parsed_options.slot; |
639 | osb->osb_commit_interval = parsed_options.commit_interval; | 639 | osb->osb_commit_interval = parsed_options.commit_interval; |
640 | osb->local_alloc_bits = ocfs2_megabytes_to_clusters(sb, parsed_options.localalloc_opt); | 640 | osb->local_alloc_default_bits = ocfs2_megabytes_to_clusters(sb, parsed_options.localalloc_opt); |
641 | osb->local_alloc_bits = osb->local_alloc_default_bits; | ||
641 | 642 | ||
642 | status = ocfs2_verify_userspace_stack(osb, &parsed_options); | 643 | status = ocfs2_verify_userspace_stack(osb, &parsed_options); |
643 | if (status) | 644 | if (status) |
@@ -1425,6 +1426,7 @@ static int ocfs2_initialize_super(struct super_block *sb, | |||
1425 | 1426 | ||
1426 | osb->local_alloc_state = OCFS2_LA_UNUSED; | 1427 | osb->local_alloc_state = OCFS2_LA_UNUSED; |
1427 | osb->local_alloc_bh = NULL; | 1428 | osb->local_alloc_bh = NULL; |
1429 | INIT_DELAYED_WORK(&osb->la_enable_wq, ocfs2_la_enable_worker); | ||
1428 | 1430 | ||
1429 | init_waitqueue_head(&osb->osb_mount_event); | 1431 | init_waitqueue_head(&osb->osb_mount_event); |
1430 | 1432 | ||