From 7f0331e1807d27d53c6db9603d6b032f88ac0569 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Fri, 28 Jun 2013 09:52:19 +1000 Subject: [PATCH] fs-convert-fs-shrinkers-to-new-scan-count-api-fix fix warnings Cc: Dave Chinner Cc: Glauber Costa Signed-off-by: Andrew Morton --- fs/ext4/extents_status.c | 15 +++++++++------ fs/gfs2/glock.c | 8 ++++---- fs/gfs2/quota.c | 6 ++++-- fs/gfs2/quota.h | 8 ++++---- fs/mbcache.c | 8 ++++---- fs/nfs/dir.c | 4 ++-- fs/nfs/internal.h | 8 ++++---- fs/nfsd/nfscache.c | 17 +++++++++-------- fs/quota/dquot.c | 6 +++--- fs/ubifs/shrinker.c | 15 +++++++++------ fs/ubifs/ubifs.h | 6 ++++-- 11 files changed, 56 insertions(+), 45 deletions(-) diff --git a/fs/ext4/extents_status.c b/fs/ext4/extents_status.c index fb3b95e244c6..8a45b869713a 100644 --- a/fs/ext4/extents_status.c +++ b/fs/ext4/extents_status.c @@ -891,18 +891,20 @@ static int ext4_inode_touch_time_cmp(void *priv, struct list_head *a, return -1; } -static long ext4_es_count(struct shrinker *shrink, struct shrink_control *sc) +static unsigned long ext4_es_count(struct shrinker *shrink, + struct shrink_control *sc) { - long nr; - struct ext4_sb_info *sbi = container_of(shrink, - struct ext4_sb_info, s_es_shrinker); + unsigned long nr; + struct ext4_sb_info *sbi; + sbi = container_of(shrink, struct ext4_sb_info, s_es_shrinker); nr = percpu_counter_read_positive(&sbi->s_extent_cache_cnt); trace_ext4_es_shrink_enter(sbi->s_sb, sc->nr_to_scan, nr); return nr; } -static long ext4_es_scan(struct shrinker *shrink, struct shrink_control *sc) +static unsigned long ext4_es_scan(struct shrinker *shrink, + struct shrink_control *sc) { struct ext4_sb_info *sbi = container_of(shrink, struct ext4_sb_info, s_es_shrinker); @@ -910,7 +912,8 @@ static long ext4_es_scan(struct shrinker *shrink, struct shrink_control *sc) struct list_head *cur, *tmp; LIST_HEAD(skiped); int nr_to_scan = sc->nr_to_scan; - int ret = 0, nr_shrunk = 0; + int ret = 0; + unsigned long nr_shrunk = 0; spin_lock(&sbi->s_es_lru_lock); diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index a7060a01046c..a9d8cafae041 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c @@ -1457,16 +1457,16 @@ static long gfs2_scan_glock_lru(int nr) return freed; } -static long gfs2_glock_shrink_scan(struct shrinker *shrink, - struct shrink_control *sc) +static unsigned long gfs2_glock_shrink_scan(struct shrinker *shrink, + struct shrink_control *sc) { if (!(sc->gfp_mask & __GFP_FS)) return SHRINK_STOP; return gfs2_scan_glock_lru(sc->nr_to_scan); } -static long gfs2_glock_shrink_count(struct shrinker *shrink, - struct shrink_control *sc) +static unsigned long gfs2_glock_shrink_count(struct shrinker *shrink, + struct shrink_control *sc) { return vfs_pressure_ratio(atomic_read(&lru_count)); } diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index bb83036e65c1..db441359ee8c 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c @@ -75,7 +75,8 @@ static LIST_HEAD(qd_lru_list); static atomic_t qd_lru_count = ATOMIC_INIT(0); static DEFINE_SPINLOCK(qd_lru_lock); -long gfs2_qd_shrink_scan(struct shrinker *shrink, struct shrink_control *sc) +unsigned long gfs2_qd_shrink_scan(struct shrinker *shrink, + struct shrink_control *sc) { struct gfs2_quota_data *qd; struct gfs2_sbd *sdp; @@ -114,7 +115,8 @@ long gfs2_qd_shrink_scan(struct shrinker *shrink, struct shrink_control *sc) return freed; } -long gfs2_qd_shrink_count(struct shrinker *shrink, struct shrink_control *sc) +unsigned long gfs2_qd_shrink_count(struct shrinker *shrink, + struct shrink_control *sc) { return vfs_pressure_ratio(atomic_read(&qd_lru_count)); } diff --git a/fs/gfs2/quota.h b/fs/gfs2/quota.h index 4f61708339e9..0f64d9deb1b0 100644 --- a/fs/gfs2/quota.h +++ b/fs/gfs2/quota.h @@ -53,10 +53,10 @@ static inline int gfs2_quota_lock_check(struct gfs2_inode *ip) return ret; } -extern long gfs2_qd_shrink_count(struct shrinker *shrink, - struct shrink_control *sc); -extern long gfs2_qd_shrink_scan(struct shrinker *shrink, - struct shrink_control *sc); +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; #endif /* __QUOTA_DOT_H__ */ diff --git a/fs/mbcache.c b/fs/mbcache.c index dbb9e546d6e7..e519e45bf673 100644 --- a/fs/mbcache.c +++ b/fs/mbcache.c @@ -149,14 +149,14 @@ forget: * * Returns the number of objects freed. */ -static long +static unsigned long mb_cache_shrink_scan(struct shrinker *shrink, struct shrink_control *sc) { LIST_HEAD(free_list); struct mb_cache_entry *entry, *tmp; int nr_to_scan = sc->nr_to_scan; gfp_t gfp_mask = sc->gfp_mask; - long freed = 0; + unsigned long freed = 0; mb_debug("trying to free %d entries", nr_to_scan); spin_lock(&mb_cache_spinlock); @@ -175,11 +175,11 @@ mb_cache_shrink_scan(struct shrinker *shrink, struct shrink_control *sc) return freed; } -static long +static unsigned long mb_cache_shrink_count(struct shrinker *shrink, struct shrink_control *sc) { struct mb_cache *cache; - long count = 0; + unsigned long count = 0; spin_lock(&mb_cache_spinlock); list_for_each_entry(cache, &mb_cache_list, c_cache_list) { diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 0c3d98eb97aa..3614c35b1c44 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -1963,7 +1963,7 @@ static void nfs_access_free_list(struct list_head *head) } } -long +unsigned long nfs_access_cache_scan(struct shrinker *shrink, struct shrink_control *sc) { LIST_HEAD(head); @@ -2008,7 +2008,7 @@ remove_lru_entry: return freed; } -long +unsigned long nfs_access_cache_count(struct shrinker *shrink, struct shrink_control *sc) { return vfs_pressure_ratio(atomic_long_read(&nfs_access_nr_entries)); diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 736284fa76db..dd3760bcb602 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h @@ -269,10 +269,10 @@ extern struct nfs_client *nfs_init_client(struct nfs_client *clp, const char *ip_addr, rpc_authflavor_t authflavour); /* dir.c */ -extern long nfs_access_cache_count(struct shrinker *shrink, - struct shrink_control *sc); -extern long nfs_access_cache_scan(struct shrinker *shrink, - struct shrink_control *sc); +extern unsigned long nfs_access_cache_count(struct shrinker *shrink, + struct shrink_control *sc); +extern unsigned long nfs_access_cache_scan(struct shrinker *shrink, + struct shrink_control *sc); struct dentry *nfs_lookup(struct inode *, struct dentry *, unsigned int); int nfs_create(struct inode *, struct dentry *, umode_t, bool); int nfs_mkdir(struct inode *, struct dentry *, umode_t); diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c index 5564c38f5d3e..9186c7ce0b14 100644 --- a/fs/nfsd/nfscache.c +++ b/fs/nfsd/nfscache.c @@ -59,10 +59,10 @@ static unsigned int longest_chain_cachesize; static int nfsd_cache_append(struct svc_rqst *rqstp, struct kvec *vec); static void cache_cleaner_func(struct work_struct *unused); -static long nfsd_reply_cache_count(struct shrinker *shrink, - struct shrink_control *sc); -static long nfsd_reply_cache_scan(struct shrinker *shrink, - struct shrink_control *sc); +static unsigned long nfsd_reply_cache_count(struct shrinker *shrink, + struct shrink_control *sc); +static unsigned long nfsd_reply_cache_scan(struct shrinker *shrink, + struct shrink_control *sc); static struct shrinker nfsd_reply_cache_shrinker = { .scan_objects = nfsd_reply_cache_scan, @@ -270,10 +270,10 @@ cache_cleaner_func(struct work_struct *unused) spin_unlock(&cache_lock); } -static long +static unsigned long nfsd_reply_cache_count(struct shrinker *shrink, struct shrink_control *sc) { - long num; + unsigned long num; spin_lock(&cache_lock); num = num_drc_entries; @@ -282,10 +282,11 @@ nfsd_reply_cache_count(struct shrinker *shrink, struct shrink_control *sc) return num; } -static long +static unsigned long nfsd_reply_cache_scan(struct shrinker *shrink, struct shrink_control *sc) { - long freed; + unsigned long freed; + spin_lock(&cache_lock); freed = prune_cache_entries(); spin_unlock(&cache_lock); diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 21c7e0d619da..017eaea7f163 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c @@ -687,12 +687,12 @@ int dquot_quota_sync(struct super_block *sb, int type) } EXPORT_SYMBOL(dquot_quota_sync); -static long +static unsigned long dqcache_shrink_scan(struct shrinker *shrink, struct shrink_control *sc) { struct list_head *head; struct dquot *dquot; - long freed = 0; + unsigned long freed = 0; head = free_dquots.prev; while (head != &free_dquots && sc->nr_to_scan) { @@ -708,7 +708,7 @@ dqcache_shrink_scan(struct shrinker *shrink, struct shrink_control *sc) return freed; } -static long +static unsigned long dqcache_shrink_count(struct shrinker *shrink, struct shrink_control *sc) { return vfs_pressure_ratio( diff --git a/fs/ubifs/shrinker.c b/fs/ubifs/shrinker.c index e2cf4cbc050e..68ce39965f0f 100644 --- a/fs/ubifs/shrinker.c +++ b/fs/ubifs/shrinker.c @@ -277,9 +277,10 @@ static int kick_a_thread(void) return 0; } -long ubifs_shrink_count(struct shrinker *shrink, struct shrink_control *sc) +unsigned long ubifs_shrink_count(struct shrinker *shrink, + struct shrink_control *sc) { - long clean_zn_cnt = atomic_long_read(&ubifs_clean_zn_cnt); + unsigned long clean_zn_cnt = atomic_long_read(&ubifs_clean_zn_cnt); /* * Due to the way UBIFS updates the clean znode counter it may @@ -288,10 +289,12 @@ long ubifs_shrink_count(struct shrinker *shrink, struct shrink_control *sc) return clean_zn_cnt >= 0 ? clean_zn_cnt : 1; } -long ubifs_shrink_scan(struct shrinker *shrink, struct shrink_control *sc) +unsigned long ubifs_shrink_scan(struct shrinker *shrink, + struct shrink_control *sc) { - int nr = sc->nr_to_scan; - int freed, contention = 0; + unsigned long nr = sc->nr_to_scan; + int contention = 0; + unsigned long freed; long clean_zn_cnt = atomic_long_read(&ubifs_clean_zn_cnt); if (!clean_zn_cnt) { @@ -324,6 +327,6 @@ long ubifs_shrink_scan(struct shrinker *shrink, struct shrink_control *sc) } out: - dbg_tnc("%d znodes were freed, requested %d", freed, nr); + dbg_tnc("%lu znodes were freed, requested %lu", freed, nr); return freed; } diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index bcdafcc265e5..e8c8cfe1435c 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h @@ -1624,8 +1624,10 @@ int ubifs_tnc_start_commit(struct ubifs_info *c, struct ubifs_zbranch *zroot); int ubifs_tnc_end_commit(struct ubifs_info *c); /* shrinker.c */ -long ubifs_shrink_scan(struct shrinker *shrink, struct shrink_control *sc); -long ubifs_shrink_count(struct shrinker *shrink, struct shrink_control *sc); +unsigned long ubifs_shrink_scan(struct shrinker *shrink, + struct shrink_control *sc); +unsigned long ubifs_shrink_count(struct shrinker *shrink, + struct shrink_control *sc); /* commit.c */ int ubifs_bg_thread(void *info); -- 2.39.5