2019-05-24 13:04:05 +03:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
2021-05-07 04:06:44 +03:00
|
|
|
/*
|
2005-12-16 01:31:24 +03:00
|
|
|
* localalloc.h
|
|
|
|
*
|
|
|
|
* Function prototypes
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002, 2004 Oracle. All rights reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#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 */
|