Whamcloud - gitweb
LU-1346 libcfs: cleanup waitq related primitives
[fs/lustre-release.git] / lustre / llite / lloop.c
index ad3f230..9854d84 100644 (file)
@@ -118,19 +118,19 @@ enum {
 };
 
 struct lloop_device {
-        int                  lo_number;
-        int                  lo_refcnt;
-        loff_t               lo_offset;
-        loff_t               lo_sizelimit;
-        int                  lo_flags;
-        int                (*ioctl)(struct lloop_device *, int cmd,
-                                    unsigned long arg);
+       int                  lo_number;
+       int                  lo_refcnt;
+       loff_t               lo_offset;
+       loff_t               lo_sizelimit;
+       int                  lo_flags;
+       int                (*ioctl)(struct lloop_device *, int cmd,
+                                   unsigned long arg);
 
-        struct file         *lo_backing_file;
-        struct block_device *lo_device;
-        unsigned             lo_blocksize;
+       struct file         *lo_backing_file;
+       struct block_device *lo_device;
+       unsigned             lo_blocksize;
 
-        int                  old_gfp_mask;
+       int                  old_gfp_mask;
 
        spinlock_t              lo_lock;
        struct bio              *lo_bio;
@@ -138,20 +138,20 @@ struct lloop_device {
        int                     lo_state;
        struct semaphore        lo_sem;
        struct mutex            lo_ctl_mutex;
-        cfs_atomic_t         lo_pending;
-        cfs_waitq_t          lo_bh_wait;
+       cfs_atomic_t            lo_pending;
+       wait_queue_head_t       lo_bh_wait;
 
-        struct request_queue *lo_queue;
+       struct request_queue *lo_queue;
 
-        const struct lu_env *lo_env;
-        struct cl_io         lo_io;
-        struct ll_dio_pages  lo_pvec;
+       const struct lu_env *lo_env;
+       struct cl_io         lo_io;
+       struct ll_dio_pages  lo_pvec;
 
-        /* data to handle bio for lustre. */
-        struct lo_request_data {
-                struct page *lrd_pages[LLOOP_MAX_SEGMENTS];
-                loff_t       lrd_offsets[LLOOP_MAX_SEGMENTS];
-        } lo_requests[1];
+       /* data to handle bio for lustre. */
+       struct lo_request_data {
+               struct page *lrd_pages[LLOOP_MAX_SEGMENTS];
+               loff_t       lrd_offsets[LLOOP_MAX_SEGMENTS];
+       } lo_requests[1];
 };
 
 /*
@@ -285,8 +285,8 @@ static void loop_add_bio(struct lloop_device *lo, struct bio *bio)
        spin_unlock_irqrestore(&lo->lo_lock, flags);
 
        cfs_atomic_inc(&lo->lo_pending);
-       if (cfs_waitq_active(&lo->lo_bh_wait))
-               cfs_waitq_signal(&lo->lo_bh_wait);
+       if (waitqueue_active(&lo->lo_bh_wait))
+               wake_up(&lo->lo_bh_wait);
 }
 
 /*
@@ -439,7 +439,7 @@ static int loop_thread(void *data)
        up(&lo->lo_sem);
 
        for (;;) {
-               cfs_wait_event(lo->lo_bh_wait, loop_active(lo));
+               wait_event(lo->lo_bh_wait, loop_active(lo));
                if (!cfs_atomic_read(&lo->lo_pending)) {
                        int exiting = 0;
                        spin_lock_irq(&lo->lo_lock);
@@ -580,7 +580,7 @@ static int loop_clr_fd(struct lloop_device *lo, struct block_device *bdev,
        spin_lock_irq(&lo->lo_lock);
        lo->lo_state = LLOOP_RUNDOWN;
        spin_unlock_irq(&lo->lo_lock);
-       cfs_waitq_signal(&lo->lo_bh_wait);
+       wake_up(&lo->lo_bh_wait);
 
        down(&lo->lo_sem);
         lo->lo_backing_file = NULL;
@@ -823,7 +823,7 @@ static int __init lloop_init(void)
 
                mutex_init(&lo->lo_ctl_mutex);
                sema_init(&lo->lo_sem, 0);
-               cfs_waitq_init(&lo->lo_bh_wait);
+               init_waitqueue_head(&lo->lo_bh_wait);
                lo->lo_number = i;
                spin_lock_init(&lo->lo_lock);
                 disk->major = lloop_major;