diff options
| author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-03-23 23:44:19 -0500 |
|---|---|---|
| committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-03-23 23:44:19 -0500 |
| commit | 1ebbe2b20091d306453a5cf480a87e6cd28ae76f (patch) | |
| tree | f5cd7a0fa69b8b1938cb5a0faed2e7b0628072a5 /include/linux/file.h | |
| parent | ac58c9059da8886b5e8cde012a80266b18ca146e (diff) | |
| parent | 674a396c6d2ba0341ebdd7c1c9950f32f018e2dd (diff) | |
Merge branch 'linus'
Diffstat (limited to 'include/linux/file.h')
| -rw-r--r-- | include/linux/file.h | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/include/linux/file.h b/include/linux/file.h index 9901b850f2e4..9f7c2513866f 100644 --- a/include/linux/file.h +++ b/include/linux/file.h | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #include <linux/compiler.h> | 10 | #include <linux/compiler.h> |
| 11 | #include <linux/spinlock.h> | 11 | #include <linux/spinlock.h> |
| 12 | #include <linux/rcupdate.h> | 12 | #include <linux/rcupdate.h> |
| 13 | #include <linux/types.h> | ||
| 13 | 14 | ||
| 14 | /* | 15 | /* |
| 15 | * The default fd array needs to be at least BITS_PER_LONG, | 16 | * The default fd array needs to be at least BITS_PER_LONG, |
| @@ -17,10 +18,22 @@ | |||
| 17 | */ | 18 | */ |
| 18 | #define NR_OPEN_DEFAULT BITS_PER_LONG | 19 | #define NR_OPEN_DEFAULT BITS_PER_LONG |
| 19 | 20 | ||
| 21 | /* | ||
| 22 | * The embedded_fd_set is a small fd_set, | ||
| 23 | * suitable for most tasks (which open <= BITS_PER_LONG files) | ||
| 24 | */ | ||
| 25 | struct embedded_fd_set { | ||
| 26 | unsigned long fds_bits[1]; | ||
| 27 | }; | ||
| 28 | |||
| 29 | /* | ||
| 30 | * More than this number of fds: we use a separately allocated fd_set | ||
| 31 | */ | ||
| 32 | #define EMBEDDED_FD_SET_SIZE (BITS_PER_BYTE * sizeof(struct embedded_fd_set)) | ||
| 33 | |||
| 20 | struct fdtable { | 34 | struct fdtable { |
| 21 | unsigned int max_fds; | 35 | unsigned int max_fds; |
| 22 | int max_fdset; | 36 | int max_fdset; |
| 23 | int next_fd; | ||
| 24 | struct file ** fd; /* current fd array */ | 37 | struct file ** fd; /* current fd array */ |
| 25 | fd_set *close_on_exec; | 38 | fd_set *close_on_exec; |
| 26 | fd_set *open_fds; | 39 | fd_set *open_fds; |
| @@ -33,13 +46,20 @@ struct fdtable { | |||
| 33 | * Open file table structure | 46 | * Open file table structure |
| 34 | */ | 47 | */ |
| 35 | struct files_struct { | 48 | struct files_struct { |
| 49 | /* | ||
| 50 | * read mostly part | ||
| 51 | */ | ||
| 36 | atomic_t count; | 52 | atomic_t count; |
| 37 | struct fdtable *fdt; | 53 | struct fdtable *fdt; |
| 38 | struct fdtable fdtab; | 54 | struct fdtable fdtab; |
| 39 | fd_set close_on_exec_init; | 55 | /* |
| 40 | fd_set open_fds_init; | 56 | * written part on a separate cache line in SMP |
| 57 | */ | ||
| 58 | spinlock_t file_lock ____cacheline_aligned_in_smp; | ||
| 59 | int next_fd; | ||
| 60 | struct embedded_fd_set close_on_exec_init; | ||
| 61 | struct embedded_fd_set open_fds_init; | ||
| 41 | struct file * fd_array[NR_OPEN_DEFAULT]; | 62 | struct file * fd_array[NR_OPEN_DEFAULT]; |
| 42 | spinlock_t file_lock; /* Protects concurrent writers. Nests inside tsk->alloc_lock */ | ||
| 43 | }; | 63 | }; |
| 44 | 64 | ||
| 45 | #define files_fdtable(files) (rcu_dereference((files)->fdt)) | 65 | #define files_fdtable(files) (rcu_dereference((files)->fdt)) |
