summaryrefslogtreecommitdiff
path: root/source4/ntvfs/posix/vfs_posix.h
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-10-19 06:39:51 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:01:54 -0500
commitcf1b85348a0fc5bf4788291109c9dca9e95eb9c2 (patch)
tree4ddd852640cc81c255677a7a6057a6d84b692a45 /source4/ntvfs/posix/vfs_posix.h
parent2b8aa720f47804f783679388f40a9345eff897b9 (diff)
downloadsamba-cf1b85348a0fc5bf4788291109c9dca9e95eb9c2.tar.gz
samba-cf1b85348a0fc5bf4788291109c9dca9e95eb9c2.tar.bz2
samba-cf1b85348a0fc5bf4788291109c9dca9e95eb9c2.zip
r3056: added a id -> pointer data structure (a type of radix tree). This is
an extremely efficient way of mapping from an integer handle (such as an open file handle) to a pointer (such as the structure containing the open file information). The code is taken from lib/idr.c in the 2.6 Linux kernel, and is very fast and space efficient. By using talloc it even has auto cleanup. This commit converts the handling of open file handles and open directory search handles to use the idtree routines. In combination with talloc destructors, this simplifies the structure handling in the pvfs backend a lot. For example, we no longer need to keep a linked list of open directory searches at all, and we no longer need to do linear scans of the list of open files on most operations. The end result is that the pvfs code is now extremely scalable. You can have 10s of thousands of open files and open searches and the code still runs very fast. I have also added a small optimisation into the file close path, to avoid looking in the byte range locking database if we know that there are no locks outstanding. (This used to be commit 16835a0ef91a16fa01145b773aad8d43da215dbf)
Diffstat (limited to 'source4/ntvfs/posix/vfs_posix.h')
-rw-r--r--source4/ntvfs/posix/vfs_posix.h28
1 files changed, 11 insertions, 17 deletions
diff --git a/source4/ntvfs/posix/vfs_posix.h b/source4/ntvfs/posix/vfs_posix.h
index 6aaa43a213..ae601c60c7 100644
--- a/source4/ntvfs/posix/vfs_posix.h
+++ b/source4/ntvfs/posix/vfs_posix.h
@@ -32,27 +32,17 @@ struct pvfs_state {
const char *share_name;
uint_t flags;
- struct {
- /* a linked list of open searches */
- struct pvfs_search_state *open_searches;
-
- /* search handles are returned to the clients so they
- can continue searches */
- uint16_t next_search_handle;
-
- /* count of active searches */
- uint_t num_active_searches;
-
- /* during trans2 search continuations we need to use
- the initial search attributes */
- uint16_t search_attrib;
- } search;
-
struct pvfs_file *open_files;
struct pvfs_mangle_context *mangle_ctx;
void *brl_context;
+
+ /* an id tree mapping open search ID to a pvfs_search_state structure */
+ void *idtree_search;
+
+ /* an id tree mapping open file handle -> struct pvfs_file */
+ void *idtree_fnum;
};
@@ -95,7 +85,7 @@ struct pvfs_dir {
/* the state of a search started with pvfs_search_first() */
struct pvfs_search_state {
- struct pvfs_search_state *next, *prev;
+ struct pvfs_state *pvfs;
uint16_t handle;
uint_t current_index;
uint16_t search_attrib;
@@ -126,6 +116,10 @@ struct pvfs_file {
/* a list of pending locks - used for locking cancel operations */
struct pvfs_pending_lock *pending_list;
+
+ /* a count of active locks - used to avoid calling brl_close on
+ file close */
+ uint64_t lock_count;
};