trans_virtio.c (c7ebbae7cf9c50253a978f25d72d16e012bd46f1) | trans_virtio.c (31934da810365f603dec5a67e690e00cf900fc73) |
---|---|
1/* 2 * The Virtio 9p transport driver 3 * 4 * This is a block based transport driver based on the lguest block driver 5 * code. 6 * 7 * Copyright (C) 2007, 2008 Eric Van Hensbergen, IBM Corporation 8 * --- 130 unchanged lines hidden (view full) --- 139 * 140 */ 141 142static void req_done(struct virtqueue *vq) 143{ 144 struct virtio_chan *chan = vq->vdev->priv; 145 unsigned int len; 146 struct p9_req_t *req; | 1/* 2 * The Virtio 9p transport driver 3 * 4 * This is a block based transport driver based on the lguest block driver 5 * code. 6 * 7 * Copyright (C) 2007, 2008 Eric Van Hensbergen, IBM Corporation 8 * --- 130 unchanged lines hidden (view full) --- 139 * 140 */ 141 142static void req_done(struct virtqueue *vq) 143{ 144 struct virtio_chan *chan = vq->vdev->priv; 145 unsigned int len; 146 struct p9_req_t *req; |
147 bool need_wakeup = false; |
|
147 unsigned long flags; 148 149 p9_debug(P9_DEBUG_TRANS, ": request done\n"); 150 | 148 unsigned long flags; 149 150 p9_debug(P9_DEBUG_TRANS, ": request done\n"); 151 |
151 while (1) { 152 spin_lock_irqsave(&chan->lock, flags); 153 req = virtqueue_get_buf(chan->vq, &len); 154 if (req == NULL) { 155 spin_unlock_irqrestore(&chan->lock, flags); 156 break; | 152 spin_lock_irqsave(&chan->lock, flags); 153 while ((req = virtqueue_get_buf(chan->vq, &len)) != NULL) { 154 if (!chan->ring_bufs_avail) { 155 chan->ring_bufs_avail = 1; 156 need_wakeup = true; |
157 } | 157 } |
158 chan->ring_bufs_avail = 1; 159 spin_unlock_irqrestore(&chan->lock, flags); 160 /* Wakeup if anyone waiting for VirtIO ring space. */ 161 wake_up(chan->vc_wq); | 158 |
162 if (len) 163 p9_client_cb(chan->client, req, REQ_STATUS_RCVD); 164 } | 159 if (len) 160 p9_client_cb(chan->client, req, REQ_STATUS_RCVD); 161 } |
162 spin_unlock_irqrestore(&chan->lock, flags); 163 /* Wakeup if anyone waiting for VirtIO ring space. */ 164 if (need_wakeup) 165 wake_up(chan->vc_wq); |
|
165} 166 167/** 168 * pack_sg_list - pack a scatter gather list from a linear buffer 169 * @sg: scatter/gather list to pack into 170 * @start: which segment of the sg_list to start at 171 * @limit: maximum segment to pack data to 172 * @data: data to pack into scatter/gather list --- 609 unchanged lines hidden --- | 166} 167 168/** 169 * pack_sg_list - pack a scatter gather list from a linear buffer 170 * @sg: scatter/gather list to pack into 171 * @start: which segment of the sg_list to start at 172 * @limit: maximum segment to pack data to 173 * @data: data to pack into scatter/gather list --- 609 unchanged lines hidden --- |