Whamcloud - gitweb
LU-1330 obdclass: add obd_target.h
[fs/lustre-release.git] / lustre / llite / lloop.c
index 4c58181..7a5e000 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2012, Intel Corporation.
+ * Copyright (c) 2011, 2013, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -224,7 +224,7 @@ static int do_bio_lustrebacked(struct lloop_device *lo, struct bio *head)
                 offset = (pgoff_t)(bio->bi_sector << 9) + lo->lo_offset;
                 bio_for_each_segment(bvec, bio, i) {
                         BUG_ON(bvec->bv_offset != 0);
-                        BUG_ON(bvec->bv_len != CFS_PAGE_SIZE);
+                       BUG_ON(bvec->bv_len != PAGE_CACHE_SIZE);
 
                         pages[page_count] = bvec->bv_page;
                         offsets[page_count] = offset;
@@ -420,8 +420,6 @@ static int loop_thread(void *data)
         int refcheck;
         int ret = 0;
 
-        daemonize("lloop%d", lo->lo_number);
-
         set_user_nice(current, -20);
 
         lo->lo_state = LLOOP_BOUND;
@@ -520,7 +518,7 @@ static int loop_set_fd(struct lloop_device *lo, struct file *unused,
 
         set_device_ro(bdev, (lo_flags & LO_FLAGS_READ_ONLY) != 0);
 
-        lo->lo_blocksize = CFS_PAGE_SIZE;
+       lo->lo_blocksize = PAGE_CACHE_SIZE;
         lo->lo_device = bdev;
         lo->lo_flags = lo_flags;
         lo->lo_backing_file = file;
@@ -541,24 +539,24 @@ static int loop_set_fd(struct lloop_device *lo, struct file *unused,
         lo->lo_queue->unplug_fn = loop_unplug;
 #endif
 
-        /* queue parameters */
-        CLASSERT(CFS_PAGE_SIZE < (1 << (sizeof(unsigned short) * 8)));
-        blk_queue_logical_block_size(lo->lo_queue,
-                                     (unsigned short)CFS_PAGE_SIZE);
-        blk_queue_max_hw_sectors(lo->lo_queue,
-                                 LLOOP_MAX_SEGMENTS << (CFS_PAGE_SHIFT - 9));
-        blk_queue_max_segments(lo->lo_queue, LLOOP_MAX_SEGMENTS);
+       /* queue parameters */
+       CLASSERT(PAGE_CACHE_SIZE < (1 << (sizeof(unsigned short) * 8)));
+       blk_queue_logical_block_size(lo->lo_queue,
+                                    (unsigned short)PAGE_CACHE_SIZE);
+       blk_queue_max_hw_sectors(lo->lo_queue,
+                                LLOOP_MAX_SEGMENTS << (PAGE_CACHE_SHIFT - 9));
+       blk_queue_max_segments(lo->lo_queue, LLOOP_MAX_SEGMENTS);
 
         set_capacity(disks[lo->lo_number], size);
         bd_set_size(bdev, size << 9);
 
-        set_blocksize(bdev, lo->lo_blocksize);
+       set_blocksize(bdev, lo->lo_blocksize);
 
-        cfs_create_thread(loop_thread, lo, CLONE_KERNEL);
+       kthread_run(loop_thread, lo, "lloop%d", lo->lo_number);
        down(&lo->lo_sem);
-        return 0;
+       return 0;
 
- out:
+out:
         /* This is safe: open() is still holding a reference. */
         cfs_module_put(THIS_MODULE);
         return error;