Lines Matching +full:d +full:-
9 #include <linux/blk-mq.h>
10 #include <linux/backing-dev.h>
37 struct aoedev *d = disk->private_data; in aoedisk_show_state() local
40 (d->flags & DEVFL_UP) ? "up" : "down", in aoedisk_show_state()
41 (d->flags & DEVFL_KICKME) ? ",kickme" : in aoedisk_show_state()
42 (d->nopen && !(d->flags & DEVFL_UP)) ? ",closewait" : ""); in aoedisk_show_state()
43 /* I'd rather see nopen exported so we can ditch closewait */ in aoedisk_show_state()
49 struct aoedev *d = disk->private_data; in aoedisk_show_mac() local
50 struct aoetgt *t = d->targets[0]; in aoedisk_show_mac()
54 return sysfs_emit(page, "%pm\n", t->addr); in aoedisk_show_mac()
60 struct aoedev *d = disk->private_data; in aoedisk_show_netif() local
69 t = d->targets; in aoedisk_show_netif()
70 te = t + d->ntargets; in aoedisk_show_netif()
72 ifp = (*t)->ifs; in aoedisk_show_netif()
74 for (; ifp < e && ifp->nd; ifp++) { in aoedisk_show_netif()
76 if (*nnd == ifp->nd) in aoedisk_show_netif()
79 *nd++ = ifp->nd; in aoedisk_show_netif()
88 p += scnprintf(p, PAGE_SIZE - (p-page), "%s%s", in aoedisk_show_netif()
89 p == page ? "" : ",", (*nd)->name); in aoedisk_show_netif()
90 p += scnprintf(p, PAGE_SIZE - (p-page), "\n"); in aoedisk_show_netif()
91 return p-page; in aoedisk_show_netif()
98 struct aoedev *d = disk->private_data; in aoedisk_show_fwver() local
100 return sysfs_emit(page, "0x%04x\n", (unsigned int) d->fw_ver); in aoedisk_show_fwver()
106 struct aoedev *d = disk->private_data; in aoedisk_show_payload() local
108 return sysfs_emit(page, "%lu\n", d->maxbcnt); in aoedisk_show_payload()
113 struct aoedev *d; in aoe_debugfs_show() local
119 d = s->private; in aoe_debugfs_show()
120 seq_printf(s, "rttavg: %d rttdev: %d\n", in aoe_debugfs_show()
121 d->rttavg >> RTTSCALE, in aoe_debugfs_show()
122 d->rttdev >> RTTDSCALE); in aoe_debugfs_show()
123 seq_printf(s, "nskbpool: %d\n", skb_queue_len(&d->skbpool)); in aoe_debugfs_show()
124 seq_printf(s, "kicked: %ld\n", d->kicked); in aoe_debugfs_show()
125 seq_printf(s, "maxbcnt: %ld\n", d->maxbcnt); in aoe_debugfs_show()
126 seq_printf(s, "ref: %ld\n", d->ref); in aoe_debugfs_show()
128 spin_lock_irqsave(&d->lock, flags); in aoe_debugfs_show()
129 t = d->targets; in aoe_debugfs_show()
130 te = t + d->ntargets; in aoe_debugfs_show()
133 seq_printf(s, "falloc: %ld\n", (*t)->falloc); in aoe_debugfs_show()
135 list_empty(&(*t)->ffree) ? NULL : (*t)->ffree.next); in aoe_debugfs_show()
136 seq_printf(s, "%pm:%d:%d:%d\n", (*t)->addr, (*t)->nout, in aoe_debugfs_show()
137 (*t)->maxout, (*t)->nframes); in aoe_debugfs_show()
138 seq_printf(s, "\tssthresh:%d\n", (*t)->ssthresh); in aoe_debugfs_show()
139 seq_printf(s, "\ttaint:%d\n", (*t)->taint); in aoe_debugfs_show()
140 seq_printf(s, "\tr:%d\n", (*t)->rpkts); in aoe_debugfs_show()
141 seq_printf(s, "\tw:%d\n", (*t)->wpkts); in aoe_debugfs_show()
142 ifp = (*t)->ifs; in aoe_debugfs_show()
143 ife = ifp + ARRAY_SIZE((*t)->ifs); in aoe_debugfs_show()
144 for (; ifp->nd && ifp < ife; ifp++) { in aoe_debugfs_show()
145 seq_printf(s, "%c%s", c, ifp->nd->name); in aoe_debugfs_show()
150 spin_unlock_irqrestore(&d->lock, flags); in aoe_debugfs_show()
160 .attr = { .name = "firmware-version", .mode = 0444 },
184 aoedisk_add_debugfs(struct aoedev *d) in aoedisk_add_debugfs() argument
190 p = strchr(d->gd->disk_name, '/'); in aoedisk_add_debugfs()
192 p = d->gd->disk_name; in aoedisk_add_debugfs()
196 d->debugfs = debugfs_create_file(p, 0444, aoe_debugfs_dir, d, in aoedisk_add_debugfs()
200 aoedisk_rm_debugfs(struct aoedev *d) in aoedisk_rm_debugfs() argument
202 debugfs_remove(d->debugfs); in aoedisk_rm_debugfs()
203 d->debugfs = NULL; in aoedisk_rm_debugfs()
209 struct aoedev *d = disk->private_data; in aoeblk_open() local
212 if (!virt_addr_valid(d)) { in aoeblk_open()
216 return -ENODEV; in aoeblk_open()
218 if (!(d->flags & DEVFL_UP) || d->flags & DEVFL_TKILL) in aoeblk_open()
219 return -ENODEV; in aoeblk_open()
222 spin_lock_irqsave(&d->lock, flags); in aoeblk_open()
223 if (d->flags & DEVFL_UP && !(d->flags & DEVFL_TKILL)) { in aoeblk_open()
224 d->nopen++; in aoeblk_open()
225 spin_unlock_irqrestore(&d->lock, flags); in aoeblk_open()
229 spin_unlock_irqrestore(&d->lock, flags); in aoeblk_open()
231 return -ENODEV; in aoeblk_open()
237 struct aoedev *d = disk->private_data; in aoeblk_release() local
240 spin_lock_irqsave(&d->lock, flags); in aoeblk_release()
242 if (--d->nopen == 0) { in aoeblk_release()
243 spin_unlock_irqrestore(&d->lock, flags); in aoeblk_release()
244 aoecmd_cfg(d->aoemajor, d->aoeminor); in aoeblk_release()
247 spin_unlock_irqrestore(&d->lock, flags); in aoeblk_release()
253 struct aoedev *d = hctx->queue->queuedata; in aoeblk_queue_rq() local
255 spin_lock_irq(&d->lock); in aoeblk_queue_rq()
257 if ((d->flags & DEVFL_UP) == 0) { in aoeblk_queue_rq()
258 pr_info_ratelimited("aoe: device %ld.%d is not up\n", in aoeblk_queue_rq()
259 d->aoemajor, d->aoeminor); in aoeblk_queue_rq()
260 spin_unlock_irq(&d->lock); in aoeblk_queue_rq()
261 blk_mq_start_request(bd->rq); in aoeblk_queue_rq()
265 list_add_tail(&bd->rq->queuelist, &d->rq_list); in aoeblk_queue_rq()
266 aoecmd_work(d); in aoeblk_queue_rq()
267 spin_unlock_irq(&d->lock); in aoeblk_queue_rq()
274 struct aoedev *d = bdev->bd_disk->private_data; in aoeblk_getgeo() local
276 if ((d->flags & DEVFL_UP) == 0) { in aoeblk_getgeo()
278 return -ENODEV; in aoeblk_getgeo()
281 geo->cylinders = d->geo.cylinders; in aoeblk_getgeo()
282 geo->heads = d->geo.heads; in aoeblk_getgeo()
283 geo->sectors = d->geo.sectors; in aoeblk_getgeo()
290 struct aoedev *d; in aoeblk_ioctl() local
293 return -EINVAL; in aoeblk_ioctl()
295 d = bdev->bd_disk->private_data; in aoeblk_ioctl()
296 if ((d->flags & DEVFL_UP) == 0) { in aoeblk_ioctl()
298 return -ENODEV; in aoeblk_ioctl()
302 if (!copy_to_user((void __user *) arg, &d->ident, in aoeblk_ioctl()
303 sizeof(d->ident))) in aoeblk_ioctl()
305 return -EFAULT; in aoeblk_ioctl()
312 return -ENOTTY; in aoeblk_ioctl()
332 struct aoedev *d = vp; in aoeblk_gdalloc() local
346 spin_lock_irqsave(&d->lock, flags); in aoeblk_gdalloc()
347 if (d->flags & DEVFL_GDALLOC in aoeblk_gdalloc()
348 && !(d->flags & DEVFL_TKILL) in aoeblk_gdalloc()
349 && !(d->flags & DEVFL_GD_NOW)) in aoeblk_gdalloc()
350 d->flags |= DEVFL_GD_NOW; in aoeblk_gdalloc()
353 spin_unlock_irqrestore(&d->lock, flags); in aoeblk_gdalloc()
360 printk(KERN_ERR "aoe: cannot allocate bufpool for %ld.%d\n", in aoeblk_gdalloc()
361 d->aoemajor, d->aoeminor); in aoeblk_gdalloc()
365 set = &d->tag_set; in aoeblk_gdalloc()
366 set->ops = &aoeblk_mq_ops; in aoeblk_gdalloc()
367 set->cmd_size = sizeof(struct aoe_req); in aoeblk_gdalloc()
368 set->nr_hw_queues = 1; in aoeblk_gdalloc()
369 set->queue_depth = 128; in aoeblk_gdalloc()
370 set->numa_node = NUMA_NO_NODE; in aoeblk_gdalloc()
371 set->flags = BLK_MQ_F_SHOULD_MERGE; in aoeblk_gdalloc()
374 pr_err("aoe: cannot allocate tag set for %ld.%d\n", in aoeblk_gdalloc()
375 d->aoemajor, d->aoeminor); in aoeblk_gdalloc()
379 gd = blk_mq_alloc_disk(set, &lim, d); in aoeblk_gdalloc()
381 pr_err("aoe: cannot allocate block queue for %ld.%d\n", in aoeblk_gdalloc()
382 d->aoemajor, d->aoeminor); in aoeblk_gdalloc()
386 spin_lock_irqsave(&d->lock, flags); in aoeblk_gdalloc()
387 WARN_ON(!(d->flags & DEVFL_GD_NOW)); in aoeblk_gdalloc()
388 WARN_ON(!(d->flags & DEVFL_GDALLOC)); in aoeblk_gdalloc()
389 WARN_ON(d->flags & DEVFL_TKILL); in aoeblk_gdalloc()
390 WARN_ON(d->gd); in aoeblk_gdalloc()
391 WARN_ON(d->flags & DEVFL_UP); in aoeblk_gdalloc()
392 d->bufpool = mp; in aoeblk_gdalloc()
393 d->blkq = gd->queue; in aoeblk_gdalloc()
394 d->gd = gd; in aoeblk_gdalloc()
395 gd->major = AOE_MAJOR; in aoeblk_gdalloc()
396 gd->first_minor = d->sysminor; in aoeblk_gdalloc()
397 gd->minors = AOE_PARTITIONS; in aoeblk_gdalloc()
398 gd->fops = &aoe_bdops; in aoeblk_gdalloc()
399 gd->private_data = d; in aoeblk_gdalloc()
400 ssize = d->ssize; in aoeblk_gdalloc()
401 snprintf(gd->disk_name, sizeof gd->disk_name, "etherd/e%ld.%d", in aoeblk_gdalloc()
402 d->aoemajor, d->aoeminor); in aoeblk_gdalloc()
404 d->flags &= ~DEVFL_GDALLOC; in aoeblk_gdalloc()
405 d->flags |= DEVFL_UP; in aoeblk_gdalloc()
407 spin_unlock_irqrestore(&d->lock, flags); in aoeblk_gdalloc()
414 aoedisk_add_debugfs(d); in aoeblk_gdalloc()
416 spin_lock_irqsave(&d->lock, flags); in aoeblk_gdalloc()
417 WARN_ON(!(d->flags & DEVFL_GD_NOW)); in aoeblk_gdalloc()
418 d->flags &= ~DEVFL_GD_NOW; in aoeblk_gdalloc()
419 spin_unlock_irqrestore(&d->lock, flags); in aoeblk_gdalloc()
429 spin_lock_irqsave(&d->lock, flags); in aoeblk_gdalloc()
430 d->flags &= ~DEVFL_GD_NOW; in aoeblk_gdalloc()
431 queue_work(aoe_wq, &d->work); in aoeblk_gdalloc()
432 spin_unlock_irqrestore(&d->lock, flags); in aoeblk_gdalloc()
450 return -ENOMEM; in aoeblk_init()