37b2c8377c
This patch is a clean up of gfs2_quotad prior to giving it an extra job to do in addition to the current portfolio of updating the quota and statfs information from time to time. As a result it has been moved into quota.c allowing one of the functions it calls to be made static. Also the clean up allows the two existing functions to have separate timeouts and also to coexist with its future role of dealing with the "truncate in progress" inode flag. The (pointless) setting of gfs2_quotad_secs is removed since we arrange to only wake up quotad when one of the two timers expires. In addition the struct gfs2_quota_data is moved into a slab cache, mainly for easier debugging. It should also be possible to use a shrinker in the future, rather than the current scheme of scanning the quota data entries from time to time. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
84 lines
2.0 KiB
C
84 lines
2.0 KiB
C
/*
|
|
* Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
|
|
* Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
|
|
*
|
|
* This copyrighted material is made available to anyone wishing to use,
|
|
* modify, copy, or redistribute it subject to the terms and conditions
|
|
* of the GNU General Public License version 2.
|
|
*/
|
|
|
|
#include <linux/sched.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/spinlock.h>
|
|
#include <linux/completion.h>
|
|
#include <linux/buffer_head.h>
|
|
#include <linux/kthread.h>
|
|
#include <linux/delay.h>
|
|
#include <linux/gfs2_ondisk.h>
|
|
#include <linux/lm_interface.h>
|
|
#include <linux/freezer.h>
|
|
|
|
#include "gfs2.h"
|
|
#include "incore.h"
|
|
#include "daemon.h"
|
|
#include "glock.h"
|
|
#include "log.h"
|
|
#include "recovery.h"
|
|
#include "super.h"
|
|
#include "util.h"
|
|
|
|
/* This uses schedule_timeout() instead of msleep() because it's good for
|
|
the daemons to wake up more often than the timeout when unmounting so
|
|
the user's unmount doesn't sit there forever.
|
|
|
|
The kthread functions used to start these daemons block and flush signals. */
|
|
|
|
/**
|
|
* gfs2_glockd - Reclaim unused glock structures
|
|
* @sdp: Pointer to GFS2 superblock
|
|
*
|
|
* One or more of these daemons run, reclaiming glocks on sd_reclaim_list.
|
|
* Number of daemons can be set by user, with num_glockd mount option.
|
|
*/
|
|
|
|
int gfs2_glockd(void *data)
|
|
{
|
|
struct gfs2_sbd *sdp = data;
|
|
|
|
while (!kthread_should_stop()) {
|
|
while (atomic_read(&sdp->sd_reclaim_count))
|
|
gfs2_reclaim_glock(sdp);
|
|
|
|
wait_event_interruptible(sdp->sd_reclaim_wq,
|
|
(atomic_read(&sdp->sd_reclaim_count) ||
|
|
kthread_should_stop()));
|
|
if (freezing(current))
|
|
refrigerator();
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
/**
|
|
* gfs2_recoverd - Recover dead machine's journals
|
|
* @sdp: Pointer to GFS2 superblock
|
|
*
|
|
*/
|
|
|
|
int gfs2_recoverd(void *data)
|
|
{
|
|
struct gfs2_sbd *sdp = data;
|
|
unsigned long t;
|
|
|
|
while (!kthread_should_stop()) {
|
|
gfs2_check_journals(sdp);
|
|
t = gfs2_tune_get(sdp, gt_recoverd_secs) * HZ;
|
|
if (freezing(current))
|
|
refrigerator();
|
|
schedule_timeout_interruptible(t);
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|