summaryrefslogtreecommitdiffstats
path: root/fs/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/file.c')
-rw-r--r--fs/file.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/fs/file.c b/fs/file.c
index 7bdf29179..2f8ea1918 100644
--- a/fs/file.c
+++ b/fs/file.c
@@ -24,11 +24,9 @@ struct file ** alloc_fd_array(int num)
struct file **new_fds;
int size = num * sizeof(struct file *);
- if (size < PAGE_SIZE)
+ if (size <= PAGE_SIZE)
new_fds = (struct file **) kmalloc(size, GFP_KERNEL);
- else if (size == PAGE_SIZE)
- new_fds = (struct file **) __get_free_page(GFP_KERNEL);
- else
+ else
new_fds = (struct file **) vmalloc(size);
return new_fds;
}
@@ -44,10 +42,8 @@ void free_fd_array(struct file **array, int num)
if (num <= NR_OPEN_DEFAULT) /* Don't free the embedded fd array! */
return;
- else if (size < PAGE_SIZE)
+ else if (size <= PAGE_SIZE)
kfree(array);
- else if (size == PAGE_SIZE)
- free_page((unsigned long) array);
else
vfree(array);
}
@@ -137,10 +133,8 @@ fd_set * alloc_fdset(int num)
fd_set *new_fdset;
int size = num / 8;
- if (size < PAGE_SIZE)
+ if (size <= PAGE_SIZE)
new_fdset = (fd_set *) kmalloc(size, GFP_KERNEL);
- else if (size == PAGE_SIZE)
- new_fdset = (fd_set *) __get_free_page(GFP_KERNEL);
else
new_fdset = (fd_set *) vmalloc(size);
return new_fdset;
@@ -157,10 +151,8 @@ void free_fdset(fd_set *array, int num)
if (num <= __FD_SETSIZE) /* Don't free an embedded fdset */
return;
- else if (size < PAGE_SIZE)
+ else if (size <= PAGE_SIZE)
kfree(array);
- else if (size == PAGE_SIZE)
- free_page((unsigned long) array);
else
vfree(array);
}