2005-12-16 01:31:24 +03:00
|
|
|
/* -*- mode: c; c-basic-offset: 8; -*-
|
|
|
|
* vim: noexpandtab sw=8 ts=8 sts=0:
|
|
|
|
*
|
|
|
|
* localalloc.h
|
|
|
|
*
|
|
|
|
* Function prototypes
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002, 2004 Oracle. All rights reserved.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public
|
|
|
|
* License along with this program; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 021110-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef OCFS2_LOCALALLOC_H
|
|
|
|
#define OCFS2_LOCALALLOC_H
|
|
|
|
|
|
|
|
int ocfs2_load_local_alloc(struct ocfs2_super *osb);
|
|
|
|
|
|
|
|
void ocfs2_shutdown_local_alloc(struct ocfs2_super *osb);
|
|
|
|
|
2010-04-06 05:17:13 +04:00
|
|
|
void ocfs2_la_set_sizes(struct ocfs2_super *osb, int requested_mb);
|
2010-04-06 05:17:14 +04:00
|
|
|
unsigned int ocfs2_la_default_mb(struct ocfs2_super *osb);
|
2010-04-06 05:17:13 +04:00
|
|
|
|
2005-12-16 01:31:24 +03:00
|
|
|
int ocfs2_begin_local_alloc_recovery(struct ocfs2_super *osb,
|
|
|
|
int node_num,
|
|
|
|
struct ocfs2_dinode **alloc_copy);
|
|
|
|
|
|
|
|
int ocfs2_complete_local_alloc_recovery(struct ocfs2_super *osb,
|
|
|
|
struct ocfs2_dinode *alloc);
|
|
|
|
|
|
|
|
int ocfs2_alloc_should_use_local(struct ocfs2_super *osb,
|
|
|
|
u64 bits);
|
|
|
|
|
|
|
|
struct ocfs2_alloc_context;
|
|
|
|
int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb,
|
|
|
|
u32 bits_wanted,
|
|
|
|
struct ocfs2_alloc_context *ac);
|
|
|
|
|
|
|
|
int ocfs2_claim_local_alloc_bits(struct ocfs2_super *osb,
|
2006-10-10 05:11:45 +04:00
|
|
|
handle_t *handle,
|
2005-12-16 01:31:24 +03:00
|
|
|
struct ocfs2_alloc_context *ac,
|
2007-09-17 07:10:16 +04:00
|
|
|
u32 bits_wanted,
|
2005-12-16 01:31:24 +03:00
|
|
|
u32 *bit_off,
|
|
|
|
u32 *num_bits);
|
|
|
|
|
2014-02-07 00:04:20 +04:00
|
|
|
int ocfs2_free_local_alloc_bits(struct ocfs2_super *osb,
|
|
|
|
handle_t *handle,
|
|
|
|
struct ocfs2_alloc_context *ac,
|
|
|
|
u32 bit_off,
|
|
|
|
u32 num_bits);
|
|
|
|
|
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>
2008-07-29 05:02:53 +04:00
|
|
|
void ocfs2_local_alloc_seen_free_bits(struct ocfs2_super *osb,
|
|
|
|
unsigned int num_clusters);
|
|
|
|
void ocfs2_la_enable_worker(struct work_struct *work);
|
|
|
|
|
2005-12-16 01:31:24 +03:00
|
|
|
#endif /* OCFS2_LOCALALLOC_H */
|