aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/ocfs2.h
diff options
context:
space:
mode:
authorMark Fasheh <mfasheh@suse.com>2008-07-28 21:02:53 -0400
committerMark Fasheh <mfasheh@suse.com>2008-10-13 16:57:57 -0400
commit9c7af40b210e87f8fddd97b0badc0a352862234a (patch)
treedeb248e5295439b96ad9bd1789e8512f93803142 /fs/ocfs2/ocfs2.h
parentebcee4b5c9136096f64ee6f691a013d7c0a4bc34 (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/ocfs2.h')
-rw-r--r--fs/ocfs2/ocfs2.h23
1 files changed, 19 insertions, 4 deletions
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
index 43dd42e313a1..4d6e200a4843 100644
--- a/fs/ocfs2/ocfs2.h
+++ b/fs/ocfs2/ocfs2.h
@@ -171,9 +171,13 @@ struct ocfs2_alloc_stats
171 171
172enum ocfs2_local_alloc_state 172enum ocfs2_local_alloc_state
173{ 173{
174 OCFS2_LA_UNUSED = 0, 174 OCFS2_LA_UNUSED = 0, /* Local alloc will never be used for
175 OCFS2_LA_ENABLED, 175 * this mountpoint. */
176 OCFS2_LA_DISABLED 176 OCFS2_LA_ENABLED, /* Local alloc is in use. */
177 OCFS2_LA_THROTTLED, /* Local alloc is in use, but number
178 * of bits has been reduced. */
179 OCFS2_LA_DISABLED /* Local alloc has temporarily been
180 * disabled. */
177}; 181};
178 182
179enum ocfs2_mount_options 183enum ocfs2_mount_options
@@ -252,9 +256,20 @@ struct ocfs2_super
252 struct ocfs2_journal *journal; 256 struct ocfs2_journal *journal;
253 unsigned long osb_commit_interval; 257 unsigned long osb_commit_interval;
254 258
259 struct delayed_work la_enable_wq;
260
261 /*
262 * Must hold local alloc i_mutex and osb->osb_lock to change
263 * local_alloc_bits. Reads can be done under either lock.
264 */
255 unsigned int local_alloc_bits; 265 unsigned int local_alloc_bits;
256 enum ocfs2_local_alloc_state local_alloc_state; 266 unsigned int local_alloc_default_bits;
267
268 enum ocfs2_local_alloc_state local_alloc_state; /* protected
269 * by osb_lock */
270
257 struct buffer_head *local_alloc_bh; 271 struct buffer_head *local_alloc_bh;
272
258 u64 la_last_gd; 273 u64 la_last_gd;
259 274
260 /* Next two fields are for local node slot recovery during 275 /* Next two fields are for local node slot recovery during