aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/lustre/lustre/llite/lloop.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/lustre/lustre/llite/lloop.c')
-rw-r--r--drivers/staging/lustre/lustre/llite/lloop.c58
1 files changed, 37 insertions, 21 deletions
diff --git a/drivers/staging/lustre/lustre/llite/lloop.c b/drivers/staging/lustre/lustre/llite/lloop.c
index 808663898b73..264e5ec3fed6 100644
--- a/drivers/staging/lustre/lustre/llite/lloop.c
+++ b/drivers/staging/lustre/lustre/llite/lloop.c
@@ -126,7 +126,7 @@ struct lloop_device {
struct block_device *lo_device;
unsigned lo_blocksize;
- int old_gfp_mask;
+ gfp_t old_gfp_mask;
spinlock_t lo_lock;
struct bio *lo_bio;
@@ -192,7 +192,7 @@ static int do_bio_lustrebacked(struct lloop_device *lo, struct bio *head)
pgoff_t offset;
int ret;
int rw;
- obd_count page_count = 0;
+ u32 page_count = 0;
struct bio_vec bvec;
struct bvec_iter iter;
struct bio *bio;
@@ -409,8 +409,10 @@ static int loop_thread(void *data)
lo->lo_state = LLOOP_BOUND;
env = cl_env_get(&refcheck);
- if (IS_ERR(env))
- GOTO(out, ret = PTR_ERR(env));
+ if (IS_ERR(env)) {
+ ret = PTR_ERR(env);
+ goto out;
+ }
lo->lo_env = env;
memset(&lo->lo_pvec, 0, sizeof(lo->lo_pvec));
@@ -546,7 +548,7 @@ static int loop_clr_fd(struct lloop_device *lo, struct block_device *bdev,
int count)
{
struct file *filp = lo->lo_backing_file;
- int gfp = lo->old_gfp_mask;
+ gfp_t gfp = lo->old_gfp_mask;
if (lo->lo_state != LLOOP_BOUND)
return -ENXIO;
@@ -670,8 +672,10 @@ static enum llioc_iter lloop_ioctl(struct inode *unused, struct file *file,
if (magic != ll_iocontrol_magic)
return LLIOC_CONT;
- if (disks == NULL)
- GOTO(out1, err = -ENODEV);
+ if (disks == NULL) {
+ err = -ENODEV;
+ goto out1;
+ }
CWARN("Enter llop_ioctl\n");
@@ -692,19 +696,25 @@ static enum llioc_iter lloop_ioctl(struct inode *unused, struct file *file,
file->f_dentry->d_inode)
break;
}
- if (lo || !lo_free)
- GOTO(out, err = -EBUSY);
+ if (lo || !lo_free) {
+ err = -EBUSY;
+ goto out;
+ }
lo = lo_free;
dev = MKDEV(lloop_major, lo->lo_number);
/* quit if the used pointer is writable */
- if (put_user((long)old_encode_dev(dev), (long*)arg))
- GOTO(out, err = -EFAULT);
+ if (put_user((long)old_encode_dev(dev), (long *)arg)) {
+ err = -EFAULT;
+ goto out;
+ }
bdev = blkdev_get_by_dev(dev, file->f_mode, NULL);
- if (IS_ERR(bdev))
- GOTO(out, err = PTR_ERR(bdev));
+ if (IS_ERR(bdev)) {
+ err = PTR_ERR(bdev);
+ goto out;
+ }
get_file(file);
err = loop_set_fd(lo, NULL, bdev, file);
@@ -720,16 +730,22 @@ static enum llioc_iter lloop_ioctl(struct inode *unused, struct file *file,
int minor;
dev = old_decode_dev(arg);
- if (MAJOR(dev) != lloop_major)
- GOTO(out, err = -EINVAL);
+ if (MAJOR(dev) != lloop_major) {
+ err = -EINVAL;
+ goto out;
+ }
minor = MINOR(dev);
- if (minor > max_loop - 1)
- GOTO(out, err = -EINVAL);
+ if (minor > max_loop - 1) {
+ err = -EINVAL;
+ goto out;
+ }
lo = &loop_dev[minor];
- if (lo->lo_state != LLOOP_BOUND)
- GOTO(out, err = -EINVAL);
+ if (lo->lo_state != LLOOP_BOUND) {
+ err = -EINVAL;
+ goto out;
+ }
bdev = lo->lo_device;
err = loop_clr_fd(lo, bdev, 1);
@@ -777,11 +793,11 @@ static int __init lloop_init(void)
if (ll_iocontrol_magic == NULL)
goto out_mem1;
- OBD_ALLOC_WAIT(loop_dev, max_loop * sizeof(*loop_dev));
+ loop_dev = kzalloc(max_loop * sizeof(*loop_dev), GFP_KERNEL);
if (!loop_dev)
goto out_mem1;
- OBD_ALLOC_WAIT(disks, max_loop * sizeof(*disks));
+ disks = kzalloc(max_loop * sizeof(*disks), GFP_KERNEL);
if (!disks)
goto out_mem2;