Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
39ea3798
Commit
39ea3798
authored
Nov 30, 2004
by
Steve French
Committed by
Steve French
Nov 30, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CIFS] CIFS buffer management improvements part 1
Signed-off-by: Steve French (sfrench@us.ibm.com)
parent
5b3783d4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
84 additions
and
4 deletions
+84
-4
fs/cifs/cifsfs.c
fs/cifs/cifsfs.c
+36
-0
fs/cifs/cifsglob.h
fs/cifs/cifsglob.h
+1
-0
fs/cifs/cifspdu.h
fs/cifs/cifspdu.h
+1
-1
fs/cifs/connect.c
fs/cifs/connect.c
+1
-1
fs/cifs/misc.c
fs/cifs/misc.c
+45
-2
No files found.
fs/cifs/cifsfs.c
View file @
39ea3798
...
@@ -207,6 +207,9 @@ static kmem_cache_t *cifs_inode_cachep;
...
@@ -207,6 +207,9 @@ static kmem_cache_t *cifs_inode_cachep;
static
kmem_cache_t
*
cifs_req_cachep
;
static
kmem_cache_t
*
cifs_req_cachep
;
static
kmem_cache_t
*
cifs_mid_cachep
;
static
kmem_cache_t
*
cifs_mid_cachep
;
kmem_cache_t
*
cifs_oplock_cachep
;
kmem_cache_t
*
cifs_oplock_cachep
;
#ifdef CIFS_EXPERIMENTAL
mempool_t
*
cifs_sm_req_poolp
;
#endif
/* CIFS_EXPERIMENTAL */
mempool_t
*
cifs_req_poolp
;
mempool_t
*
cifs_req_poolp
;
mempool_t
*
cifs_mid_poolp
;
mempool_t
*
cifs_mid_poolp
;
...
@@ -604,6 +607,33 @@ cifs_init_request_bufs(void)
...
@@ -604,6 +607,33 @@ cifs_init_request_bufs(void)
kmem_cache_destroy
(
cifs_req_cachep
);
kmem_cache_destroy
(
cifs_req_cachep
);
return
-
ENOMEM
;
return
-
ENOMEM
;
}
}
#ifdef CIFS_EXPERIMENTAL
/* 120 bytes is enough for most SMB responses and handle
based requests (but not write response, nor is it
sufficient for path based requests). 120 bytes is 83
more than sizeof(struct smb_hdr) and smaller than 128 byte
cutoff which should make it easy to alloc off the slab
compared to 17K (5page) alloc of large cifs buffers */
cifs_sm_req_cachep
=
kmem_cache_create
(
"cifs_small_rq"
,
120
,
0
,
SLAB_HWCACHE_ALIGN
,
NULL
,
NULL
);
if
(
cifs_sm_req_cachep
==
NULL
)
{
mempool_destroy
(
cifs_req_poolp
);
kmem_cache_destroy
(
cifs_req_cachep
);
return
-
ENOMEM
;
}
cifs_sm_req_poolp
=
mempool_create
(
64
,
mempool_alloc_slab
,
mempool_free_slab
,
cifs_sm_req_cachep
);
if
(
cifs_sm_req_poolp
==
NULL
)
{
mempool_destroy
(
cifs_req_poolp
);
kmem_cache_destroy
(
cifs_req_cachep
);
kmem_cache_destroy
(
cifs_sm_req_cachep
);
return
-
ENOMEM
;
}
#endif
/* CIFS_EXPERIMENTAL */
return
0
;
return
0
;
}
}
...
@@ -615,6 +645,12 @@ cifs_destroy_request_bufs(void)
...
@@ -615,6 +645,12 @@ cifs_destroy_request_bufs(void)
if
(
kmem_cache_destroy
(
cifs_req_cachep
))
if
(
kmem_cache_destroy
(
cifs_req_cachep
))
printk
(
KERN_WARNING
printk
(
KERN_WARNING
"cifs_destroy_request_cache: error not all structures were freed
\n
"
);
"cifs_destroy_request_cache: error not all structures were freed
\n
"
);
#ifdef CIFS_EXPERIMENTAL
mempool_destroy
(
cifs_sm_req_poolp
);
if
(
kmem_cache_destroy
(
cifs_sm_req_cachep
))
printk
(
KERN_WARNING
"cifs_destroy_request_cache: cifs_small_rq free error
\n
"
);
#endif
/* CIFS_EXPERIMENTAL */
}
}
static
int
static
int
...
...
fs/cifs/cifsglob.h
View file @
39ea3798
...
@@ -330,6 +330,7 @@ struct oplock_q_entry {
...
@@ -330,6 +330,7 @@ struct oplock_q_entry {
#define MID_RESPONSE_RECEIVED 4
#define MID_RESPONSE_RECEIVED 4
#define MID_RETRY_NEEDED 8
/* session closed while this request out */
#define MID_RETRY_NEEDED 8
/* session closed while this request out */
#define MID_NO_RESP_NEEDED 0x10
#define MID_NO_RESP_NEEDED 0x10
#define MID_SMALL_BUFFER 0x20
/* 120 byte response buffer instead of 4K */
/*
/*
*****************************************************************
*****************************************************************
...
...
fs/cifs/cifspdu.h
View file @
39ea3798
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
Knowing this helps avoid response buffer allocations and copy in some cases */
Knowing this helps avoid response buffer allocations and copy in some cases */
#define SMB_COM_CREATE_DIRECTORY 0x00
/* trivial response */
#define SMB_COM_CREATE_DIRECTORY 0x00
/* trivial response */
#define SMB_COM_DELETE_DIRECTORY 0x01
/* trivial response */
#define SMB_COM_DELETE_DIRECTORY 0x01
/* trivial response */
#define SMB_COM_CLOSE 0x04
/* triv
ial
rsp, timestamp ignored */
#define SMB_COM_CLOSE 0x04
/* triv
req/
rsp, timestamp ignored */
#define SMB_COM_DELETE 0x06
/* trivial response */
#define SMB_COM_DELETE 0x06
/* trivial response */
#define SMB_COM_RENAME 0x07
/* trivial response */
#define SMB_COM_RENAME 0x07
/* trivial response */
#define SMB_COM_LOCKING_ANDX 0x24
/* trivial response */
#define SMB_COM_LOCKING_ANDX 0x24
/* trivial response */
...
...
fs/cifs/connect.c
View file @
39ea3798
...
@@ -507,7 +507,7 @@ cifs_kcalloc(size_t size, int type)
...
@@ -507,7 +507,7 @@ cifs_kcalloc(size_t size, int type)
}
}
static
int
static
int
cifs_parse_mount_options
(
char
*
options
,
const
char
*
devname
,
struct
smb_vol
*
vol
)
cifs_parse_mount_options
(
char
*
options
,
const
char
*
devname
,
struct
smb_vol
*
vol
)
{
{
char
*
value
;
char
*
value
;
char
*
data
;
char
*
data
;
...
...
fs/cifs/misc.c
View file @
39ea3798
/*
/*
* fs/cifs/misc.c
* fs/cifs/misc.c
*
*
* Copyright (C) International Business Machines Corp., 2002,200
3
* Copyright (C) International Business Machines Corp., 2002,200
4
* Author(s): Steve French (sfrench@us.ibm.com)
* Author(s): Steve French (sfrench@us.ibm.com)
*
*
* This library is free software; you can redistribute it and/or modify
* This library is free software; you can redistribute it and/or modify
...
@@ -29,6 +29,9 @@
...
@@ -29,6 +29,9 @@
#include "smberr.h"
#include "smberr.h"
#include "nterr.h"
#include "nterr.h"
#ifdef CIFS_EXPERIMENTAL
extern
mempool_t
*
cifs_sm_req_poolp
;
#endif
/* CIFS_EXPERIMENTAL */
extern
mempool_t
*
cifs_req_poolp
;
extern
mempool_t
*
cifs_req_poolp
;
extern
struct
task_struct
*
oplockThread
;
extern
struct
task_struct
*
oplockThread
;
...
@@ -160,8 +163,10 @@ cifs_buf_get(void)
...
@@ -160,8 +163,10 @@ cifs_buf_get(void)
(
struct
smb_hdr
*
)
mempool_alloc
(
cifs_req_poolp
,
SLAB_KERNEL
|
SLAB_NOFS
);
(
struct
smb_hdr
*
)
mempool_alloc
(
cifs_req_poolp
,
SLAB_KERNEL
|
SLAB_NOFS
);
/* clear the first few header bytes */
/* clear the first few header bytes */
/* clear through bcc + 1, making an even 40 bytes */
if
(
ret_buf
)
{
if
(
ret_buf
)
{
memset
(
ret_buf
,
0
,
sizeof
(
struct
smb_hdr
)
);
memset
(
ret_buf
,
0
,
sizeof
(
struct
smb_hdr
)
+
3
);
atomic_inc
(
&
bufAllocCount
);
atomic_inc
(
&
bufAllocCount
);
}
}
...
@@ -182,6 +187,44 @@ cifs_buf_release(void *buf_to_free)
...
@@ -182,6 +187,44 @@ cifs_buf_release(void *buf_to_free)
return
;
return
;
}
}
#ifdef CIFS_EXPERIMENTAL
struct
smb_hdr
*
cifs_small_buf_get
(
void
)
{
struct
smb_hdr
*
ret_buf
=
NULL
;
/* We could use negotiated size instead of max_msgsize -
but it may be more efficient to always alloc same size
albeit slightly larger than necessary and maxbuffersize
defaults to this and can not be bigger */
ret_buf
=
(
struct
smb_hdr
*
)
mempool_alloc
(
cifs_sm_req_poolp
,
SLAB_KERNEL
|
SLAB_NOFS
);
/* clear the first few header bytes */
/* clear through bcc + 1, making an even 40 bytes */
if
(
ret_buf
)
{
memset
(
ret_buf
,
0
,
sizeof
(
struct
smb_hdr
)
+
3
);
atomic_inc
(
&
smBufAllocCount
);
}
return
ret_buf
;
}
void
cifs_small_buf_release
(
void
*
buf_to_free
)
{
if
(
buf_to_free
==
NULL
)
{
cFYI
(
1
,
(
"Null buffer passed to cifs_small_buf_release"
));
return
;
}
mempool_free
(
buf_to_free
,
cifs_sm_req_poolp
);
atomic_dec
(
&
smBufAllocCount
);
return
;
}
#endif
/* CIFS_EXPERIMENTAL */
void
void
header_assemble
(
struct
smb_hdr
*
buffer
,
char
smb_command
/* command */
,
header_assemble
(
struct
smb_hdr
*
buffer
,
char
smb_command
/* command */
,
const
struct
cifsTconInfo
*
treeCon
,
int
word_count
const
struct
cifsTconInfo
*
treeCon
,
int
word_count
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment