* [PATCH 0 of 7] blktap/pvops updates
@ 2010-06-03 3:12 Daniel Stodden
2010-06-03 3:12 ` [PATCH 1 of 7] blktap: Synchronous queue dispatch Daniel Stodden
` (6 more replies)
0 siblings, 7 replies; 9+ messages in thread
From: Daniel Stodden @ 2010-06-03 3:12 UTC (permalink / raw)
To: Xen; +Cc: Jeremy Fitzhardinge
Hi.
A bunch of updates to the backend/blktap2 branch.
The main difference is that all queue runs are synchronous on behalf
of tapdisk system entries now. As a consequence we can drop a couple
locks, which is good, and the .unmap vma hook, which is better.
This removes pause/unpause from the kernel interface. I don't
anticipate it's going to be missed, because that code must have been
deadlocking on sysfs node removal for quite a while. Next toolstack
update will redo pause/unpause in userspace.
On the misc side, there is some cleanup and removal of bdev
passthrough mode. The idea was nice but it never got excercised a lot.
Cheers,
Daniel
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1 of 7] blktap: Synchronous queue dispatch
2010-06-03 3:12 [PATCH 0 of 7] blktap/pvops updates Daniel Stodden
@ 2010-06-03 3:12 ` Daniel Stodden
2010-06-03 3:12 ` [PATCH 2 of 7] linux: Remove unmap hook from vm_operations struct Daniel Stodden
` (5 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Daniel Stodden @ 2010-06-03 3:12 UTC (permalink / raw)
To: Xen; +Cc: Jeremy Fitzhardinge
[-- Attachment #1: blktap-ring-sync.diff --]
[-- Type: text/x-patch, Size: 11979 bytes --]
blktap: Synchronous queue dispatch.
Move all queue runs into tapdisk context. Queue dispatch moved into
ring.poll. That's not nice, but keeps the toolstack fully
compatible. Won't make much of a difference because the original poll
code wasn't level-triggered either.
Obsoletes/removes:
* run deferrals and wait_queue.o.
* blktap.tap_sem.
* vma.unmap.
Signed-off-by: Jake Wires <jake.wires@citrix.com>
Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
diff -r 16fc7d4e03d6 -r 989a51acce0a drivers/xen/blktap/Makefile
--- a/drivers/xen/blktap/Makefile Wed Jun 02 19:45:24 2010 -0700
+++ b/drivers/xen/blktap/Makefile Wed Jun 02 19:45:24 2010 -0700
@@ -1,3 +1,3 @@
obj-$(CONFIG_XEN_BLKDEV_TAP) := blktap.o
-blktap-objs := control.o ring.o wait_queue.o device.o request.o sysfs.o
+blktap-objs := control.o ring.o device.o request.o sysfs.o
diff -r 16fc7d4e03d6 -r 989a51acce0a drivers/xen/blktap/blktap.h
--- a/drivers/xen/blktap/blktap.h Wed Jun 02 19:45:24 2010 -0700
+++ b/drivers/xen/blktap/blktap.h Wed Jun 02 19:45:24 2010 -0700
@@ -35,7 +35,6 @@
#define BLKTAP_PAUSED 7
#define BLKTAP_SHUTDOWN_REQUESTED 8
#define BLKTAP_PASSTHROUGH 9
-#define BLKTAP_DEFERRED 10
/* blktap IOCTLs: */
#define BLKTAP2_IOCTL_KICK_FE 1
@@ -168,8 +167,6 @@
struct blktap_params params;
- struct rw_semaphore tap_sem;
-
struct blktap_ring ring;
struct blktap_device device;
@@ -178,7 +175,6 @@
struct scatterlist sg[BLKIF_MAX_SEGMENTS_PER_REQUEST];
wait_queue_head_t wq;
- struct list_head deferred_queue;
struct blktap_statistics stats;
};
@@ -222,6 +218,7 @@
int blktap_device_destroy(struct blktap *);
int blktap_device_pause(struct blktap *);
int blktap_device_resume(struct blktap *);
+int blktap_device_run_queue(struct blktap *);
void blktap_device_restart(struct blktap *);
void blktap_device_finish_request(struct blktap *,
struct blkif_response *,
@@ -232,9 +229,6 @@
unsigned, unsigned);
#endif
-void blktap_defer(struct blktap *);
-void blktap_run_deferred(void);
-
int blktap_request_pool_init(void);
void blktap_request_pool_free(void);
int blktap_request_pool_grow(void);
diff -r 16fc7d4e03d6 -r 989a51acce0a drivers/xen/blktap/control.c
--- a/drivers/xen/blktap/control.c Wed Jun 02 19:45:24 2010 -0700
+++ b/drivers/xen/blktap/control.c Wed Jun 02 19:45:24 2010 -0700
@@ -20,7 +20,6 @@
memset(tap, 0, sizeof(*tap));
set_bit(BLKTAP_CONTROL, &tap->dev_inuse);
- init_rwsem(&tap->tap_sem);
init_waitqueue_head(&tap->wq);
atomic_set(&tap->refcnt, 0);
sg_init_table(tap->sg, BLKIF_MAX_SEGMENTS_PER_REQUEST);
diff -r 16fc7d4e03d6 -r 989a51acce0a drivers/xen/blktap/device.c
--- a/drivers/xen/blktap/device.c Wed Jun 02 19:45:24 2010 -0700
+++ b/drivers/xen/blktap/device.c Wed Jun 02 19:45:24 2010 -0700
@@ -212,9 +212,6 @@
BUG_ON(ret);
}
-/*
- * tap->tap_sem held on entry
- */
static void
blktap_device_fast_flush(struct blktap *tap, struct blktap_request *request)
{
@@ -302,9 +299,6 @@
request->nr_pages << PAGE_SHIFT, NULL);
}
-/*
- * tap->tap_sem held on entry
- */
static void
blktap_unmap(struct blktap *tap, struct blktap_request *request)
{
@@ -349,8 +343,6 @@
if (!test_bit(BLKTAP_DEVICE, &tap->dev_inuse))
return;
- down_write(&tap->tap_sem);
-
dev = &tap->device;
for (usr_idx = 0; usr_idx < MAX_PENDING_REQS; usr_idx++) {
request = tap->pending_requests[usr_idx];
@@ -368,8 +360,6 @@
blktap_request_free(tap, request);
}
- up_write(&tap->tap_sem);
-
spin_lock_irq(&dev->lock);
/* fail any future requests */
@@ -379,9 +369,6 @@
spin_unlock_irq(&dev->lock);
}
-/*
- * tap->tap_sem held on entry
- */
void
blktap_device_finish_request(struct blktap *tap,
struct blkif_response *res,
@@ -590,9 +577,6 @@
err = -1;
memset(&table, 0, sizeof(table));
- if (!blktap_active(tap))
- goto out;
-
ring = &tap->ring;
usr_idx = request->usr_idx;
blkif_req.id = usr_idx;
@@ -774,24 +758,24 @@
#endif
/*
- * dev->lock held on entry
+ * called from tapdisk context
*/
-static void
+int
blktap_device_run_queue(struct blktap *tap)
{
- int queued, err;
+ int err, rv;
struct request_queue *rq;
struct request *req;
struct blktap_ring *ring;
struct blktap_device *dev;
struct blktap_request *request;
- queued = 0;
ring = &tap->ring;
dev = &tap->device;
rq = dev->gd->queue;
BTDBG("running queue for %d\n", tap->minor);
+ spin_lock_irq(&dev->lock);
while ((req = blk_peek_request(rq)) != NULL) {
if (!blk_fs_request(req)) {
@@ -816,7 +800,6 @@
wait:
/* Avoid pointless unplugs. */
blk_stop_queue(rq);
- blktap_defer(tap);
break;
}
@@ -836,27 +819,26 @@
blk_start_request(req);
spin_unlock_irq(&dev->lock);
- down_read(&tap->tap_sem);
err = blktap_device_process_request(tap, request, req);
- if (!err)
- queued++;
- else {
+ if (err) {
blktap_device_end_dequeued_request(dev, req, -EIO);
blktap_request_free(tap, request);
}
- up_read(&tap->tap_sem);
spin_lock_irq(&dev->lock);
}
- if (queued)
- blktap_ring_kick_user(tap);
+ spin_unlock_irq(&dev->lock);
+
+ rv = ring->ring.req_prod_pvt -
+ ring->ring.sring->req_prod;
+
+ RING_PUSH_REQUESTS(&ring->ring);
+
+ return rv;
}
-/*
- * dev->lock held on entry
- */
static void
blktap_device_do_request(struct request_queue *rq)
{
@@ -872,13 +854,7 @@
if (!blktap_active(tap))
goto fail;
- if (test_bit(BLKTAP_PAUSED, &tap->dev_inuse) ||
- test_bit(BLKTAP_PAUSE_REQUESTED, &tap->dev_inuse)) {
- blktap_defer(tap);
- return;
- }
-
- blktap_device_run_queue(tap);
+ blktap_ring_kick_user(tap);
return;
fail:
@@ -896,18 +872,6 @@
struct blktap_device *dev;
dev = &tap->device;
-
- if (blktap_active(tap) && RING_FULL(&tap->ring.ring)) {
- blktap_defer(tap);
- return;
- }
-
- if (test_bit(BLKTAP_PAUSED, &tap->dev_inuse) ||
- test_bit(BLKTAP_PAUSE_REQUESTED, &tap->dev_inuse)) {
- blktap_defer(tap);
- return;
- }
-
spin_lock_irq(&dev->lock);
/* Re-enable calldowns. */
diff -r 16fc7d4e03d6 -r 989a51acce0a drivers/xen/blktap/ring.c
--- a/drivers/xen/blktap/ring.c Wed Jun 02 19:45:24 2010 -0700
+++ b/drivers/xen/blktap/ring.c Wed Jun 02 19:45:24 2010 -0700
@@ -30,7 +30,7 @@
*/
#define RING_PAGES 1
-static int
+static void
blktap_read_ring(struct blktap *tap)
{
/* This is called to read responses from the ring. */
@@ -40,13 +40,9 @@
struct blktap_ring *ring;
struct blktap_request *request;
- down_read(&tap->tap_sem);
-
ring = &tap->ring;
- if (!ring->vma) {
- up_read(&tap->tap_sem);
- return 0;
- }
+ if (!ring->vma)
+ return;
/* for each outstanding message on the ring */
rp = ring->ring.sring->rsp_prod;
@@ -54,7 +50,6 @@
for (rc = ring->ring.rsp_cons; rc != rp; rc++) {
memcpy(&res, RING_GET_RESPONSE(&ring->ring, rc), sizeof(res));
- mb(); /* rsp_cons read by RING_FULL() in do_block_io_op(). */
++ring->ring.rsp_cons;
usr_idx = (int)res.id;
@@ -70,11 +65,9 @@
blktap_device_finish_request(tap, &res, request);
}
- up_read(&tap->tap_sem);
- blktap_run_deferred();
-
- return 0;
+ blktap_device_restart(tap);
+ return;
}
static int blktap_ring_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
@@ -163,29 +156,14 @@
}
static void
-blktap_ring_vm_unmap(struct vm_area_struct *vma)
-{
- struct blktap *tap = vma_to_blktap(vma);
-
- down_write(&tap->tap_sem);
- clear_bit(BLKTAP_RING_VMA, &tap->dev_inuse);
- clear_bit(BLKTAP_PAUSED, &tap->dev_inuse);
- clear_bit(BLKTAP_PAUSE_REQUESTED, &tap->dev_inuse);
- up_write(&tap->tap_sem);
-}
-
-static void
blktap_ring_vm_close(struct vm_area_struct *vma)
{
struct blktap *tap = vma_to_blktap(vma);
struct blktap_ring *ring = &tap->ring;
- blktap_ring_vm_unmap(vma); /* fail future requests */
blktap_device_fail_pending_requests(tap); /* fail pending requests */
blktap_device_restart(tap); /* fail deferred requests */
- down_write(&tap->tap_sem);
-
zap_page_range(vma, vma->vm_start, vma->vm_end - vma->vm_start, NULL);
kfree(ring->foreign_map.map);
@@ -198,16 +176,17 @@
BTINFO("unmapping ring %d\n", tap->minor);
ring->ring.sring = NULL;
ring->vma = NULL;
+ clear_bit(BLKTAP_RING_VMA, &tap->dev_inuse);
- up_write(&tap->tap_sem);
+ clear_bit(BLKTAP_PAUSED, &tap->dev_inuse);
+ clear_bit(BLKTAP_PAUSE_REQUESTED, &tap->dev_inuse);
wake_up(&tap->wq);
}
static struct vm_operations_struct blktap_ring_vm_operations = {
.close = blktap_ring_vm_close,
- .unmap = blktap_ring_vm_unmap,
- .fault = blktap_ring_fault,
+ .fault = blktap_ring_fault,
.zap_pte = blktap_ring_clear_pte,
};
@@ -363,10 +342,8 @@
{
struct blktap_ring *ring = &tap->ring;
- down_read(&tap->tap_sem);
if (ring->ring.sring)
ring->ring.sring->pad[0] = msg;
- up_read(&tap->tap_sem);
}
static int
@@ -381,12 +358,16 @@
switch(cmd) {
case BLKTAP2_IOCTL_KICK_FE:
/* There are fe messages to process. */
- return blktap_read_ring(tap);
+ blktap_read_ring(tap);
+ return 0;
case BLKTAP2_IOCTL_CREATE_DEVICE:
if (!arg)
return -EINVAL;
+ if (!blktap_active(tap))
+ return -ENODEV;
+
if (copy_from_user(¶ms, (struct blktap_params __user *)arg,
sizeof(params))) {
BTERR("failed to get params\n");
@@ -473,13 +454,26 @@
{
struct blktap *tap = filp->private_data;
struct blktap_ring *ring = &tap->ring;
+ int work = 0;
+
+ down_read(¤t->mm->mmap_sem);
+
+ if (!blktap_active(tap)) {
+ up_read(¤t->mm->mmap_sem);
+ force_sig(SIGSEGV, current);
+ return 0;
+ }
poll_wait(filp, &ring->poll_wait, wait);
- if (ring->ring.sring->pad[0] != 0 ||
- ring->ring.req_prod_pvt != ring->ring.sring->req_prod) {
- RING_PUSH_REQUESTS(&ring->ring);
+
+ if (test_bit(BLKTAP_DEVICE, &tap->dev_inuse))
+ work = blktap_device_run_queue(tap);
+
+ up_read(¤t->mm->mmap_sem);
+
+ if (work ||
+ ring->ring.sring->pad[0])
return POLLIN | POLLRDNORM;
- }
return 0;
}
diff -r 16fc7d4e03d6 -r 989a51acce0a drivers/xen/blktap/sysfs.c
--- a/drivers/xen/blktap/sysfs.c Wed Jun 02 19:45:24 2010 -0700
+++ b/drivers/xen/blktap/sysfs.c Wed Jun 02 19:45:24 2010 -0700
@@ -265,8 +265,6 @@
"device users: %d\n", tap->params.capacity,
tap->params.sector_size, tap->device.users);
- down_read(&tap->tap_sem);
-
tmp += sprintf(tmp, "pending requests: %d\n", tap->pending_cnt);
for (i = 0; i < MAX_PENDING_REQS; i++) {
struct blktap_request *req = tap->pending_requests[i];
@@ -282,7 +280,6 @@
req->time.tv_usec);
}
- up_read(&tap->tap_sem);
ret = (tmp - buf) + 1;
out:
diff -r 16fc7d4e03d6 -r 989a51acce0a drivers/xen/blktap/wait_queue.c
--- a/drivers/xen/blktap/wait_queue.c Wed Jun 02 19:45:24 2010 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-#include <linux/list.h>
-#include <linux/spinlock.h>
-
-#include "blktap.h"
-
-static LIST_HEAD(deferred_work_queue);
-static DEFINE_SPINLOCK(deferred_work_lock);
-
-void
-blktap_run_deferred(void)
-{
- LIST_HEAD(queue);
- struct blktap *tap;
- unsigned long flags;
-
- spin_lock_irqsave(&deferred_work_lock, flags);
- list_splice_init(&deferred_work_queue, &queue);
- list_for_each_entry(tap, &queue, deferred_queue)
- clear_bit(BLKTAP_DEFERRED, &tap->dev_inuse);
- spin_unlock_irqrestore(&deferred_work_lock, flags);
-
- while (!list_empty(&queue)) {
- tap = list_entry(queue.next, struct blktap, deferred_queue);
- list_del_init(&tap->deferred_queue);
- blktap_device_restart(tap);
- }
-}
-
-void
-blktap_defer(struct blktap *tap)
-{
- unsigned long flags;
-
- spin_lock_irqsave(&deferred_work_lock, flags);
- if (!test_bit(BLKTAP_DEFERRED, &tap->dev_inuse)) {
- set_bit(BLKTAP_DEFERRED, &tap->dev_inuse);
- list_add_tail(&tap->deferred_queue, &deferred_work_queue);
- }
- spin_unlock_irqrestore(&deferred_work_lock, flags);
-}
[-- Attachment #2: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2 of 7] linux: Remove unmap hook from vm_operations struct
2010-06-03 3:12 [PATCH 0 of 7] blktap/pvops updates Daniel Stodden
2010-06-03 3:12 ` [PATCH 1 of 7] blktap: Synchronous queue dispatch Daniel Stodden
@ 2010-06-03 3:12 ` Daniel Stodden
2010-06-03 3:12 ` [PATCH 3 of 7] blktap: Remove broken sysfs pause/resume API Daniel Stodden
` (4 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Daniel Stodden @ 2010-06-03 3:12 UTC (permalink / raw)
To: Xen; +Cc: Jeremy Fitzhardinge
[-- Attachment #1: blktap-kern-vma-unmap.diff --]
[-- Type: text/x-patch, Size: 1787 bytes --]
linux: Remove unmap hook from vm_operations struct.
Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
diff -r 989a51acce0a -r 68eb38b6b16b include/linux/mm.h
--- a/include/linux/mm.h Wed Jun 02 19:45:24 2010 -0700
+++ b/include/linux/mm.h Wed Jun 02 19:45:25 2010 -0700
@@ -206,10 +206,6 @@
* original value of @ptep. */
pte_t (*zap_pte)(struct vm_area_struct *vma,
unsigned long addr, pte_t *ptep, int is_fullmm);
-
- /* called before close() to indicate no more pages should be mapped */
- void (*unmap)(struct vm_area_struct *area);
-
#ifdef CONFIG_NUMA
/*
* set_policy() op must add a reference to any non-NULL @new mempolicy
diff -r 989a51acce0a -r 68eb38b6b16b mm/mmap.c
--- a/mm/mmap.c Wed Jun 02 19:45:24 2010 -0700
+++ b/mm/mmap.c Wed Jun 02 19:45:25 2010 -0700
@@ -1799,12 +1799,6 @@
tlb_finish_mmu(tlb, start, end);
}
-static inline void unmap_vma(struct vm_area_struct *vma)
-{
- if (unlikely(vma->vm_ops && vma->vm_ops->unmap))
- vma->vm_ops->unmap(vma);
-}
-
/*
* Create a list of vma's touched by the unmap, removing them from the mm's
* vma list as we go..
@@ -1820,7 +1814,6 @@
insertion_point = (prev ? &prev->vm_next : &mm->mmap);
do {
rb_erase(&vma->vm_rb, &mm->mm_rb);
- unmap_vma(vma);
mm->map_count--;
tail_vma = vma;
vma = vma->vm_next;
@@ -2103,7 +2096,7 @@
void exit_mmap(struct mm_struct *mm)
{
struct mmu_gather *tlb;
- struct vm_area_struct *vma, *vma_tmp;
+ struct vm_area_struct *vma;
unsigned long nr_accounted = 0;
unsigned long end;
@@ -2125,9 +2118,6 @@
if (!vma) /* Can happen if dup_mmap() received an OOM */
return;
- for (vma_tmp = mm->mmap; vma_tmp; vma_tmp = vma_tmp->vm_next)
- unmap_vma(vma_tmp);
-
lru_add_drain();
flush_cache_mm(mm);
tlb = tlb_gather_mmu(mm, 1);
[-- Attachment #2: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 3 of 7] blktap: Remove broken sysfs pause/resume API
2010-06-03 3:12 [PATCH 0 of 7] blktap/pvops updates Daniel Stodden
2010-06-03 3:12 ` [PATCH 1 of 7] blktap: Synchronous queue dispatch Daniel Stodden
2010-06-03 3:12 ` [PATCH 2 of 7] linux: Remove unmap hook from vm_operations struct Daniel Stodden
@ 2010-06-03 3:12 ` Daniel Stodden
2010-06-03 3:12 ` [PATCH 4 of 7] blktap: Make the device destruction path synchronous Daniel Stodden
` (3 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Daniel Stodden @ 2010-06-03 3:12 UTC (permalink / raw)
To: Xen; +Cc: Jeremy Fitzhardinge
[-- Attachment #1: blktap-rm-sysfs-pause.diff --]
[-- Type: text/x-patch, Size: 10902 bytes --]
blktap: Remove broken sysfs pause/resume API.
Safe to remove. This never worked on kernels > 2.6.18 anyway, because
the original pause/resume attribute flipping would deadlock. Newer
toolstacks should use tap-ctl calls instead.
Signed-off-by: Jake Wires <jake.wires@citrix.com>
Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
diff -r 68eb38b6b16b -r 69301010e4cf drivers/xen/blktap/blktap.h
--- a/drivers/xen/blktap/blktap.h Wed Jun 02 19:45:25 2010 -0700
+++ b/drivers/xen/blktap/blktap.h Wed Jun 02 19:45:25 2010 -0700
@@ -31,8 +31,6 @@
#define BLKTAP_RING_FD 2
#define BLKTAP_RING_VMA 3
#define BLKTAP_DEVICE 4
-#define BLKTAP_PAUSE_REQUESTED 6
-#define BLKTAP_PAUSED 7
#define BLKTAP_SHUTDOWN_REQUESTED 8
#define BLKTAP_PASSTHROUGH 9
@@ -41,15 +39,9 @@
#define BLKTAP2_IOCTL_ALLOC_TAP 200
#define BLKTAP2_IOCTL_FREE_TAP 201
#define BLKTAP2_IOCTL_CREATE_DEVICE 202
-#define BLKTAP2_IOCTL_SET_PARAMS 203
-#define BLKTAP2_IOCTL_PAUSE 204
-#define BLKTAP2_IOCTL_REOPEN 205
-#define BLKTAP2_IOCTL_RESUME 206
#define BLKTAP2_MAX_MESSAGE_LEN 256
-#define BLKTAP2_RING_MESSAGE_PAUSE 1
-#define BLKTAP2_RING_MESSAGE_RESUME 2
#define BLKTAP2_RING_MESSAGE_CLOSE 3
#define BLKTAP_REQUEST_FREE 0
@@ -120,8 +112,6 @@
unsigned long ring_vstart;
unsigned long user_vstart;
- int response;
-
wait_queue_head_t poll_wait;
dev_t devno;
@@ -203,8 +193,6 @@
int blktap_ring_free(void);
int blktap_ring_create(struct blktap *);
int blktap_ring_destroy(struct blktap *);
-int blktap_ring_pause(struct blktap *);
-int blktap_ring_resume(struct blktap *);
void blktap_ring_kick_user(struct blktap *);
int blktap_sysfs_init(void);
@@ -216,8 +204,6 @@
void blktap_device_free(void);
int blktap_device_create(struct blktap *);
int blktap_device_destroy(struct blktap *);
-int blktap_device_pause(struct blktap *);
-int blktap_device_resume(struct blktap *);
int blktap_device_run_queue(struct blktap *);
void blktap_device_restart(struct blktap *);
void blktap_device_finish_request(struct blktap *,
diff -r 68eb38b6b16b -r 69301010e4cf drivers/xen/blktap/device.c
--- a/drivers/xen/blktap/device.c Wed Jun 02 19:45:25 2010 -0700
+++ b/drivers/xen/blktap/device.c Wed Jun 02 19:45:25 2010 -0700
@@ -923,52 +923,6 @@
}
int
-blktap_device_resume(struct blktap *tap)
-{
- int err;
-
- if (!test_bit(BLKTAP_DEVICE, &tap->dev_inuse) || !blktap_active(tap))
- return -ENODEV;
-
- if (!test_bit(BLKTAP_PAUSED, &tap->dev_inuse))
- return 0;
-
- err = blktap_ring_resume(tap);
- if (err)
- return err;
-
- /* device size may have changed */
- blktap_device_configure(tap);
-
- BTDBG("restarting device\n");
- blktap_device_restart(tap);
-
- return 0;
-}
-
-int
-blktap_device_pause(struct blktap *tap)
-{
- unsigned long flags;
- struct blktap_device *dev = &tap->device;
-
- if (!test_bit(BLKTAP_DEVICE, &tap->dev_inuse) || !blktap_active(tap))
- return -ENODEV;
-
- if (test_bit(BLKTAP_PAUSED, &tap->dev_inuse))
- return 0;
-
- spin_lock_irqsave(&dev->lock, flags);
-
- blk_stop_queue(dev->gd->queue);
- set_bit(BLKTAP_PAUSE_REQUESTED, &tap->dev_inuse);
-
- spin_unlock_irqrestore(&dev->lock, flags);
-
- return blktap_ring_pause(tap);
-}
-
-int
blktap_device_destroy(struct blktap *tap)
{
struct blktap_device *dev = &tap->device;
diff -r 68eb38b6b16b -r 69301010e4cf drivers/xen/blktap/request.c
--- a/drivers/xen/blktap/request.c Wed Jun 02 19:45:25 2010 -0700
+++ b/drivers/xen/blktap/request.c Wed Jun 02 19:45:25 2010 -0700
@@ -238,12 +238,10 @@
list_add(&request->free_list, &pool.free_list);
atomic_dec(&handle->bucket->reqs_in_use);
free = atomic_dec_and_test(&pool.reqs_in_use);
+ tap->pending_cnt--;
spin_unlock_irqrestore(&pool.lock, flags);
- if (--tap->pending_cnt == 0)
- wake_up_interruptible(&tap->wq);
-
if (free)
wake_up(&pool.wait_queue);
}
diff -r 68eb38b6b16b -r 69301010e4cf drivers/xen/blktap/ring.c
--- a/drivers/xen/blktap/ring.c Wed Jun 02 19:45:25 2010 -0700
+++ b/drivers/xen/blktap/ring.c Wed Jun 02 19:45:25 2010 -0700
@@ -178,9 +178,6 @@
ring->vma = NULL;
clear_bit(BLKTAP_RING_VMA, &tap->dev_inuse);
- clear_bit(BLKTAP_PAUSED, &tap->dev_inuse);
- clear_bit(BLKTAP_PAUSE_REQUESTED, &tap->dev_inuse);
-
wake_up(&tap->wq);
}
@@ -381,70 +378,6 @@
tap->params = params;
return blktap_device_create(tap);
-
- case BLKTAP2_IOCTL_SET_PARAMS:
- if (!arg)
- return -EINVAL;
-
- if (!test_bit(BLKTAP_PAUSED, &tap->dev_inuse))
- return -EINVAL;
-
- if (copy_from_user(¶ms, (struct blktap_params __user *)arg,
- sizeof(params))) {
- BTERR("failed to get params\n");
- return -EFAULT;
- }
-
- if (blktap_validate_params(tap, ¶ms)) {
- BTERR("invalid params\n");
- return -EINVAL;
- }
-
- tap->params = params;
- return 0;
-
- case BLKTAP2_IOCTL_PAUSE:
- if (!test_bit(BLKTAP_PAUSE_REQUESTED, &tap->dev_inuse))
- return -EINVAL;
-
- set_bit(BLKTAP_PAUSED, &tap->dev_inuse);
- clear_bit(BLKTAP_PAUSE_REQUESTED, &tap->dev_inuse);
-
- blktap_ring_set_message(tap, 0);
- wake_up_interruptible(&tap->wq);
-
- return 0;
-
-
- case BLKTAP2_IOCTL_REOPEN:
- if (!test_bit(BLKTAP_PAUSED, &tap->dev_inuse))
- return -EINVAL;
-
- if (!arg)
- return -EINVAL;
-
- if (copy_to_user((char __user *)arg,
- tap->params.name,
- strlen(tap->params.name) + 1))
- return -EFAULT;
-
- blktap_ring_set_message(tap, 0);
- wake_up_interruptible(&tap->wq);
-
- return 0;
-
- case BLKTAP2_IOCTL_RESUME:
- if (!test_bit(BLKTAP_PAUSED, &tap->dev_inuse))
- return -EINVAL;
-
- tap->ring.response = (int)arg;
- if (!tap->ring.response)
- clear_bit(BLKTAP_PAUSED, &tap->dev_inuse);
-
- blktap_ring_set_message(tap, 0);
- wake_up_interruptible(&tap->wq);
-
- return 0;
}
return -ENOIOCTLCMD;
@@ -494,66 +427,6 @@
}
int
-blktap_ring_resume(struct blktap *tap)
-{
- int err;
- struct blktap_ring *ring = &tap->ring;
-
- if (!blktap_active(tap))
- return -ENODEV;
-
- if (!test_bit(BLKTAP_PAUSED, &tap->dev_inuse))
- return -EINVAL;
-
- /* set shared flag for resume */
- ring->response = 0;
-
- blktap_ring_set_message(tap, BLKTAP2_RING_MESSAGE_RESUME);
- blktap_ring_kick_user(tap);
-
- wait_event_interruptible(tap->wq, ring->response ||
- !test_bit(BLKTAP_PAUSED, &tap->dev_inuse));
-
- err = ring->response;
- ring->response = 0;
-
- BTDBG("err: %d\n", err);
-
- if (err)
- return err;
-
- if (test_bit(BLKTAP_PAUSED, &tap->dev_inuse))
- return -EAGAIN;
-
- return 0;
-}
-
-int
-blktap_ring_pause(struct blktap *tap)
-{
- if (!blktap_active(tap))
- return -ENODEV;
-
- if (!test_bit(BLKTAP_PAUSE_REQUESTED, &tap->dev_inuse))
- return -EINVAL;
-
- BTDBG("draining queue\n");
- wait_event_interruptible(tap->wq, !tap->pending_cnt);
- if (tap->pending_cnt)
- return -EAGAIN;
-
- blktap_ring_set_message(tap, BLKTAP2_RING_MESSAGE_PAUSE);
- blktap_ring_kick_user(tap);
-
- BTDBG("waiting for tapdisk response\n");
- wait_event_interruptible(tap->wq, test_bit(BLKTAP_PAUSED, &tap->dev_inuse));
- if (!test_bit(BLKTAP_PAUSED, &tap->dev_inuse))
- return -EAGAIN;
-
- return 0;
-}
-
-int
blktap_ring_destroy(struct blktap *tap)
{
if (!test_bit(BLKTAP_RING_FD, &tap->dev_inuse) &&
diff -r 68eb38b6b16b -r 69301010e4cf drivers/xen/blktap/sysfs.c
--- a/drivers/xen/blktap/sysfs.c Wed Jun 02 19:45:25 2010 -0700
+++ b/drivers/xen/blktap/sysfs.c Wed Jun 02 19:45:25 2010 -0700
@@ -38,12 +38,6 @@
}
#define CLASS_DEVICE_ATTR(a,b,c,d) DEVICE_ATTR(a,b,c,d)
-
-static ssize_t blktap_sysfs_pause_device(struct device *, struct device_attribute *, const char *, size_t);
-CLASS_DEVICE_ATTR(pause, S_IWUSR, NULL, blktap_sysfs_pause_device);
-static ssize_t blktap_sysfs_resume_device(struct device *, struct device_attribute *, const char *, size_t);
-CLASS_DEVICE_ATTR(resume, S_IWUSR, NULL, blktap_sysfs_resume_device);
-
static ssize_t
blktap_sysfs_set_name(struct device *dev, struct device_attribute *attr, const char *buf, size_t size)
{
@@ -57,12 +51,6 @@
err = -ENODEV;
goto out;
}
-
- if (!test_bit(BLKTAP_PAUSED, &tap->dev_inuse)) {
- err = -EPERM;
- goto out;
- }
-
if (size > BLKTAP2_MAX_MESSAGE_LEN) {
err = -ENAMETOOLONG;
goto out;
@@ -123,81 +111,6 @@
}
CLASS_DEVICE_ATTR(remove, S_IWUSR, NULL, blktap_sysfs_remove_device);
-static ssize_t
-blktap_sysfs_pause_device(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t size)
-{
- int err;
- struct blktap *tap = (struct blktap *)dev_get_drvdata(dev);
-
- blktap_sysfs_enter(tap);
-
- BTDBG("pausing %u:%u: dev_inuse: %lu\n",
- MAJOR(tap->ring.devno), MINOR(tap->ring.devno), tap->dev_inuse);
-
- if (!tap->ring.dev ||
- test_bit(BLKTAP_SHUTDOWN_REQUESTED, &tap->dev_inuse)) {
- err = -ENODEV;
- goto out;
- }
-
- if (test_bit(BLKTAP_PAUSE_REQUESTED, &tap->dev_inuse)) {
- err = -EBUSY;
- goto out;
- }
-
- if (test_bit(BLKTAP_PAUSED, &tap->dev_inuse)) {
- err = 0;
- goto out;
- }
-
- err = blktap_device_pause(tap);
- if (!err) {
- device_remove_file(dev, &dev_attr_pause);
- err = device_create_file(dev, &dev_attr_resume);
- }
-
-out:
- blktap_sysfs_exit(tap);
-
- return (err ? err : size);
-}
-
-static ssize_t
-blktap_sysfs_resume_device(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t size)
-{
- int err;
- struct blktap *tap = (struct blktap *)dev_get_drvdata(dev);
-
- blktap_sysfs_enter(tap);
-
- if (!tap->ring.dev ||
- test_bit(BLKTAP_SHUTDOWN_REQUESTED, &tap->dev_inuse)) {
- err = -ENODEV;
- goto out;
- }
-
- if (!test_bit(BLKTAP_PAUSED, &tap->dev_inuse)) {
- err = -EINVAL;
- goto out;
- }
-
- err = blktap_device_resume(tap);
- if (!err) {
- device_remove_file(dev, &dev_attr_resume);
- err = device_create_file(dev, &dev_attr_pause);
- }
-
-out:
- blktap_sysfs_exit(tap);
-
- BTDBG("returning %zd\n", (err ? err : size));
- return (err ? err : size);
-}
-
#ifdef ENABLE_PASSTHROUGH
static ssize_t
blktap_sysfs_enable_passthrough(struct device *dev,
@@ -316,26 +229,18 @@
printk(KERN_CRIT "%s: adding attributes for dev %p\n", __func__, dev);
err = device_create_file(dev, &dev_attr_name);
if (err)
- goto out;
+ goto fail;
err = device_create_file(dev, &dev_attr_remove);
if (err)
- goto out_unregister_name;
- err = device_create_file(dev, &dev_attr_pause);
- if (err)
- goto out_unregister_remove;
+ goto fail;
err = device_create_file(dev, &dev_attr_debug);
if (err)
- goto out_unregister_pause;
+ goto fail;
return 0;
-out_unregister_pause:
- device_remove_file(dev, &dev_attr_pause);
-out_unregister_remove:
- device_remove_file(dev, &dev_attr_remove);
-out_unregister_name:
- device_remove_file(dev, &dev_attr_name);
-out:
+fail:
+ device_unregister(dev);
return err;
}
[-- Attachment #2: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 4 of 7] blktap: Make the device destruction path synchronous
2010-06-03 3:12 [PATCH 0 of 7] blktap/pvops updates Daniel Stodden
` (2 preceding siblings ...)
2010-06-03 3:12 ` [PATCH 3 of 7] blktap: Remove broken sysfs pause/resume API Daniel Stodden
@ 2010-06-03 3:12 ` Daniel Stodden
2010-06-03 3:20 ` Daniel Stodden
2010-06-03 3:12 ` [PATCH 5 of 7] blktap: Remove obsolete kernel version dependencies Daniel Stodden
` (2 subsequent siblings)
6 siblings, 1 reply; 9+ messages in thread
From: Daniel Stodden @ 2010-06-03 3:12 UTC (permalink / raw)
To: Xen; +Cc: Jeremy Fitzhardinge
[-- Attachment #1: blktap-device-destroy-sync.diff --]
[-- Type: text/x-patch, Size: 5491 bytes --]
blktap: Make the device destruction path synchronous.
diff -r 69301010e4cf -r 6a74cabb7220 drivers/xen/blktap/control.c
--- a/drivers/xen/blktap/control.c Wed Jun 02 19:45:25 2010 -0700
+++ b/drivers/xen/blktap/control.c Wed Jun 02 19:45:25 2010 -0700
@@ -163,46 +163,29 @@
blktap_control_destroy_device(struct blktap *tap)
{
int err;
- unsigned long inuse;
if (!tap)
return 0;
set_bit(BLKTAP_SHUTDOWN_REQUESTED, &tap->dev_inuse);
- for (;;) {
- inuse = tap->dev_inuse;
- err = blktap_device_destroy(tap);
- if (err)
- goto wait;
+ err = blktap_device_destroy(tap);
+ if (err)
+ return err;
- inuse = tap->dev_inuse;
- err = blktap_ring_destroy(tap);
- if (err)
- goto wait;
+ err = blktap_sysfs_destroy(tap);
+ if (err)
+ return err;
- inuse = tap->dev_inuse;
- err = blktap_sysfs_destroy(tap);
- if (err)
- goto wait;
-
- break;
-
- wait:
- BTDBG("inuse: 0x%lx, dev_inuse: 0x%lx\n",
- inuse, tap->dev_inuse);
- if (wait_event_interruptible(tap->wq, tap->dev_inuse != inuse))
- break;
- }
+ err = blktap_ring_destroy(tap);
+ if (err)
+ return err;
clear_bit(BLKTAP_SHUTDOWN_REQUESTED, &tap->dev_inuse);
+ clear_bit(BLKTAP_CONTROL, &tap->dev_inuse);
+ wake_up(&tap->wq);
- if (tap->dev_inuse == (1UL << BLKTAP_CONTROL)) {
- err = 0;
- clear_bit(BLKTAP_CONTROL, &tap->dev_inuse);
- }
-
- return err;
+ return 0;
}
static int __init
diff -r 69301010e4cf -r 6a74cabb7220 drivers/xen/blktap/device.c
--- a/drivers/xen/blktap/device.c Wed Jun 02 19:45:25 2010 -0700
+++ b/drivers/xen/blktap/device.c Wed Jun 02 19:45:25 2010 -0700
@@ -65,7 +65,7 @@
dev->users--;
if (test_bit(BLKTAP_SHUTDOWN_REQUESTED, &tap->dev_inuse))
- blktap_device_destroy(tap);
+ blktap_control_destroy_device(tap);
return 0;
}
@@ -306,7 +306,6 @@
unsigned long kvaddr;
usr_idx = request->usr_idx;
- down_write(&tap->ring.vma->vm_mm->mmap_sem);
for (i = 0; i < request->nr_pages; i++) {
kvaddr = request_to_kaddr(request, i);
@@ -324,13 +323,17 @@
}
}
- blktap_device_fast_flush(tap, request);
- up_write(&tap->ring.vma->vm_mm->mmap_sem);
+ if (blktap_active(tap)) {
+ down_write(&tap->ring.vma->vm_mm->mmap_sem);
+ blktap_device_fast_flush(tap, request);
+ up_write(&tap->ring.vma->vm_mm->mmap_sem);
+ }
}
/*
* called if the tapdisk process dies unexpectedly.
* fail and release any pending requests and disable queue.
+ * may be called from non-tapdisk context.
*/
void
blktap_device_fail_pending_requests(struct blktap *tap)
@@ -933,8 +936,11 @@
BTINFO("destroy device %d users %d\n", tap->minor, dev->users);
- if (dev->users)
+ if (dev->users) {
+ blktap_device_fail_pending_requests(tap);
+ blktap_device_restart(tap);
return -EBUSY;
+ }
spin_lock_irq(&dev->lock);
/* No more blktap_device_do_request(). */
@@ -952,8 +958,6 @@
blk_cleanup_queue(gd->queue);
put_disk(gd);
- wake_up(&tap->wq);
-
return 0;
}
diff -r 69301010e4cf -r 6a74cabb7220 drivers/xen/blktap/ring.c
--- a/drivers/xen/blktap/ring.c Wed Jun 02 19:45:25 2010 -0700
+++ b/drivers/xen/blktap/ring.c Wed Jun 02 19:45:25 2010 -0700
@@ -161,24 +161,12 @@
struct blktap *tap = vma_to_blktap(vma);
struct blktap_ring *ring = &tap->ring;
- blktap_device_fail_pending_requests(tap); /* fail pending requests */
- blktap_device_restart(tap); /* fail deferred requests */
+ BTINFO("unmapping ring %d\n", tap->minor);
+ zap_page_range(vma, vma->vm_start, vma->vm_end - vma->vm_start, NULL);
+ clear_bit(BLKTAP_RING_VMA, &tap->dev_inuse);
+ ring->vma = NULL;
- zap_page_range(vma, vma->vm_start, vma->vm_end - vma->vm_start, NULL);
-
- kfree(ring->foreign_map.map);
- ring->foreign_map.map = NULL;
-
- /* Free the ring page. */
- ClearPageReserved(virt_to_page(ring->ring.sring));
- free_page((unsigned long)ring->ring.sring);
-
- BTINFO("unmapping ring %d\n", tap->minor);
- ring->ring.sring = NULL;
- ring->vma = NULL;
- clear_bit(BLKTAP_RING_VMA, &tap->dev_inuse);
-
- wake_up(&tap->wq);
+ blktap_control_destroy_device(tap);
}
static struct vm_operations_struct blktap_ring_vm_operations = {
@@ -206,6 +194,9 @@
if (!test_bit(BLKTAP_CONTROL, &tap->dev_inuse))
return -ENODEV;
+ if (test_bit(BLKTAP_SHUTDOWN_REQUESTED, &tap->dev_inuse))
+ return -EBUSY;
+
/* Only one process can access ring at a time */
if (test_and_set_bit(BLKTAP_RING_FD, &tap->dev_inuse))
return -EBUSY;
@@ -224,7 +215,9 @@
BTINFO("freeing device %d\n", tap->minor);
clear_bit(BLKTAP_RING_FD, &tap->dev_inuse);
filp->private_data = NULL;
- wake_up(&tap->wq);
+
+ blktap_control_destroy_device(tap);
+
return 0;
}
diff -r 69301010e4cf -r 6a74cabb7220 drivers/xen/blktap/sysfs.c
--- a/drivers/xen/blktap/sysfs.c Wed Jun 02 19:45:25 2010 -0700
+++ b/drivers/xen/blktap/sysfs.c Wed Jun 02 19:45:25 2010 -0700
@@ -96,7 +96,6 @@
struct device_attribute *attr,
const char *buf, size_t size)
{
- int err;
struct blktap *tap = (struct blktap *)dev_get_drvdata(dev);
if (!tap->ring.dev)
@@ -105,9 +104,13 @@
if (test_and_set_bit(BLKTAP_SHUTDOWN_REQUESTED, &tap->dev_inuse))
return -EBUSY;
- err = blktap_control_destroy_device(tap);
+ BTDBG("sending tapdisk close message\n");
+ tap->ring.ring.sring->pad[0] = BLKTAP2_RING_MESSAGE_CLOSE;
+ blktap_ring_kick_user(tap);
+ wait_event_interruptible(tap->wq,
+ !test_bit(BLKTAP_CONTROL, &tap->dev_inuse));
- return (err ? : size);
+ return 0;
}
CLASS_DEVICE_ATTR(remove, S_IWUSR, NULL, blktap_sysfs_remove_device);
[-- Attachment #2: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 5 of 7] blktap: Remove obsolete kernel version dependencies
2010-06-03 3:12 [PATCH 0 of 7] blktap/pvops updates Daniel Stodden
` (3 preceding siblings ...)
2010-06-03 3:12 ` [PATCH 4 of 7] blktap: Make the device destruction path synchronous Daniel Stodden
@ 2010-06-03 3:12 ` Daniel Stodden
2010-06-03 3:12 ` [PATCH 6 of 7] blktap: Update tap state when failing ring mmap Daniel Stodden
2010-06-03 3:12 ` [PATCH 7 of 7] blktap: Remove passthrough mode Daniel Stodden
6 siblings, 0 replies; 9+ messages in thread
From: Daniel Stodden @ 2010-06-03 3:12 UTC (permalink / raw)
To: Xen; +Cc: Jeremy Fitzhardinge
[-- Attachment #1: blktap-rm-versionisms.diff --]
[-- Type: text/x-patch, Size: 1467 bytes --]
blktap: Remove obsolete kernel version dependencies.
Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
diff -r 6a74cabb7220 -r 699e1fad7561 drivers/xen/blktap/device.c
--- a/drivers/xen/blktap/device.c Wed Jun 02 19:45:25 2010 -0700
+++ b/drivers/xen/blktap/device.c Wed Jun 02 19:45:25 2010 -0700
@@ -97,26 +97,6 @@
command, (long)argument, inode->i_rdev);
switch (command) {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)
- case HDIO_GETGEO: {
- struct hd_geometry geo;
- int ret;
-
- if (!argument)
- return -EINVAL;
-
- geo.start = get_start_sect(bd);
- ret = blktap_device_getgeo(bd, &geo);
- if (ret)
- return ret;
-
- if (copy_to_user((struct hd_geometry __user *)argument, &geo,
- sizeof(geo)))
- return -EFAULT;
-
- return 0;
- }
-#endif
case CDROMMULTISESSION:
BTDBG("FIXME: support multisession CDs later\n");
for (i = 0; i < sizeof(struct cdrom_multisession); i++)
@@ -149,9 +129,7 @@
.open = blktap_device_open,
.release = blktap_device_release,
.ioctl = blktap_device_ioctl,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
.getgeo = blktap_device_getgeo
-#endif
};
static int
@@ -1005,11 +983,7 @@
if (!rq)
goto error;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10)
elevator_init(rq, "noop");
-#else
- elevator_init(rq, &elevator_noop);
-#endif
gd->queue = rq;
rq->queuedata = dev;
[-- Attachment #2: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 6 of 7] blktap: Update tap state when failing ring mmap
2010-06-03 3:12 [PATCH 0 of 7] blktap/pvops updates Daniel Stodden
` (4 preceding siblings ...)
2010-06-03 3:12 ` [PATCH 5 of 7] blktap: Remove obsolete kernel version dependencies Daniel Stodden
@ 2010-06-03 3:12 ` Daniel Stodden
2010-06-03 3:12 ` [PATCH 7 of 7] blktap: Remove passthrough mode Daniel Stodden
6 siblings, 0 replies; 9+ messages in thread
From: Daniel Stodden @ 2010-06-03 3:12 UTC (permalink / raw)
To: Xen; +Cc: Jeremy Fitzhardinge
[-- Attachment #1: blktap-ring-fail-mem.diff --]
[-- Type: text/x-patch, Size: 491 bytes --]
blktap: Update tap state when failing ring mmap.
Signed-off-by: Jake Wires <jake.wires@citrix.com>
Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
diff -r 699e1fad7561 -r 152ee0de9646 drivers/xen/blktap/ring.c
--- a/drivers/xen/blktap/ring.c Wed Jun 02 19:45:25 2010 -0700
+++ b/drivers/xen/blktap/ring.c Wed Jun 02 19:45:25 2010 -0700
@@ -324,6 +324,8 @@
free_page((unsigned long)sring);
kfree(map);
+ clear_bit(BLKTAP_RING_VMA, &tap->dev_inuse);
+
return -ENOMEM;
}
[-- Attachment #2: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 7 of 7] blktap: Remove passthrough mode
2010-06-03 3:12 [PATCH 0 of 7] blktap/pvops updates Daniel Stodden
` (5 preceding siblings ...)
2010-06-03 3:12 ` [PATCH 6 of 7] blktap: Update tap state when failing ring mmap Daniel Stodden
@ 2010-06-03 3:12 ` Daniel Stodden
6 siblings, 0 replies; 9+ messages in thread
From: Daniel Stodden @ 2010-06-03 3:12 UTC (permalink / raw)
To: Xen; +Cc: Jeremy Fitzhardinge
[-- Attachment #1: blktap-rm-passthrough.diff --]
[-- Type: text/x-patch, Size: 4524 bytes --]
blktap: Remove passthrough mode.
Signed-off-by: Jake Wires <jake.wires@citrix.com>
Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
diff -r 152ee0de9646 -r cc3749a5f7e9 drivers/xen/blktap/blktap.h
--- a/drivers/xen/blktap/blktap.h Wed Jun 02 19:45:25 2010 -0700
+++ b/drivers/xen/blktap/blktap.h Wed Jun 02 19:45:25 2010 -0700
@@ -9,8 +9,6 @@
#include <xen/blkif.h>
#include <xen/grant_table.h>
-//#define ENABLE_PASSTHROUGH
-
extern int blktap_debug_level;
#define BTPRINTK(level, tag, force, _f, _a...) \
diff -r 152ee0de9646 -r cc3749a5f7e9 drivers/xen/blktap/device.c
--- a/drivers/xen/blktap/device.c Wed Jun 02 19:45:25 2010 -0700
+++ b/drivers/xen/blktap/device.c Wed Jun 02 19:45:25 2010 -0700
@@ -646,98 +646,6 @@
return err;
}
-#ifdef ENABLE_PASSTHROUGH
-#define rq_for_each_bio_safe(_bio, _tmp, _req) \
- if ((_req)->bio) \
- for (_bio = (_req)->bio; \
- _bio && ((_tmp = _bio->bi_next) || 1); \
- _bio = _tmp)
-
-static void
-blktap_device_forward_request(struct blktap *tap, struct request *req)
-{
- struct bio *bio, *tmp;
- struct blktap_device *dev;
-
- dev = &tap->device;
-
- rq_for_each_bio_safe(bio, tmp, req) {
- bio->bi_bdev = dev->bdev;
- submit_bio(bio->bi_rw, bio);
- }
-}
-
-static void
-blktap_device_close_bdev(struct blktap *tap)
-{
- struct blktap_device *dev;
-
- dev = &tap->device;
-
- if (dev->bdev)
- blkdev_put(dev->bdev);
-
- dev->bdev = NULL;
- clear_bit(BLKTAP_PASSTHROUGH, &tap->dev_inuse);
-}
-
-static int
-blktap_device_open_bdev(struct blktap *tap, u32 pdev)
-{
- struct block_device *bdev;
- struct blktap_device *dev;
-
- dev = &tap->device;
-
- bdev = open_by_devnum(pdev, FMODE_WRITE);
- if (IS_ERR(bdev)) {
- BTERR("opening device %x:%x failed: %ld\n",
- MAJOR(pdev), MINOR(pdev), PTR_ERR(bdev));
- return PTR_ERR(bdev);
- }
-
- if (!bdev->bd_disk) {
- BTERR("device %x:%x doesn't exist\n",
- MAJOR(pdev), MINOR(pdev));
- blkdev_put(dev->bdev);
- return -ENOENT;
- }
-
- dev->bdev = bdev;
- set_bit(BLKTAP_PASSTHROUGH, &tap->dev_inuse);
-
- /* TODO: readjust queue parameters */
-
- BTINFO("set device %d to passthrough on %x:%x\n",
- tap->minor, MAJOR(pdev), MINOR(pdev));
-
- return 0;
-}
-
-int
-blktap_device_enable_passthrough(struct blktap *tap,
- unsigned major, unsigned minor)
-{
- u32 pdev;
- struct blktap_device *dev;
-
- dev = &tap->device;
- pdev = MKDEV(major, minor);
-
- if (!test_bit(BLKTAP_PAUSED, &tap->dev_inuse))
- return -EINVAL;
-
- if (dev->bdev) {
- if (pdev)
- return -EINVAL;
- blktap_device_close_bdev(tap);
- return 0;
- }
-
- return blktap_device_open_bdev(tap, pdev);
-}
-#endif
-
/*
* called from tapdisk context
*/
@@ -769,14 +677,6 @@
continue;
}
-#ifdef ENABLE_PASSTHROUGH
- if (test_bit(BLKTAP_PASSTHROUGH, &tap->dev_inuse)) {
- blkdev_dequeue_request(req);
- blktap_device_forward_request(tap, req);
- continue;
- }
-#endif
-
if (RING_FULL(&ring->ring)) {
wait:
/* Avoid pointless unplugs. */
@@ -927,11 +827,6 @@
dev->gd = NULL;
spin_unlock_irq(&dev->lock);
-#ifdef ENABLE_PASSTHROUGH
- if (dev->bdev)
- blktap_device_close_bdev(tap);
-#endif
-
del_gendisk(gd);
blk_cleanup_queue(gd->queue);
put_disk(gd);
diff -r 152ee0de9646 -r cc3749a5f7e9 drivers/xen/blktap/sysfs.c
--- a/drivers/xen/blktap/sysfs.c Wed Jun 02 19:45:25 2010 -0700
+++ b/drivers/xen/blktap/sysfs.c Wed Jun 02 19:45:25 2010 -0700
@@ -114,50 +114,6 @@
}
CLASS_DEVICE_ATTR(remove, S_IWUSR, NULL, blktap_sysfs_remove_device);
-#ifdef ENABLE_PASSTHROUGH
-static ssize_t
-blktap_sysfs_enable_passthrough(struct device *dev,
- const char *buf, size_t size)
-{
- int err;
- unsigned major, minor;
- struct blktap *tap = (struct blktap *)dev_get_drvdata(dev);
-
- BTINFO("passthrough request enabled\n");
-
- blktap_sysfs_enter(tap);
-
- if (!tap->ring.dev ||
- test_bit(BLKTAP_SHUTDOWN_REQUESTED, &tap->dev_inuse)) {
- err = -ENODEV;
- goto out;
- }
-
- if (!test_bit(BLKTAP_PAUSED, &tap->dev_inuse)) {
- err = -EINVAL;
- goto out;
- }
-
- if (test_bit(BLKTAP_PASSTHROUGH, &tap->dev_inuse)) {
- err = -EINVAL;
- goto out;
- }
-
- err = sscanf(buf, "%x:%x", &major, &minor);
- if (err != 2) {
- err = -EINVAL;
- goto out;
- }
-
- err = blktap_device_enable_passthrough(tap, major, minor);
-
-out:
- blktap_sysfs_exit(tap);
- BTDBG("returning %d\n", (err ? err : size));
- return (err ? err : size);
-}
-#endif
-
static ssize_t
blktap_sysfs_debug_device(struct device *dev, struct device_attribute *attr, char *buf)
{
[-- Attachment #2: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 4 of 7] blktap: Make the device destruction path synchronous
2010-06-03 3:12 ` [PATCH 4 of 7] blktap: Make the device destruction path synchronous Daniel Stodden
@ 2010-06-03 3:20 ` Daniel Stodden
0 siblings, 0 replies; 9+ messages in thread
From: Daniel Stodden @ 2010-06-03 3:20 UTC (permalink / raw)
To: Xen; +Cc: Jeremy Fitzhardinge
On Wed, 2010-06-02 at 23:12 -0400, Daniel Stodden wrote:
Signed-off-by: Jake Wires <jake.wires@citrix.com>
Signed-off-by: Daniel Stodden <daniel.stodden@citrix.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2010-06-03 3:20 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-03 3:12 [PATCH 0 of 7] blktap/pvops updates Daniel Stodden
2010-06-03 3:12 ` [PATCH 1 of 7] blktap: Synchronous queue dispatch Daniel Stodden
2010-06-03 3:12 ` [PATCH 2 of 7] linux: Remove unmap hook from vm_operations struct Daniel Stodden
2010-06-03 3:12 ` [PATCH 3 of 7] blktap: Remove broken sysfs pause/resume API Daniel Stodden
2010-06-03 3:12 ` [PATCH 4 of 7] blktap: Make the device destruction path synchronous Daniel Stodden
2010-06-03 3:20 ` Daniel Stodden
2010-06-03 3:12 ` [PATCH 5 of 7] blktap: Remove obsolete kernel version dependencies Daniel Stodden
2010-06-03 3:12 ` [PATCH 6 of 7] blktap: Update tap state when failing ring mmap Daniel Stodden
2010-06-03 3:12 ` [PATCH 7 of 7] blktap: Remove passthrough mode Daniel Stodden
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.