#include <linux/list.h>
#include <linux/seq_file.h>
#include <linux/vfs.h>
+#include <linux/mempool.h>
#include "cifsfs.h"
#include "cifspdu.h"
#define DECLARE_GLOBALS_HERE
#include "cifs_debug.h"
#include "cifs_fs_sb.h"
#include <linux/mm.h>
-#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
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;
}
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)
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)
{
}
static ssize_t
-cifs_read_wrapper(struct file * file, char *read_data, size_t read_size,
+cifs_read_wrapper(struct file * file, char __user *read_data, size_t read_size,
loff_t * poffset)
{
if(file == NULL)
}
static ssize_t
-cifs_write_wrapper(struct file * file, const char *write_data,
+cifs_write_wrapper(struct file * file, const char __user *write_data,
size_t write_size, loff_t * poffset)
{
ssize_t written;
.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,
/* 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,
.flush = cifs_flush,
.mmap = cifs_file_mmap,
.sendfile = generic_file_sendfile,
-#ifdef CIFS_FCNTL
+#ifdef CONFIG_CIFS_FCNTL
.fcntl = cifs_fcntl,
#endif
};
.readdir = cifs_readdir,
.release = cifs_closedir,
.read = generic_read_dir,
-#ifdef CIFS_FCNTL
+#ifdef CONFIG_CIFS_FCNTL
.fcntl = cifs_fcntl,
#endif
};
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");
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;
}
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");