diff options
-rw-r--r-- | fs/file.c | 11 | ||||
-rw-r--r-- | fs/file_table.c | 1 | ||||
-rw-r--r-- | include/linux/fdtable.h | 2 |
3 files changed, 4 insertions, 10 deletions
@@ -25,7 +25,10 @@ | |||
25 | 25 | ||
26 | int sysctl_nr_open __read_mostly = 1024*1024; | 26 | int sysctl_nr_open __read_mostly = 1024*1024; |
27 | int sysctl_nr_open_min = BITS_PER_LONG; | 27 | int sysctl_nr_open_min = BITS_PER_LONG; |
28 | int sysctl_nr_open_max = 1024 * 1024; /* raised later */ | 28 | /* our max() is unusable in constant expressions ;-/ */ |
29 | #define __const_max(x, y) ((x) < (y) ? (x) : (y)) | ||
30 | int sysctl_nr_open_max = __const_max(INT_MAX, ~(size_t)0/sizeof(void *)) & | ||
31 | -BITS_PER_LONG; | ||
29 | 32 | ||
30 | static void *alloc_fdmem(size_t size) | 33 | static void *alloc_fdmem(size_t size) |
31 | { | 34 | { |
@@ -429,12 +432,6 @@ void exit_files(struct task_struct *tsk) | |||
429 | } | 432 | } |
430 | } | 433 | } |
431 | 434 | ||
432 | void __init files_defer_init(void) | ||
433 | { | ||
434 | sysctl_nr_open_max = min((size_t)INT_MAX, ~(size_t)0/sizeof(void *)) & | ||
435 | -BITS_PER_LONG; | ||
436 | } | ||
437 | |||
438 | struct files_struct init_files = { | 435 | struct files_struct init_files = { |
439 | .count = ATOMIC_INIT(1), | 436 | .count = ATOMIC_INIT(1), |
440 | .fdt = &init_files.fdtab, | 437 | .fdt = &init_files.fdtab, |
diff --git a/fs/file_table.c b/fs/file_table.c index ce1504fec5a1..718e8e5224f8 100644 --- a/fs/file_table.c +++ b/fs/file_table.c | |||
@@ -325,6 +325,5 @@ void __init files_init(unsigned long mempages) | |||
325 | 325 | ||
326 | n = (mempages * (PAGE_SIZE / 1024)) / 10; | 326 | n = (mempages * (PAGE_SIZE / 1024)) / 10; |
327 | files_stat.max_files = max_t(unsigned long, n, NR_FILE); | 327 | files_stat.max_files = max_t(unsigned long, n, NR_FILE); |
328 | files_defer_init(); | ||
329 | percpu_counter_init(&nr_files, 0); | 328 | percpu_counter_init(&nr_files, 0); |
330 | } | 329 | } |
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h index 70e8e21c0a30..230f87bdf5ad 100644 --- a/include/linux/fdtable.h +++ b/include/linux/fdtable.h | |||
@@ -63,8 +63,6 @@ struct file_operations; | |||
63 | struct vfsmount; | 63 | struct vfsmount; |
64 | struct dentry; | 64 | struct dentry; |
65 | 65 | ||
66 | extern void __init files_defer_init(void); | ||
67 | |||
68 | #define rcu_dereference_check_fdtable(files, fdtfd) \ | 66 | #define rcu_dereference_check_fdtable(files, fdtfd) \ |
69 | rcu_dereference_check((fdtfd), lockdep_is_held(&(files)->file_lock)) | 67 | rcu_dereference_check((fdtfd), lockdep_is_held(&(files)->file_lock)) |
70 | 68 | ||