summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/buffer.c3
-rw-r--r--fs/partitions/Makefile53
-rw-r--r--fs/select.c111
3 files changed, 55 insertions, 112 deletions
diff --git a/fs/buffer.c b/fs/buffer.c
index b1e1c33b7..ba02c8be1 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -1759,9 +1759,6 @@ static int do_kio(int rw, int nr, struct buffer_head *bh[], int size)
int i;
struct buffer_head *tmp;
- struct task_struct *tsk = current;
- DECLARE_WAITQUEUE(wait, tsk);
-
if (rw == WRITE)
rw = WRITERAW;
ll_rw_block(rw, nr, bh);
diff --git a/fs/partitions/Makefile b/fs/partitions/Makefile
index 4b41d2a75..224af1eba 100644
--- a/fs/partitions/Makefile
+++ b/fs/partitions/Makefile
@@ -8,47 +8,24 @@
# Note 2! The CFLAGS definitions are now in the main makefile...
O_TARGET := partitions.o
-O_OBJS := check.o
-
-ifeq ($(CONFIG_ACORN_PARTITION),y)
-O_OBJS += acorn.o
-endif
-
-ifeq ($(CONFIG_AMIGA_PARTITION),y)
-O_OBJS += amiga.o
-endif
-
-ifeq ($(CONFIG_ATARI_PARTITION),y)
-O_OBJS += atari.o
-endif
-
+OX_OBJS := check.o
+
+obj-$(CONFIG_ACORN_PARTITION) += acorn.o
+obj-$(CONFIG_AMIGA_PARTITION) += amiga.o
+obj-$(CONFIG_ATARI_PARTITION) += atari.o
+obj-$(CONFIG_MAC_PARTITION) += mac.o
+obj-$(CONFIG_MSDOS_PARTITION) += msdos.o
+obj-$(CONFIG_OSF_PARTITION) += osf.o
+obj-$(CONFIG_SGI_PARTITION) += sgi.o
+obj-$(CONFIG_SUN_PARTITION) += sun.o
+obj-$(CONFIG_ULTRIX_PARTITION) += ultrix.o
+
+O_OBJS += $(obj-y)
+M_OBJS += $(obj-m)
ifeq ($(CONFIG_IBM_PARTITION),y)
O_OBJS += ibm.o
endif
-ifeq ($(CONFIG_MAC_PARTITION),y)
-O_OBJS += mac.o
-endif
-
-ifeq ($(CONFIG_MSDOS_PARTITION),y)
-O_OBJS += msdos.o
-endif
-
-ifeq ($(CONFIG_OSF_PARTITION),y)
-O_OBJS += osf.o
-endif
-
-ifeq ($(CONFIG_SGI_PARTITION),y)
-O_OBJS += sgi.o
-endif
-
-ifeq ($(CONFIG_SUN_PARTITION),y)
-O_OBJS += sun.o
-endif
-
-ifeq ($(CONFIG_ULTRIX_PARTITION),y)
-O_OBJS += ultrix.o
-endif
-
include $(TOPDIR)/Rules.make
+
diff --git a/fs/select.c b/fs/select.c
index 86c2793d7..a9fd61953 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -37,51 +37,12 @@
* poll table.
*/
-/*
- * I rewrote this again to make the poll_table size variable, take some
- * more shortcuts, improve responsiveness, and remove another race that
- * Linus noticed. -- jrs
- */
-
-static poll_table* alloc_wait(int nfds)
+static void free_wait(struct poll_table_page * p)
{
- poll_table* out;
- poll_table* walk;
-
- out = (poll_table *) __get_free_page(GFP_KERNEL);
- if(out==NULL)
- return NULL;
- out->nr = 0;
- out->entry = (struct poll_table_entry *)(out + 1);
- out->next = NULL;
- nfds -=__MAX_POLL_TABLE_ENTRIES;
- walk = out;
- while(nfds > 0) {
- poll_table *tmp = (poll_table *) __get_free_page(GFP_KERNEL);
- if (!tmp) {
- while(out != NULL) {
- tmp = out->next;
- free_page((unsigned long)out);
- out = tmp;
- }
- return NULL;
- }
- tmp->nr = 0;
- tmp->entry = (struct poll_table_entry *)(tmp + 1);
- tmp->next = NULL;
- walk->next = tmp;
- walk = tmp;
- nfds -=__MAX_POLL_TABLE_ENTRIES;
- }
- return out;
-}
-
-static void free_wait(poll_table * p)
-{
- struct poll_table_entry * entry;
- poll_table *old;
-
while (p) {
+ struct poll_table_entry * entry;
+ struct poll_table_page *old;
+
entry = p->entry + p->nr;
while (p->nr > 0) {
p->nr--;
@@ -97,19 +58,33 @@ static void free_wait(poll_table * p)
void __pollwait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p)
{
- for (;;) {
- if (p->nr < __MAX_POLL_TABLE_ENTRIES) {
- struct poll_table_entry * entry;
- entry = p->entry + p->nr;
- get_file(filp);
- entry->filp = filp;
- entry->wait_address = wait_address;
- init_waitqueue_entry(&entry->wait, current);
- add_wait_queue(wait_address,&entry->wait);
- p->nr++;
+ struct poll_table_page *table = p->table;
+
+ if (!table || table->nr >= __MAX_POLL_TABLE_ENTRIES) {
+ struct poll_table_page *new_table;
+
+ new_table = (struct poll_table_page *) __get_free_page(GFP_KERNEL);
+ if (!new_table) {
+ p->error = -ENOMEM;
return;
}
- p = p->next;
+ new_table->nr = 0;
+ new_table->entry = (struct poll_table_entry *)(new_table + 1);
+ new_table->next = table;
+ p->table = new_table;
+ table = new_table;
+ }
+
+ /* Add a new entry */
+ {
+ struct poll_table_entry * entry;
+ entry = table->entry + table->nr;
+ table->nr++;
+ get_file(filp);
+ entry->filp = filp;
+ entry->wait_address = wait_address;
+ init_waitqueue_entry(&entry->wait, current);
+ add_wait_queue(wait_address,&entry->wait);
}
}
@@ -173,12 +148,10 @@ get_max:
int do_select(int n, fd_set_bits *fds, long *timeout)
{
- poll_table *wait, *orig_wait;
+ poll_table table, *wait;
int retval, i, off;
long __timeout = *timeout;
- orig_wait = wait = NULL;
-
read_lock(&current->files->file_lock);
retval = max_select_fd(n, fds);
read_unlock(&current->files->file_lock);
@@ -186,11 +159,10 @@ int do_select(int n, fd_set_bits *fds, long *timeout)
if (retval < 0)
return retval;
n = retval;
- if (__timeout) {
- orig_wait = wait = alloc_wait(n);
- if (!wait)
- return -ENOMEM;
- }
+
+ table.error = 0;
+ table.table = NULL;
+ wait = &table;
retval = 0;
for (;;) {
set_current_state(TASK_INTERRUPTIBLE);
@@ -233,7 +205,7 @@ int do_select(int n, fd_set_bits *fds, long *timeout)
}
current->state = TASK_RUNNING;
- free_wait(orig_wait);
+ free_wait(table.table);
/*
* Up-to-date the caller timeout.
@@ -404,7 +376,7 @@ asmlinkage long sys_poll(struct pollfd * ufds, unsigned int nfds, long timeout)
{
int i, j, fdcount, err;
struct pollfd **fds;
- poll_table *wait = NULL;
+ poll_table table;
int nchunks, nleft;
/* Do a sanity check on nfds ... */
@@ -419,11 +391,8 @@ asmlinkage long sys_poll(struct pollfd * ufds, unsigned int nfds, long timeout)
timeout = MAX_SCHEDULE_TIMEOUT;
}
- if (timeout) {
- wait = alloc_wait(nfds);
- if (!wait)
- return -ENOMEM;
- }
+ table.error = 0;
+ table.table = NULL;
err = -ENOMEM;
fds = NULL;
@@ -460,7 +429,7 @@ asmlinkage long sys_poll(struct pollfd * ufds, unsigned int nfds, long timeout)
goto out_fds1;
}
- fdcount = do_poll(nfds, nchunks, nleft, fds, wait, timeout);
+ fdcount = do_poll(nfds, nchunks, nleft, fds, &table, timeout);
/* OK, now copy the revents fields back to user space. */
for(i=0; i < nchunks; i++)
@@ -483,6 +452,6 @@ out_fds:
if (nfds != 0)
kfree(fds);
out:
- free_wait(wait);
+ free_wait(table.table);
return err;
}