]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
fs: remove all rcu head initializations, except on_stack initializations
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Tue, 11 May 2010 00:09:25 +0000 (17:09 -0700)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Mon, 14 Jun 2010 23:37:26 +0000 (16:37 -0700)
Remove all rcu head inits. We don't care about the RCU head state before passing
it to call_rcu() anyway. Only leave the "on_stack" variants so debugobjects can
keep track of objects on stack.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Andries Brouwer <aeb@cwi.nl>
fs/file.c
fs/fs-writeback.c
fs/partitions/check.c

index 34bb7f71d99404e8b91a4bfb0654505d1e537318..cccaead962c2efe31c01029ca1ffa34676cffc8a 100644 (file)
--- a/fs/file.c
+++ b/fs/file.c
@@ -178,7 +178,6 @@ static struct fdtable * alloc_fdtable(unsigned int nr)
        fdt->open_fds = (fd_set *)data;
        data += nr / BITS_PER_BYTE;
        fdt->close_on_exec = (fd_set *)data;
-       INIT_RCU_HEAD(&fdt->rcu);
        fdt->next = NULL;
 
        return fdt;
@@ -312,7 +311,6 @@ struct files_struct *dup_fd(struct files_struct *oldf, int *errorp)
        new_fdt->close_on_exec = (fd_set *)&newf->close_on_exec_init;
        new_fdt->open_fds = (fd_set *)&newf->open_fds_init;
        new_fdt->fd = &newf->fd_array[0];
-       INIT_RCU_HEAD(&new_fdt->rcu);
        new_fdt->next = NULL;
 
        spin_lock(&oldf->file_lock);
@@ -430,7 +428,6 @@ struct files_struct init_files = {
                .fd             = &init_files.fd_array[0],
                .close_on_exec  = (fd_set *)&init_files.close_on_exec_init,
                .open_fds       = (fd_set *)&init_files.open_fds_init,
-               .rcu            = RCU_HEAD_INIT,
        },
        .file_lock      = __SPIN_LOCK_UNLOCKED(init_task.file_lock),
 };
index 1d1088f48bc2dfe713d53a9af0fa4d51e1161428..af92100a7411c62cb614709fbe783541c73fd2da 100644 (file)
@@ -75,12 +75,33 @@ static inline bool bdi_work_on_stack(struct bdi_work *work)
        return test_bit(WS_ONSTACK_B, &work->state);
 }
 
-static inline void bdi_work_init(struct bdi_work *work,
-                                struct wb_writeback_args *args)
+static inline void __bdi_work_init(struct bdi_work *work,
+                                  struct wb_writeback_args *args,
+                                  int on_stack)
 {
-       INIT_RCU_HEAD(&work->rcu_head);
        work->args = *args;
        work->state = WS_USED;
+       if (on_stack) {
+               work->state |= WS_ONSTACK;
+               init_rcu_head_on_stack(&work->rcu_head);
+       }
+}
+
+static inline void bdi_work_init(struct bdi_work *work,
+                                struct wb_writeback_args *args)
+{
+       __bdi_work_init(work, args, false);
+}
+
+static inline void bdi_work_init_on_stack(struct bdi_work *work,
+                                         struct wb_writeback_args *args)
+{
+       __bdi_work_init(work, args, true);
+}
+
+static inline void bdi_destroy_work_on_stack(struct bdi_work *work)
+{
+       destroy_rcu_head_on_stack(&work->rcu_head);
 }
 
 /**
@@ -233,11 +254,11 @@ static void bdi_sync_writeback(struct backing_dev_info *bdi,
        };
        struct bdi_work work;
 
-       bdi_work_init(&work, &args);
-       work.state |= WS_ONSTACK;
+       bdi_work_init_on_stack(&work, &args);
 
        bdi_queue_work(bdi, &work);
        bdi_wait_on_work_clear(&work);
+       bdi_destroy_work_on_stack(&work);
 }
 
 /**
index 5dcd4b0c5533346e360f12bc6c62c510a0722d28..72c52656dc2e7a00fd2f05b072002fe88302afe9 100644 (file)
@@ -459,7 +459,6 @@ struct hd_struct *add_partition(struct gendisk *disk, int partno,
        }
 
        /* everything is up and running, commence */
-       INIT_RCU_HEAD(&p->rcu_head);
        rcu_assign_pointer(ptbl->part[partno], p);
 
        /* suppress uevent if the disk supresses it */