patch-2.4.21 linux-2.4.21/drivers/block/loop.c
Next file: linux-2.4.21/drivers/block/nbd.c
Previous file: linux-2.4.21/drivers/block/ll_rw_blk.c
Back to the patch index
Back to the overall index
- Lines: 114
- Date:
2003-06-13 07:51:32.000000000 -0700
- Orig file:
linux-2.4.20/drivers/block/loop.c
- Orig date:
2002-11-28 15:53:12.000000000 -0800
diff -urN linux-2.4.20/drivers/block/loop.c linux-2.4.21/drivers/block/loop.c
@@ -199,9 +199,9 @@
page = grab_cache_page(mapping, index);
if (!page)
goto fail;
+ kaddr = kmap(page);
if (aops->prepare_write(file, page, offset, offset+size))
goto unlock;
- kaddr = page_address(page);
flush_dcache_page(page);
transfer_result = lo_do_transfer(lo, WRITE, kaddr + offset, data, size, IV);
if (transfer_result) {
@@ -216,6 +216,7 @@
goto unlock;
if (transfer_result)
goto unlock;
+ kunmap(page);
data += size;
len -= size;
offset = 0;
@@ -228,6 +229,7 @@
return 0;
unlock:
+ kunmap(page);
UnlockPage(page);
page_cache_release(page);
fail:
@@ -418,6 +420,7 @@
break;
run_task_queue(&tq_disk);
+ set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(HZ);
} while (1);
memset(bh, 0, sizeof(*bh));
@@ -437,6 +440,7 @@
break;
run_task_queue(&tq_disk);
+ set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(HZ);
} while (1);
@@ -563,6 +567,7 @@
daemonize();
exit_files(current);
+ reparent_to_init();
sprintf(current->comm, "loop%d", lo->lo_number);
@@ -571,9 +576,6 @@
flush_signals(current);
spin_unlock_irq(¤t->sigmask_lock);
- current->policy = SCHED_OTHER;
- current->nice = -20;
-
spin_lock_irq(&lo->lo_lock);
lo->lo_state = Lo_bound;
atomic_inc(&lo->lo_pending);
@@ -645,7 +647,7 @@
lo_device = inode->i_rdev;
if (lo_device == dev) {
error = -EBUSY;
- goto out;
+ goto out_putf;
}
} else if (S_ISREG(inode->i_mode)) {
struct address_space_operations *aops = inode->i_mapping->a_ops;
@@ -1014,11 +1016,6 @@
return -EIO;
}
- devfs_handle = devfs_mk_dir(NULL, "loop", NULL);
- devfs_register_series(devfs_handle, "%u", max_loop, DEVFS_FL_DEFAULT,
- MAJOR_NR, 0,
- S_IFBLK | S_IRUSR | S_IWUSR | S_IRGRP,
- &lo_fops, NULL);
loop_dev = kmalloc(max_loop * sizeof(struct loop_device), GFP_KERNEL);
if (!loop_dev)
@@ -1051,13 +1048,21 @@
for (i = 0; i < max_loop; i++)
register_disk(NULL, MKDEV(MAJOR_NR, i), 1, &lo_fops, 0);
+ devfs_handle = devfs_mk_dir(NULL, "loop", NULL);
+ devfs_register_series(devfs_handle, "%u", max_loop, DEVFS_FL_DEFAULT,
+ MAJOR_NR, 0,
+ S_IFBLK | S_IRUSR | S_IWUSR | S_IRGRP,
+ &lo_fops, NULL);
+
printk(KERN_INFO "loop: loaded (max %d devices)\n", max_loop);
return 0;
-out_sizes:
- kfree(loop_dev);
out_blksizes:
kfree(loop_sizes);
+out_sizes:
+ kfree(loop_dev);
+ if (devfs_unregister_blkdev(MAJOR_NR, "loop"))
+ printk(KERN_WARNING "loop: cannot unregister blkdev\n");
printk(KERN_ERR "loop: ran out of memory\n");
return -ENOMEM;
}
@@ -1067,7 +1072,6 @@
devfs_unregister(devfs_handle);
if (devfs_unregister_blkdev(MAJOR_NR, "loop"))
printk(KERN_WARNING "loop: cannot unregister blkdev\n");
-
kfree(loop_dev);
kfree(loop_sizes);
kfree(loop_blksizes);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)