fs/nfsd: change type of max_delegations, nfsd_drc_max_mem and nfsd_drc_mem_used
authorZhang Yanfei <zhangyanfei@cn.fujitsu.com>
Sat, 23 Feb 2013 00:35:47 +0000 (16:35 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 24 Feb 2013 01:50:22 +0000 (17:50 -0800)
The three variables are calculated from nr_free_buffer_pages so change
their types to unsigned long in case of overflow.

Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/nfsd/nfs4state.c
fs/nfsd/nfsd.h
fs/nfsd/nfssvc.c

index ac8ed96c41994467512a632db89c8bed9bff6b27..499e957510e704730d74e743bc64d40aff141414 100644 (file)
@@ -151,7 +151,7 @@ get_nfs4_file(struct nfs4_file *fi)
 }
 
 static int num_delegations;
-unsigned int max_delegations;
+unsigned long max_delegations;
 
 /*
  * Open owner state (share locks)
@@ -700,8 +700,8 @@ static int nfsd4_get_drc_mem(int slotsize, u32 num)
        num = min_t(u32, num, NFSD_MAX_SLOTS_PER_SESSION);
 
        spin_lock(&nfsd_drc_lock);
-       avail = min_t(int, NFSD_MAX_MEM_PER_SESSION,
-                       nfsd_drc_max_mem - nfsd_drc_mem_used);
+       avail = min((unsigned long)NFSD_MAX_MEM_PER_SESSION,
+                   nfsd_drc_max_mem - nfsd_drc_mem_used);
        num = min_t(int, num, avail / slotsize);
        nfsd_drc_mem_used += num * slotsize;
        spin_unlock(&nfsd_drc_lock);
index de23db255c69c1314b1f6f15cc753463324b2237..07a473fd49bc1a577bfbc1c44c37efaafb9d01a0 100644 (file)
@@ -56,8 +56,8 @@ extern struct svc_version     nfsd_version2, nfsd_version3,
 extern u32                     nfsd_supported_minorversion;
 extern struct mutex            nfsd_mutex;
 extern spinlock_t              nfsd_drc_lock;
-extern unsigned int            nfsd_drc_max_mem;
-extern unsigned int            nfsd_drc_mem_used;
+extern unsigned long           nfsd_drc_max_mem;
+extern unsigned long           nfsd_drc_mem_used;
 
 extern const struct seq_operations nfs_exports_op;
 
@@ -106,7 +106,7 @@ static inline int nfsd_v4client(struct svc_rqst *rq)
  * NFSv4 State
  */
 #ifdef CONFIG_NFSD_V4
-extern unsigned int max_delegations;
+extern unsigned long max_delegations;
 void nfs4_state_init(void);
 int nfsd4_init_slabs(void);
 void nfsd4_free_slabs(void);
index cee62ab9d4a30f84fe05d871409f064f24350b07..be7af509930cb95fbbef903e45d33a6b69c42697 100644 (file)
@@ -59,8 +59,8 @@ DEFINE_MUTEX(nfsd_mutex);
  * nfsd_drc_pages_used tracks the current version 4.1 DRC memory usage.
  */
 spinlock_t     nfsd_drc_lock;
-unsigned int   nfsd_drc_max_mem;
-unsigned int   nfsd_drc_mem_used;
+unsigned long  nfsd_drc_max_mem;
+unsigned long  nfsd_drc_mem_used;
 
 #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
 static struct svc_stat nfsd_acl_svcstats;
@@ -342,7 +342,7 @@ static void set_max_drc(void)
                                        >> NFSD_DRC_SIZE_SHIFT) * PAGE_SIZE;
        nfsd_drc_mem_used = 0;
        spin_lock_init(&nfsd_drc_lock);
-       dprintk("%s nfsd_drc_max_mem %u \n", __func__, nfsd_drc_max_mem);
+       dprintk("%s nfsd_drc_max_mem %lu \n", __func__, nfsd_drc_max_mem);
 }
 
 static int nfsd_get_default_max_blksize(void)