X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fs%2Fcifs%2Fcifsfs.c;h=03d91f196124226d8c4fd22a9d2a32a066e35008;hb=d939d46ba7caa14e960be18e18f5c07be8806d7a;hp=17458b708b2fa1a90191c5a1198168b23ee7ccf1;hpb=86090fcac5e27b630656fe3d963a6b80e26dac44;p=linux-2.6.git diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 17458b708..03d91f196 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -31,6 +31,7 @@ #include #include #include +#include #include "cifsfs.h" #include "cifspdu.h" #define DECLARE_GLOBALS_HERE @@ -39,9 +40,11 @@ #include "cifs_debug.h" #include "cifs_fs_sb.h" #include -#define CIFS_MAGIC_NUMBER 0xFF534D42 /* the first four bytes of all SMB PDUs */ +#define CIFS_MAGIC_NUMBER 0xFF534D42 /* the first four bytes of SMB PDUs */ +/* BB when mempool_resize is added back in, we will resize pool on new mount */ +#define CIFS_MIN_RCV_POOL 11 /* enough for progress to five servers */ -#ifdef CIFS_QUOTA +#ifdef CONFIG_CIFS_QUOTA static struct quotactl_ops cifs_quotactl_ops; #endif @@ -100,7 +103,7 @@ cifs_read_super(struct super_block *sb, void *data, sb->s_op = &cifs_super_ops; /* if(cifs_sb->tcon->ses->server->maxBuf > MAX_CIFS_HDR_SIZE + 512) sb->s_blocksize = cifs_sb->tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE; */ -#ifdef CIFS_QUOTA +#ifdef CONFIG_CIFS_QUOTA sb->s_qcop = &cifs_quotactl_ops; #endif sb->s_blocksize = CIFS_MAX_MSGSIZE; @@ -209,9 +212,11 @@ static int cifs_permission(struct inode * inode, int mask, struct nameidata *nd) } static kmem_cache_t *cifs_inode_cachep; -kmem_cache_t *cifs_req_cachep; -kmem_cache_t *cifs_mid_cachep; +static kmem_cache_t *cifs_req_cachep; +static kmem_cache_t *cifs_mid_cachep; kmem_cache_t *cifs_oplock_cachep; +mempool_t *cifs_req_poolp; +mempool_t *cifs_mid_poolp; static struct inode * cifs_alloc_inode(struct super_block *sb) @@ -271,7 +276,7 @@ cifs_show_options(struct seq_file *s, struct vfsmount *m) return 0; } -#ifdef CIFS_QUOTA +#ifdef CONFIG_CIFS_QUOTA int cifs_xquota_set(struct super_block * sb, int quota_type, qid_t qid, struct fs_disk_quota * pdquota) { @@ -504,7 +509,7 @@ struct inode_operations cifs_file_inode_ops = { .getattr = cifs_getattr, /* do we need this anymore? */ .rename = cifs_rename, .permission = cifs_permission, -#ifdef CIFS_XATTR +#ifdef CONFIG_CIFS_XATTR .setxattr = cifs_setxattr, .getxattr = cifs_getxattr, .listxattr = cifs_listxattr, @@ -519,7 +524,7 @@ struct inode_operations cifs_symlink_inode_ops = { /* BB add the following two eventually */ /* revalidate: cifs_revalidate, setattr: cifs_notify_change, *//* BB do we need notify change */ -#ifdef CIFS_XATTR +#ifdef CONFIG_CIFS_XATTR .setxattr = cifs_setxattr, .getxattr = cifs_getxattr, .listxattr = cifs_listxattr, @@ -537,7 +542,7 @@ struct file_operations cifs_file_ops = { .flush = cifs_flush, .mmap = cifs_file_mmap, .sendfile = generic_file_sendfile, -#ifdef CIFS_FCNTL +#ifdef CONFIG_CIFS_FCNTL .fcntl = cifs_fcntl, #endif }; @@ -546,7 +551,7 @@ struct file_operations cifs_dir_ops = { .readdir = cifs_readdir, .release = cifs_closedir, .read = generic_read_dir, -#ifdef CIFS_FCNTL +#ifdef CONFIG_CIFS_FCNTL .fcntl = cifs_fcntl, #endif }; @@ -593,12 +598,23 @@ cifs_init_request_bufs(void) if (cifs_req_cachep == NULL) return -ENOMEM; + cifs_req_poolp = mempool_create(CIFS_MIN_RCV_POOL, + mempool_alloc_slab, + mempool_free_slab, + cifs_req_cachep); + + if(cifs_req_poolp == NULL) { + kmem_cache_destroy(cifs_req_cachep); + return -ENOMEM; + } + return 0; } static void cifs_destroy_request_bufs(void) { + mempool_destroy(cifs_req_poolp); if (kmem_cache_destroy(cifs_req_cachep)) printk(KERN_WARNING "cifs_destroy_request_cache: error not all structures were freed\n"); @@ -612,11 +628,22 @@ cifs_init_mids(void) SLAB_HWCACHE_ALIGN, NULL, NULL); if (cifs_mid_cachep == NULL) return -ENOMEM; + + cifs_mid_poolp = mempool_create(3 /* a reasonable min simultan opers */, + mempool_alloc_slab, + mempool_free_slab, + cifs_mid_cachep); + if(cifs_mid_poolp == NULL) { + kmem_cache_destroy(cifs_mid_cachep); + return -ENOMEM; + } + cifs_oplock_cachep = kmem_cache_create("cifs_oplock_structs", sizeof (struct oplock_q_entry), 0, SLAB_HWCACHE_ALIGN, NULL, NULL); if (cifs_oplock_cachep == NULL) { kmem_cache_destroy(cifs_mid_cachep); + mempool_destroy(cifs_mid_poolp); return -ENOMEM; } @@ -626,9 +653,11 @@ cifs_init_mids(void) static void cifs_destroy_mids(void) { + mempool_destroy(cifs_mid_poolp); if (kmem_cache_destroy(cifs_mid_cachep)) printk(KERN_WARNING "cifs_destroy_mids: error not all structures were freed\n"); + if (kmem_cache_destroy(cifs_oplock_cachep)) printk(KERN_WARNING "error not all oplock structures were freed\n");