GFS2: Use generic list_lru for quota
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 3/3 GFS2: Use generic list_lru for quota
By using the generic list_lru code, we can now separate the per sb quota list locking from the lru locking. The lru lock is made into the inner-most lock.
As a result of this new lock order, we may occasionally see items on the per-sb quota list which are "dead" so that the two places where we traverse that list are updated to take account of that.
As a result of this patch, the gfs2 quota shrinker is now NUMA zone aware, and we are also laying the foundations for further improvments in due course.
Signed-off-by Steven Whitehouse <[email protected]>
Cc Abhijith Das <[email protected]>
Cc Dave Chinner <[email protected]>
fs/gfs2/incore.h +2 -3
@@ -420,11 +420,10 @@ enum {struct gfs2_quota_data {struct list_head qd_list; -struct list_head qd_reclaim; - +struct kqid qd_id;struct lockref qd_lockref; +struct list_head qd_lru; -struct kqid qd_id;unsigned long qd_flags;/* QDF_... */ s64 qd_change;
fs/gfs2/main.c +10 -9
@@ -31,12 +31,6 @@struct workqueue_struct *gfs2_control_wq; -static struct shrinker qd_shrinker = { - .count_objects = gfs2_qd_shrink_count, - .scan_objects = gfs2_qd_shrink_scan, - .seeks =DEFAULT_SEEKS , -}; -static void gfs2_init_inode_once (void *foo) {struct gfs2_inode *ip = foo;
@@ -87,6 +81,10 @@ static int __init init_gfs2_fs(void)if (error)return error; + error =list_lru_init (&gfs2_qd_lru); +if (error) + goto fail_lru; + error =gfs2_glock_init ();if (error) goto fail;
@@ -139,7 +137,7 @@ static int __init init_gfs2_fs(void)if (!gfs2_rsrv_cachep) goto fail; -register_shrinker (&qd_shrinker); +register_shrinker (&gfs2_qd_shrinker); error =register_filesystem (&gfs2_fs_type);if (error)
@@ -179,7 +177,9 @@ fail_wq: fail_unregister:unregister_filesystem (&gfs2_fs_type); fail: -unregister_shrinker (&qd_shrinker); +list_lru_destroy (&gfs2_qd_lru); +fail_lru: +unregister_shrinker (&gfs2_qd_shrinker);gfs2_glock_exit ();if (gfs2_rsrv_cachep)
@@ -214,13 +214,14 @@ fail: static void __exit exit_gfs2_fs(void) { -unregister_shrinker (&qd_shrinker); +unregister_shrinker (&gfs2_qd_shrinker);gfs2_glock_exit ();gfs2_unregister_debugfs ();unregister_filesystem (&gfs2_fs_type);unregister_filesystem (&gfs2meta_fs_type);destroy_workqueue (gfs_recovery_wq);destroy_workqueue (gfs2_control_wq); +list_lru_destroy (&gfs2_qd_lru);rcu_barrier ();
fs/gfs2/quota.c +69 -49
194 lines not on this page · raw message
fs/gfs2/quota.h +4 -5
@@ -10,9 +10,10 @@#ifndef __QUOTA_DOT_H__#define __QUOTA_DOT_H__ +#include <linux/list_lru.h> +struct gfs2_inode ;struct gfs2_sbd ; -struct shrink_control ;#define NO_UID_QUOTA_CHANGE INVALID_UID#define NO_GID_QUOTA_CHANGE INVALID_GID
@@ -53,10 +54,8 @@ static inline int gfs2_quota_lock_check(struct gfs2_inode *ip) return ret; } -extern unsigned long gfs2_qd_shrink_count (struct shrinker *shrink, -struct shrink_control *sc); -extern unsigned long gfs2_qd_shrink_scan (struct shrinker *shrink, -struct shrink_control *sc);extern const struct quotactl_ops gfs2_quotactl_ops; +extern struct shrinker gfs2_qd_shrinker; +extern struct list_lru gfs2_qd_lru;#endif /* __QUOTA_DOT_H__ */