Skip to content

Commit

Permalink
GFS2: change gfs2_quota_scan into a shrinker
Browse files Browse the repository at this point in the history
Deallocation of gfs2_quota_data objects now happens on-demand through a
shrinker instead of routinely deallocating through the quotad daemon.

Signed-off-by: Abhijith Das <adas@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
  • Loading branch information
Abhijith Das authored and Steven Whitehouse committed Mar 24, 2009
1 parent 2db2aac commit 0a7ab79
Show file tree
Hide file tree
Showing 7 changed files with 114 additions and 73 deletions.
6 changes: 3 additions & 3 deletions fs/gfs2/incore.h
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,9 @@ enum {

struct gfs2_quota_data {
struct list_head qd_list;
unsigned int qd_count;
struct list_head qd_reclaim;

atomic_t qd_count;

u32 qd_id;
unsigned long qd_flags; /* QDF_... */
Expand All @@ -303,7 +305,6 @@ struct gfs2_quota_data {

u64 qd_sync_gen;
unsigned long qd_last_warn;
unsigned long qd_last_touched;
};

struct gfs2_trans {
Expand Down Expand Up @@ -406,7 +407,6 @@ struct gfs2_tune {
unsigned int gt_quota_warn_period; /* Secs between quota warn msgs */
unsigned int gt_quota_scale_num; /* Numerator */
unsigned int gt_quota_scale_den; /* Denominator */
unsigned int gt_quota_cache_secs;
unsigned int gt_quota_quantum; /* Secs between syncs to quota file */
unsigned int gt_new_files_jdata;
unsigned int gt_max_readahead; /* Max bytes to read-ahead from disk */
Expand Down
10 changes: 10 additions & 0 deletions fs/gfs2/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
#include "sys.h"
#include "util.h"
#include "glock.h"
#include "quota.h"

static struct shrinker qd_shrinker = {
.shrink = gfs2_shrink_qd_memory,
.seeks = DEFAULT_SEEKS,
};

static void gfs2_init_inode_once(void *foo)
{
Expand Down Expand Up @@ -100,6 +106,8 @@ static int __init init_gfs2_fs(void)
if (!gfs2_quotad_cachep)
goto fail;

register_shrinker(&qd_shrinker);

error = register_filesystem(&gfs2_fs_type);
if (error)
goto fail;
Expand All @@ -117,6 +125,7 @@ static int __init init_gfs2_fs(void)
fail_unregister:
unregister_filesystem(&gfs2_fs_type);
fail:
unregister_shrinker(&qd_shrinker);
gfs2_glock_exit();

if (gfs2_quotad_cachep)
Expand Down Expand Up @@ -145,6 +154,7 @@ static int __init init_gfs2_fs(void)

static void __exit exit_gfs2_fs(void)
{
unregister_shrinker(&qd_shrinker);
gfs2_glock_exit();
gfs2_unregister_debugfs();
unregister_filesystem(&gfs2_fs_type);
Expand Down
1 change: 1 addition & 0 deletions fs/gfs2/ops_address.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ static int stuffed_readpage(struct gfs2_inode *ip, struct page *page)
*/
if (unlikely(page->index)) {
zero_user(page, 0, PAGE_CACHE_SIZE);
SetPageUptodate(page);
return 0;
}

Expand Down
1 change: 0 additions & 1 deletion fs/gfs2/ops_fstype.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ static void gfs2_tune_init(struct gfs2_tune *gt)
gt->gt_quota_warn_period = 10;
gt->gt_quota_scale_num = 1;
gt->gt_quota_scale_den = 1;
gt->gt_quota_cache_secs = 300;
gt->gt_quota_quantum = 60;
gt->gt_new_files_jdata = 0;
gt->gt_max_readahead = 1 << 18;
Expand Down
Loading

0 comments on commit 0a7ab79

Please sign in to comment.