nbd 147 arch/sparc/kernel/leon_pci_grpci2.c unsigned int nbd; /* 0x08 Next Data Descriptor in chan */ nbd 66 drivers/block/nbd.c struct nbd_device *nbd; nbd 128 drivers/block/nbd.c struct nbd_device *nbd; nbd 142 drivers/block/nbd.c #define nbd_name(nbd) ((nbd)->disk->disk_name) nbd 152 drivers/block/nbd.c static int nbd_dev_dbg_init(struct nbd_device *nbd); nbd 153 drivers/block/nbd.c static void nbd_dev_dbg_close(struct nbd_device *nbd); nbd 154 drivers/block/nbd.c static void nbd_config_put(struct nbd_device *nbd); nbd 158 drivers/block/nbd.c static void nbd_disconnect_and_put(struct nbd_device *nbd); nbd 160 drivers/block/nbd.c static inline struct device *nbd_to_dev(struct nbd_device *nbd) nbd 162 drivers/block/nbd.c return disk_to_dev(nbd->disk); nbd 210 drivers/block/nbd.c struct nbd_device *nbd = (struct nbd_device *)disk->private_data; nbd 212 drivers/block/nbd.c return sprintf(buf, "%d\n", task_pid_nr(nbd->task_recv)); nbd 220 drivers/block/nbd.c static void nbd_dev_remove(struct nbd_device *nbd) nbd 222 drivers/block/nbd.c struct gendisk *disk = nbd->disk; nbd 229 drivers/block/nbd.c blk_mq_free_tag_set(&nbd->tag_set); nbd 240 drivers/block/nbd.c if (test_bit(NBD_DESTROY_ON_DISCONNECT, &nbd->flags) && nbd->destroy_complete) nbd 241 drivers/block/nbd.c complete(nbd->destroy_complete); nbd 243 drivers/block/nbd.c kfree(nbd); nbd 246 drivers/block/nbd.c static void nbd_put(struct nbd_device *nbd) nbd 248 drivers/block/nbd.c if (refcount_dec_and_mutex_lock(&nbd->refs, nbd 250 drivers/block/nbd.c idr_remove(&nbd_index_idr, nbd->index); nbd 251 drivers/block/nbd.c nbd_dev_remove(nbd); nbd 262 drivers/block/nbd.c static void nbd_mark_nsock_dead(struct nbd_device *nbd, struct nbd_sock *nsock, nbd 265 drivers/block/nbd.c if (!nsock->dead && notify && !nbd_disconnected(nbd->config)) { nbd 270 drivers/block/nbd.c args->index = nbd->index; nbd 276 drivers/block/nbd.c if (atomic_dec_return(&nbd->config->live_connections) == 0) { nbd 278 drivers/block/nbd.c &nbd->config->runtime_flags)) { nbd 280 drivers/block/nbd.c &nbd->config->runtime_flags); nbd 281 drivers/block/nbd.c dev_info(nbd_to_dev(nbd), nbd 291 drivers/block/nbd.c static void nbd_size_clear(struct nbd_device *nbd) nbd 293 drivers/block/nbd.c if (nbd->config->bytesize) { nbd 294 drivers/block/nbd.c set_capacity(nbd->disk, 0); nbd 295 drivers/block/nbd.c kobject_uevent(&nbd_to_dev(nbd)->kobj, KOBJ_CHANGE); nbd 299 drivers/block/nbd.c static void nbd_size_update(struct nbd_device *nbd) nbd 301 drivers/block/nbd.c struct nbd_config *config = nbd->config; nbd 302 drivers/block/nbd.c struct block_device *bdev = bdget_disk(nbd->disk, 0); nbd 305 drivers/block/nbd.c nbd->disk->queue->limits.discard_granularity = config->blksize; nbd 306 drivers/block/nbd.c nbd->disk->queue->limits.discard_alignment = config->blksize; nbd 307 drivers/block/nbd.c blk_queue_max_discard_sectors(nbd->disk->queue, UINT_MAX); nbd 309 drivers/block/nbd.c blk_queue_logical_block_size(nbd->disk->queue, config->blksize); nbd 310 drivers/block/nbd.c blk_queue_physical_block_size(nbd->disk->queue, config->blksize); nbd 311 drivers/block/nbd.c set_capacity(nbd->disk, config->bytesize >> 9); nbd 320 drivers/block/nbd.c kobject_uevent(&nbd_to_dev(nbd)->kobj, KOBJ_CHANGE); nbd 323 drivers/block/nbd.c static void nbd_size_set(struct nbd_device *nbd, loff_t blocksize, nbd 326 drivers/block/nbd.c struct nbd_config *config = nbd->config; nbd 329 drivers/block/nbd.c if (nbd->task_recv != NULL) nbd 330 drivers/block/nbd.c nbd_size_update(nbd); nbd 337 drivers/block/nbd.c dev_dbg(nbd_to_dev(cmd->nbd), "request %p: %s\n", req, nbd 346 drivers/block/nbd.c static void sock_shutdown(struct nbd_device *nbd) nbd 348 drivers/block/nbd.c struct nbd_config *config = nbd->config; nbd 359 drivers/block/nbd.c nbd_mark_nsock_dead(nbd, nsock, 0); nbd 362 drivers/block/nbd.c dev_warn(disk_to_dev(nbd->disk), "shutting down sockets\n"); nbd 385 drivers/block/nbd.c struct nbd_device *nbd = cmd->nbd; nbd 391 drivers/block/nbd.c if (!refcount_inc_not_zero(&nbd->config_refs)) { nbd 396 drivers/block/nbd.c config = nbd->config; nbd 399 drivers/block/nbd.c dev_err_ratelimited(nbd_to_dev(nbd), nbd 419 drivers/block/nbd.c nbd_mark_nsock_dead(nbd, nsock, 1); nbd 424 drivers/block/nbd.c nbd_config_put(nbd); nbd 429 drivers/block/nbd.c if (!nbd->tag_set.timeout) { nbd 435 drivers/block/nbd.c dev_info(nbd_to_dev(nbd), "Possible stuck request %p: control (%s@%llu,%uB). Runtime %u seconds\n", nbd 441 drivers/block/nbd.c nbd_config_put(nbd); nbd 445 drivers/block/nbd.c dev_err_ratelimited(nbd_to_dev(nbd), "Connection timed out\n"); nbd 449 drivers/block/nbd.c sock_shutdown(nbd); nbd 450 drivers/block/nbd.c nbd_config_put(nbd); nbd 459 drivers/block/nbd.c static int sock_xmit(struct nbd_device *nbd, int index, int send, nbd 462 drivers/block/nbd.c struct nbd_config *config = nbd->config; nbd 469 drivers/block/nbd.c dev_err_ratelimited(disk_to_dev(nbd->disk), nbd 515 drivers/block/nbd.c static int nbd_send_cmd(struct nbd_device *nbd, struct nbd_cmd *cmd, int index) nbd 518 drivers/block/nbd.c struct nbd_config *config = nbd->config; nbd 539 drivers/block/nbd.c dev_err_ratelimited(disk_to_dev(nbd->disk), nbd 575 drivers/block/nbd.c trace_nbd_send_request(&request, nbd->index, blk_mq_rq_from_pdu(cmd)); nbd 577 drivers/block/nbd.c dev_dbg(nbd_to_dev(nbd), "request %p: sending control (%s@%llu,%uB)\n", nbd 580 drivers/block/nbd.c result = sock_xmit(nbd, index, 1, &from, nbd 597 drivers/block/nbd.c dev_err_ratelimited(disk_to_dev(nbd->disk), nbd 615 drivers/block/nbd.c dev_dbg(nbd_to_dev(nbd), "request %p: sending %d bytes data\n", nbd 626 drivers/block/nbd.c result = sock_xmit(nbd, index, 1, &from, flags, &sent); nbd 638 drivers/block/nbd.c dev_err(disk_to_dev(nbd->disk), nbd 662 drivers/block/nbd.c static struct nbd_cmd *nbd_read_stat(struct nbd_device *nbd, int index) nbd 664 drivers/block/nbd.c struct nbd_config *config = nbd->config; nbd 678 drivers/block/nbd.c result = sock_xmit(nbd, index, 0, &to, MSG_WAITALL, NULL); nbd 681 drivers/block/nbd.c dev_err(disk_to_dev(nbd->disk), nbd 687 drivers/block/nbd.c dev_err(disk_to_dev(nbd->disk), "Wrong magic (0x%lx)\n", nbd 695 drivers/block/nbd.c if (hwq < nbd->tag_set.nr_hw_queues) nbd 696 drivers/block/nbd.c req = blk_mq_tag_to_rq(nbd->tag_set.tags[hwq], nbd 699 drivers/block/nbd.c dev_err(disk_to_dev(nbd->disk), "Unexpected reply (%d) %p\n", nbd 708 drivers/block/nbd.c dev_err(disk_to_dev(nbd->disk), "Double reply on req %p, cmd_cookie %u, handle cookie %u\n", nbd 714 drivers/block/nbd.c dev_err(disk_to_dev(nbd->disk), "Command already handled %p\n", nbd 720 drivers/block/nbd.c dev_err(disk_to_dev(nbd->disk), "Raced with timeout on req %p\n", nbd 726 drivers/block/nbd.c dev_err(disk_to_dev(nbd->disk), "Other side returned error (%d)\n", nbd 732 drivers/block/nbd.c dev_dbg(nbd_to_dev(nbd), "request %p: got reply\n", req); nbd 739 drivers/block/nbd.c result = sock_xmit(nbd, index, 0, &to, MSG_WAITALL, NULL); nbd 741 drivers/block/nbd.c dev_err(disk_to_dev(nbd->disk), "Receive data failed (result %d)\n", nbd 758 drivers/block/nbd.c dev_dbg(nbd_to_dev(nbd), "request %p: got %d bytes data\n", nbd 773 drivers/block/nbd.c struct nbd_device *nbd = args->nbd; nbd 774 drivers/block/nbd.c struct nbd_config *config = nbd->config; nbd 778 drivers/block/nbd.c cmd = nbd_read_stat(nbd, args->index); nbd 783 drivers/block/nbd.c nbd_mark_nsock_dead(nbd, nsock, 1); nbd 792 drivers/block/nbd.c nbd_config_put(nbd); nbd 808 drivers/block/nbd.c static void nbd_clear_que(struct nbd_device *nbd) nbd 810 drivers/block/nbd.c blk_mq_quiesce_queue(nbd->disk->queue); nbd 811 drivers/block/nbd.c blk_mq_tagset_busy_iter(&nbd->tag_set, nbd_clear_req, NULL); nbd 812 drivers/block/nbd.c blk_mq_unquiesce_queue(nbd->disk->queue); nbd 813 drivers/block/nbd.c dev_dbg(disk_to_dev(nbd->disk), "queue cleared\n"); nbd 816 drivers/block/nbd.c static int find_fallback(struct nbd_device *nbd, int index) nbd 818 drivers/block/nbd.c struct nbd_config *config = nbd->config; nbd 827 drivers/block/nbd.c dev_err_ratelimited(disk_to_dev(nbd->disk), nbd 850 drivers/block/nbd.c dev_err_ratelimited(disk_to_dev(nbd->disk), nbd 859 drivers/block/nbd.c static int wait_for_reconnect(struct nbd_device *nbd) nbd 861 drivers/block/nbd.c struct nbd_config *config = nbd->config; nbd 874 drivers/block/nbd.c struct nbd_device *nbd = cmd->nbd; nbd 879 drivers/block/nbd.c if (!refcount_inc_not_zero(&nbd->config_refs)) { nbd 880 drivers/block/nbd.c dev_err_ratelimited(disk_to_dev(nbd->disk), nbd 885 drivers/block/nbd.c config = nbd->config; nbd 888 drivers/block/nbd.c dev_err_ratelimited(disk_to_dev(nbd->disk), nbd 890 drivers/block/nbd.c nbd_config_put(nbd); nbd 900 drivers/block/nbd.c index = find_fallback(nbd, index); nbd 903 drivers/block/nbd.c if (wait_for_reconnect(nbd)) { nbd 913 drivers/block/nbd.c sock_shutdown(nbd); nbd 914 drivers/block/nbd.c nbd_config_put(nbd); nbd 936 drivers/block/nbd.c ret = nbd_send_cmd(nbd, cmd, index); nbd 938 drivers/block/nbd.c dev_err_ratelimited(disk_to_dev(nbd->disk), nbd 940 drivers/block/nbd.c nbd_mark_nsock_dead(nbd, nsock, 1); nbd 946 drivers/block/nbd.c nbd_config_put(nbd); nbd 983 drivers/block/nbd.c static struct socket *nbd_get_socket(struct nbd_device *nbd, unsigned long fd, nbd 994 drivers/block/nbd.c dev_err(disk_to_dev(nbd->disk), "Unsupported socket: shutdown callout must be supported.\n"); nbd 1003 drivers/block/nbd.c static int nbd_add_socket(struct nbd_device *nbd, unsigned long arg, nbd 1006 drivers/block/nbd.c struct nbd_config *config = nbd->config; nbd 1012 drivers/block/nbd.c sock = nbd_get_socket(nbd, arg, &err); nbd 1016 drivers/block/nbd.c if (!netlink && !nbd->task_setup && nbd 1018 drivers/block/nbd.c nbd->task_setup = current; nbd 1021 drivers/block/nbd.c (nbd->task_setup != current || nbd 1023 drivers/block/nbd.c dev_err(disk_to_dev(nbd->disk), nbd 1057 drivers/block/nbd.c static int nbd_reconnect_socket(struct nbd_device *nbd, unsigned long arg) nbd 1059 drivers/block/nbd.c struct nbd_config *config = nbd->config; nbd 1065 drivers/block/nbd.c sock = nbd_get_socket(nbd, arg, &err); nbd 1087 drivers/block/nbd.c if (nbd->tag_set.timeout) nbd 1088 drivers/block/nbd.c sock->sk->sk_sndtimeo = nbd->tag_set.timeout; nbd 1090 drivers/block/nbd.c refcount_inc(&nbd->config_refs); nbd 1097 drivers/block/nbd.c args->nbd = nbd; nbd 1107 drivers/block/nbd.c queue_work(nbd->recv_workq, &args->work); nbd 1125 drivers/block/nbd.c static void nbd_parse_flags(struct nbd_device *nbd) nbd 1127 drivers/block/nbd.c struct nbd_config *config = nbd->config; nbd 1129 drivers/block/nbd.c set_disk_ro(nbd->disk, true); nbd 1131 drivers/block/nbd.c set_disk_ro(nbd->disk, false); nbd 1133 drivers/block/nbd.c blk_queue_flag_set(QUEUE_FLAG_DISCARD, nbd->disk->queue); nbd 1136 drivers/block/nbd.c blk_queue_write_cache(nbd->disk->queue, true, true); nbd 1138 drivers/block/nbd.c blk_queue_write_cache(nbd->disk->queue, true, false); nbd 1141 drivers/block/nbd.c blk_queue_write_cache(nbd->disk->queue, false, false); nbd 1144 drivers/block/nbd.c static void send_disconnects(struct nbd_device *nbd) nbd 1146 drivers/block/nbd.c struct nbd_config *config = nbd->config; nbd 1160 drivers/block/nbd.c ret = sock_xmit(nbd, i, 1, &from, 0, NULL); nbd 1162 drivers/block/nbd.c dev_err(disk_to_dev(nbd->disk), nbd 1168 drivers/block/nbd.c static int nbd_disconnect(struct nbd_device *nbd) nbd 1170 drivers/block/nbd.c struct nbd_config *config = nbd->config; nbd 1172 drivers/block/nbd.c dev_info(disk_to_dev(nbd->disk), "NBD_DISCONNECT\n"); nbd 1174 drivers/block/nbd.c set_bit(NBD_DISCONNECT_REQUESTED, &nbd->flags); nbd 1175 drivers/block/nbd.c send_disconnects(nbd); nbd 1179 drivers/block/nbd.c static void nbd_clear_sock(struct nbd_device *nbd) nbd 1181 drivers/block/nbd.c sock_shutdown(nbd); nbd 1182 drivers/block/nbd.c nbd_clear_que(nbd); nbd 1183 drivers/block/nbd.c nbd->task_setup = NULL; nbd 1186 drivers/block/nbd.c static void nbd_config_put(struct nbd_device *nbd) nbd 1188 drivers/block/nbd.c if (refcount_dec_and_mutex_lock(&nbd->config_refs, nbd 1189 drivers/block/nbd.c &nbd->config_lock)) { nbd 1190 drivers/block/nbd.c struct nbd_config *config = nbd->config; nbd 1191 drivers/block/nbd.c nbd_dev_dbg_close(nbd); nbd 1192 drivers/block/nbd.c nbd_size_clear(nbd); nbd 1195 drivers/block/nbd.c device_remove_file(disk_to_dev(nbd->disk), &pid_attr); nbd 1196 drivers/block/nbd.c nbd->task_recv = NULL; nbd 1197 drivers/block/nbd.c nbd_clear_sock(nbd); nbd 1206 drivers/block/nbd.c kfree(nbd->config); nbd 1207 drivers/block/nbd.c nbd->config = NULL; nbd 1209 drivers/block/nbd.c if (nbd->recv_workq) nbd 1210 drivers/block/nbd.c destroy_workqueue(nbd->recv_workq); nbd 1211 drivers/block/nbd.c nbd->recv_workq = NULL; nbd 1213 drivers/block/nbd.c nbd->tag_set.timeout = 0; nbd 1214 drivers/block/nbd.c nbd->disk->queue->limits.discard_granularity = 0; nbd 1215 drivers/block/nbd.c nbd->disk->queue->limits.discard_alignment = 0; nbd 1216 drivers/block/nbd.c blk_queue_max_discard_sectors(nbd->disk->queue, UINT_MAX); nbd 1217 drivers/block/nbd.c blk_queue_flag_clear(QUEUE_FLAG_DISCARD, nbd->disk->queue); nbd 1219 drivers/block/nbd.c mutex_unlock(&nbd->config_lock); nbd 1220 drivers/block/nbd.c nbd_put(nbd); nbd 1225 drivers/block/nbd.c static int nbd_start_device(struct nbd_device *nbd) nbd 1227 drivers/block/nbd.c struct nbd_config *config = nbd->config; nbd 1231 drivers/block/nbd.c if (nbd->task_recv) nbd 1237 drivers/block/nbd.c dev_err(disk_to_dev(nbd->disk), "server does not support multiple connections per device.\n"); nbd 1241 drivers/block/nbd.c nbd->recv_workq = alloc_workqueue("knbd%d-recv", nbd 1243 drivers/block/nbd.c WQ_UNBOUND, 0, nbd->index); nbd 1244 drivers/block/nbd.c if (!nbd->recv_workq) { nbd 1245 drivers/block/nbd.c dev_err(disk_to_dev(nbd->disk), "Could not allocate knbd recv work queue.\n"); nbd 1249 drivers/block/nbd.c blk_mq_update_nr_hw_queues(&nbd->tag_set, config->num_connections); nbd 1250 drivers/block/nbd.c nbd->task_recv = current; nbd 1252 drivers/block/nbd.c nbd_parse_flags(nbd); nbd 1254 drivers/block/nbd.c error = device_create_file(disk_to_dev(nbd->disk), &pid_attr); nbd 1256 drivers/block/nbd.c dev_err(disk_to_dev(nbd->disk), "device_create_file failed!\n"); nbd 1261 drivers/block/nbd.c nbd_dev_dbg_init(nbd); nbd 1267 drivers/block/nbd.c sock_shutdown(nbd); nbd 1277 drivers/block/nbd.c flush_workqueue(nbd->recv_workq); nbd 1281 drivers/block/nbd.c if (nbd->tag_set.timeout) nbd 1283 drivers/block/nbd.c nbd->tag_set.timeout; nbd 1285 drivers/block/nbd.c refcount_inc(&nbd->config_refs); nbd 1287 drivers/block/nbd.c args->nbd = nbd; nbd 1289 drivers/block/nbd.c queue_work(nbd->recv_workq, &args->work); nbd 1291 drivers/block/nbd.c nbd_size_update(nbd); nbd 1295 drivers/block/nbd.c static int nbd_start_device_ioctl(struct nbd_device *nbd, struct block_device *bdev) nbd 1297 drivers/block/nbd.c struct nbd_config *config = nbd->config; nbd 1300 drivers/block/nbd.c ret = nbd_start_device(nbd); nbd 1306 drivers/block/nbd.c mutex_unlock(&nbd->config_lock); nbd 1310 drivers/block/nbd.c sock_shutdown(nbd); nbd 1311 drivers/block/nbd.c flush_workqueue(nbd->recv_workq); nbd 1313 drivers/block/nbd.c mutex_lock(&nbd->config_lock); nbd 1323 drivers/block/nbd.c static void nbd_clear_sock_ioctl(struct nbd_device *nbd, nbd 1326 drivers/block/nbd.c sock_shutdown(nbd); nbd 1330 drivers/block/nbd.c &nbd->config->runtime_flags)) nbd 1331 drivers/block/nbd.c nbd_config_put(nbd); nbd 1342 drivers/block/nbd.c static void nbd_set_cmd_timeout(struct nbd_device *nbd, u64 timeout) nbd 1344 drivers/block/nbd.c nbd->tag_set.timeout = timeout * HZ; nbd 1346 drivers/block/nbd.c blk_queue_rq_timeout(nbd->disk->queue, timeout * HZ); nbd 1350 drivers/block/nbd.c static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd, nbd 1353 drivers/block/nbd.c struct nbd_config *config = nbd->config; nbd 1357 drivers/block/nbd.c return nbd_disconnect(nbd); nbd 1359 drivers/block/nbd.c nbd_clear_sock_ioctl(nbd, bdev); nbd 1362 drivers/block/nbd.c return nbd_add_socket(nbd, arg, false); nbd 1368 drivers/block/nbd.c nbd_size_set(nbd, arg, nbd 1372 drivers/block/nbd.c nbd_size_set(nbd, config->blksize, nbd 1376 drivers/block/nbd.c nbd_size_set(nbd, config->blksize, arg); nbd 1379 drivers/block/nbd.c nbd_set_cmd_timeout(nbd, arg); nbd 1386 drivers/block/nbd.c return nbd_start_device_ioctl(nbd, bdev); nbd 1406 drivers/block/nbd.c struct nbd_device *nbd = bdev->bd_disk->private_data; nbd 1407 drivers/block/nbd.c struct nbd_config *config = nbd->config; nbd 1419 drivers/block/nbd.c mutex_lock(&nbd->config_lock); nbd 1426 drivers/block/nbd.c error = __nbd_ioctl(bdev, nbd, cmd, arg); nbd 1428 drivers/block/nbd.c dev_err(nbd_to_dev(nbd), "Cannot use ioctl interface on a netlink controlled device.\n"); nbd 1429 drivers/block/nbd.c mutex_unlock(&nbd->config_lock); nbd 1451 drivers/block/nbd.c struct nbd_device *nbd; nbd 1455 drivers/block/nbd.c nbd = bdev->bd_disk->private_data; nbd 1456 drivers/block/nbd.c if (!nbd) { nbd 1460 drivers/block/nbd.c if (!refcount_inc_not_zero(&nbd->refs)) { nbd 1464 drivers/block/nbd.c if (!refcount_inc_not_zero(&nbd->config_refs)) { nbd 1467 drivers/block/nbd.c mutex_lock(&nbd->config_lock); nbd 1468 drivers/block/nbd.c if (refcount_inc_not_zero(&nbd->config_refs)) { nbd 1469 drivers/block/nbd.c mutex_unlock(&nbd->config_lock); nbd 1472 drivers/block/nbd.c config = nbd->config = nbd_alloc_config(); nbd 1475 drivers/block/nbd.c mutex_unlock(&nbd->config_lock); nbd 1478 drivers/block/nbd.c refcount_set(&nbd->config_refs, 1); nbd 1479 drivers/block/nbd.c refcount_inc(&nbd->refs); nbd 1480 drivers/block/nbd.c mutex_unlock(&nbd->config_lock); nbd 1482 drivers/block/nbd.c } else if (nbd_disconnected(nbd->config)) { nbd 1492 drivers/block/nbd.c struct nbd_device *nbd = disk->private_data; nbd 1495 drivers/block/nbd.c if (test_bit(NBD_RT_DISCONNECT_ON_CLOSE, &nbd->config->runtime_flags) && nbd 1497 drivers/block/nbd.c nbd_disconnect_and_put(nbd); nbd 1499 drivers/block/nbd.c nbd_config_put(nbd); nbd 1500 drivers/block/nbd.c nbd_put(nbd); nbd 1516 drivers/block/nbd.c struct nbd_device *nbd = s->private; nbd 1518 drivers/block/nbd.c if (nbd->task_recv) nbd 1519 drivers/block/nbd.c seq_printf(s, "recv: %d\n", task_pid_nr(nbd->task_recv)); nbd 1538 drivers/block/nbd.c struct nbd_device *nbd = s->private; nbd 1539 drivers/block/nbd.c u32 flags = nbd->config->flags; nbd 1571 drivers/block/nbd.c static int nbd_dev_dbg_init(struct nbd_device *nbd) nbd 1574 drivers/block/nbd.c struct nbd_config *config = nbd->config; nbd 1579 drivers/block/nbd.c dir = debugfs_create_dir(nbd_name(nbd), nbd_dbg_dir); nbd 1581 drivers/block/nbd.c dev_err(nbd_to_dev(nbd), "Failed to create debugfs dir for '%s'\n", nbd 1582 drivers/block/nbd.c nbd_name(nbd)); nbd 1587 drivers/block/nbd.c debugfs_create_file("tasks", 0444, dir, nbd, &nbd_dbg_tasks_ops); nbd 1589 drivers/block/nbd.c debugfs_create_u32("timeout", 0444, dir, &nbd->tag_set.timeout); nbd 1591 drivers/block/nbd.c debugfs_create_file("flags", 0444, dir, nbd, &nbd_dbg_flags_ops); nbd 1596 drivers/block/nbd.c static void nbd_dev_dbg_close(struct nbd_device *nbd) nbd 1598 drivers/block/nbd.c debugfs_remove_recursive(nbd->config->dbg_dir); nbd 1621 drivers/block/nbd.c static int nbd_dev_dbg_init(struct nbd_device *nbd) nbd 1626 drivers/block/nbd.c static void nbd_dev_dbg_close(struct nbd_device *nbd) nbd 1645 drivers/block/nbd.c cmd->nbd = set->driver_data; nbd 1660 drivers/block/nbd.c struct nbd_device *nbd; nbd 1665 drivers/block/nbd.c nbd = kzalloc(sizeof(struct nbd_device), GFP_KERNEL); nbd 1666 drivers/block/nbd.c if (!nbd) nbd 1674 drivers/block/nbd.c err = idr_alloc(&nbd_index_idr, nbd, index, index + 1, nbd 1679 drivers/block/nbd.c err = idr_alloc(&nbd_index_idr, nbd, 0, 0, GFP_KERNEL); nbd 1686 drivers/block/nbd.c nbd->index = index; nbd 1687 drivers/block/nbd.c nbd->disk = disk; nbd 1688 drivers/block/nbd.c nbd->tag_set.ops = &nbd_mq_ops; nbd 1689 drivers/block/nbd.c nbd->tag_set.nr_hw_queues = 1; nbd 1690 drivers/block/nbd.c nbd->tag_set.queue_depth = 128; nbd 1691 drivers/block/nbd.c nbd->tag_set.numa_node = NUMA_NO_NODE; nbd 1692 drivers/block/nbd.c nbd->tag_set.cmd_size = sizeof(struct nbd_cmd); nbd 1693 drivers/block/nbd.c nbd->tag_set.flags = BLK_MQ_F_SHOULD_MERGE | nbd 1695 drivers/block/nbd.c nbd->tag_set.driver_data = nbd; nbd 1696 drivers/block/nbd.c nbd->destroy_complete = NULL; nbd 1698 drivers/block/nbd.c err = blk_mq_alloc_tag_set(&nbd->tag_set); nbd 1702 drivers/block/nbd.c q = blk_mq_init_queue(&nbd->tag_set); nbd 1722 drivers/block/nbd.c mutex_init(&nbd->config_lock); nbd 1723 drivers/block/nbd.c refcount_set(&nbd->config_refs, 0); nbd 1724 drivers/block/nbd.c refcount_set(&nbd->refs, 1); nbd 1725 drivers/block/nbd.c INIT_LIST_HEAD(&nbd->list); nbd 1729 drivers/block/nbd.c disk->private_data = nbd; nbd 1736 drivers/block/nbd.c blk_mq_free_tag_set(&nbd->tag_set); nbd 1742 drivers/block/nbd.c kfree(nbd); nbd 1749 drivers/block/nbd.c struct nbd_device *nbd = ptr; nbd 1752 drivers/block/nbd.c if (!refcount_read(&nbd->config_refs)) { nbd 1753 drivers/block/nbd.c *found = nbd; nbd 1785 drivers/block/nbd.c static int nbd_genl_size_set(struct genl_info *info, struct nbd_device *nbd) nbd 1787 drivers/block/nbd.c struct nbd_config *config = nbd->config; nbd 1805 drivers/block/nbd.c nbd_size_set(nbd, bsize, div64_u64(bytes, bsize)); nbd 1812 drivers/block/nbd.c struct nbd_device *nbd = NULL; nbd 1834 drivers/block/nbd.c ret = idr_for_each(&nbd_index_idr, &find_free_cb, &nbd); nbd 1843 drivers/block/nbd.c nbd = idr_find(&nbd_index_idr, new_index); nbd 1846 drivers/block/nbd.c nbd = idr_find(&nbd_index_idr, index); nbd 1847 drivers/block/nbd.c if (!nbd) { nbd 1854 drivers/block/nbd.c nbd = idr_find(&nbd_index_idr, index); nbd 1857 drivers/block/nbd.c if (!nbd) { nbd 1864 drivers/block/nbd.c if (test_bit(NBD_DESTROY_ON_DISCONNECT, &nbd->flags) && nbd 1865 drivers/block/nbd.c test_bit(NBD_DISCONNECT_REQUESTED, &nbd->flags)) { nbd 1866 drivers/block/nbd.c nbd->destroy_complete = &destroy_complete; nbd 1874 drivers/block/nbd.c if (!refcount_inc_not_zero(&nbd->refs)) { nbd 1884 drivers/block/nbd.c mutex_lock(&nbd->config_lock); nbd 1885 drivers/block/nbd.c if (refcount_read(&nbd->config_refs)) { nbd 1886 drivers/block/nbd.c mutex_unlock(&nbd->config_lock); nbd 1887 drivers/block/nbd.c nbd_put(nbd); nbd 1893 drivers/block/nbd.c if (WARN_ON(nbd->config)) { nbd 1894 drivers/block/nbd.c mutex_unlock(&nbd->config_lock); nbd 1895 drivers/block/nbd.c nbd_put(nbd); nbd 1898 drivers/block/nbd.c config = nbd->config = nbd_alloc_config(); nbd 1899 drivers/block/nbd.c if (!nbd->config) { nbd 1900 drivers/block/nbd.c mutex_unlock(&nbd->config_lock); nbd 1901 drivers/block/nbd.c nbd_put(nbd); nbd 1905 drivers/block/nbd.c refcount_set(&nbd->config_refs, 1); nbd 1908 drivers/block/nbd.c ret = nbd_genl_size_set(info, nbd); nbd 1913 drivers/block/nbd.c nbd_set_cmd_timeout(nbd, nbd 1928 drivers/block/nbd.c set_bit(NBD_DESTROY_ON_DISCONNECT, &nbd->flags); nbd 1931 drivers/block/nbd.c clear_bit(NBD_DESTROY_ON_DISCONNECT, &nbd->flags); nbd 1964 drivers/block/nbd.c ret = nbd_add_socket(nbd, fd, true); nbd 1969 drivers/block/nbd.c ret = nbd_start_device(nbd); nbd 1971 drivers/block/nbd.c mutex_unlock(&nbd->config_lock); nbd 1974 drivers/block/nbd.c refcount_inc(&nbd->config_refs); nbd 1975 drivers/block/nbd.c nbd_connect_reply(info, nbd->index); nbd 1977 drivers/block/nbd.c nbd_config_put(nbd); nbd 1979 drivers/block/nbd.c nbd_put(nbd); nbd 1983 drivers/block/nbd.c static void nbd_disconnect_and_put(struct nbd_device *nbd) nbd 1985 drivers/block/nbd.c mutex_lock(&nbd->config_lock); nbd 1986 drivers/block/nbd.c nbd_disconnect(nbd); nbd 1987 drivers/block/nbd.c nbd_clear_sock(nbd); nbd 1988 drivers/block/nbd.c mutex_unlock(&nbd->config_lock); nbd 1994 drivers/block/nbd.c flush_workqueue(nbd->recv_workq); nbd 1996 drivers/block/nbd.c &nbd->config->runtime_flags)) nbd 1997 drivers/block/nbd.c nbd_config_put(nbd); nbd 2002 drivers/block/nbd.c struct nbd_device *nbd; nbd 2014 drivers/block/nbd.c nbd = idr_find(&nbd_index_idr, index); nbd 2015 drivers/block/nbd.c if (!nbd) { nbd 2021 drivers/block/nbd.c if (!refcount_inc_not_zero(&nbd->refs)) { nbd 2028 drivers/block/nbd.c if (!refcount_inc_not_zero(&nbd->config_refs)) { nbd 2029 drivers/block/nbd.c nbd_put(nbd); nbd 2032 drivers/block/nbd.c nbd_disconnect_and_put(nbd); nbd 2033 drivers/block/nbd.c nbd_config_put(nbd); nbd 2034 drivers/block/nbd.c nbd_put(nbd); nbd 2040 drivers/block/nbd.c struct nbd_device *nbd = NULL; nbd 2055 drivers/block/nbd.c nbd = idr_find(&nbd_index_idr, index); nbd 2056 drivers/block/nbd.c if (!nbd) { nbd 2062 drivers/block/nbd.c if (!refcount_inc_not_zero(&nbd->refs)) { nbd 2070 drivers/block/nbd.c if (!refcount_inc_not_zero(&nbd->config_refs)) { nbd 2071 drivers/block/nbd.c dev_err(nbd_to_dev(nbd), nbd 2073 drivers/block/nbd.c nbd_put(nbd); nbd 2077 drivers/block/nbd.c mutex_lock(&nbd->config_lock); nbd 2078 drivers/block/nbd.c config = nbd->config; nbd 2080 drivers/block/nbd.c !nbd->task_recv) { nbd 2081 drivers/block/nbd.c dev_err(nbd_to_dev(nbd), nbd 2087 drivers/block/nbd.c ret = nbd_genl_size_set(info, nbd); nbd 2092 drivers/block/nbd.c nbd_set_cmd_timeout(nbd, nbd 2105 drivers/block/nbd.c set_bit(NBD_DESTROY_ON_DISCONNECT, &nbd->flags); nbd 2109 drivers/block/nbd.c refcount_inc(&nbd->refs); nbd 2110 drivers/block/nbd.c clear_bit(NBD_DESTROY_ON_DISCONNECT, &nbd->flags); nbd 2147 drivers/block/nbd.c ret = nbd_reconnect_socket(nbd, fd); nbd 2153 drivers/block/nbd.c dev_info(nbd_to_dev(nbd), "reconnected socket\n"); nbd 2157 drivers/block/nbd.c mutex_unlock(&nbd->config_lock); nbd 2158 drivers/block/nbd.c nbd_config_put(nbd); nbd 2159 drivers/block/nbd.c nbd_put(nbd); nbd 2161 drivers/block/nbd.c nbd_put(nbd); nbd 2205 drivers/block/nbd.c static int populate_nbd_status(struct nbd_device *nbd, struct sk_buff *reply) nbd 2218 drivers/block/nbd.c if (refcount_read(&nbd->config_refs)) nbd 2223 drivers/block/nbd.c ret = nla_put_u32(reply, NBD_DEVICE_INDEX, nbd->index); nbd 2236 drivers/block/nbd.c struct nbd_device *nbd = ptr; nbd 2237 drivers/block/nbd.c return populate_nbd_status(nbd, (struct sk_buff *)data); nbd 2276 drivers/block/nbd.c struct nbd_device *nbd; nbd 2277 drivers/block/nbd.c nbd = idr_find(&nbd_index_idr, index); nbd 2278 drivers/block/nbd.c if (nbd) { nbd 2279 drivers/block/nbd.c ret = populate_nbd_status(nbd, reply); nbd 2401 drivers/block/nbd.c struct nbd_device *nbd = ptr; nbd 2403 drivers/block/nbd.c list_add_tail(&nbd->list, list); nbd 2409 drivers/block/nbd.c struct nbd_device *nbd; nbd 2419 drivers/block/nbd.c nbd = list_first_entry(&del_list, struct nbd_device, list); nbd 2420 drivers/block/nbd.c list_del_init(&nbd->list); nbd 2421 drivers/block/nbd.c if (refcount_read(&nbd->refs) != 1) nbd 2423 drivers/block/nbd.c nbd_put(nbd); nbd 203 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c int nbd; nbd 214 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c nbd = le16_to_cpu(tx_start_bd->nbd) - 1; nbd 216 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c if ((nbd - 1) > (MAX_SKB_FRAGS + 2)) { nbd 221 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c new_cons = nbd + tx_buf->first_bd; nbd 227 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c --nbd; nbd 232 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c --nbd; nbd 240 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c --nbd; nbd 250 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c while (nbd > 0) { nbd 255 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c if (--nbd) nbd 3747 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c int nbd, txq_index; nbd 3922 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c nbd = 2; /* start_bd + pbd + frags (updated when pages are mapped) */ nbd 3969 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c nbd++; nbd 4048 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c nbd++; nbd 4087 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c first_bd->nbd = cpu_to_le16(nbd); nbd 4103 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c nbd++; nbd 4114 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c first_bd->nbd = cpu_to_le16(nbd); nbd 4121 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c if (TX_BD_POFF(bd_prod) < nbd) nbd 4122 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c nbd++; nbd 4152 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c DP(NETIF_MSG_TX_QUEUED, "doorbell: nbd %d bd %u\n", nbd, bd_prod); nbd 4168 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c txdata->tx_db.data.prod += nbd; nbd 4174 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c txdata->tx_bd_prod += nbd; nbd 2591 drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c tx_start_bd->nbd = cpu_to_le16(2); /* start + pbd */ nbd 4498 drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h __le16 nbd; nbd 4945 drivers/net/ethernet/broadcom/cnic.c start_bd->nbd = cpu_to_le16(3); nbd 157 drivers/net/ethernet/qlogic/qede/qede_fp.c int nbd, bool data_split) nbd 174 drivers/net/ethernet/qlogic/qede/qede_fp.c nbd--; nbd 181 drivers/net/ethernet/qlogic/qede/qede_fp.c for (i = 0; i < nbd; i++) { nbd 1439 drivers/net/ethernet/qlogic/qede/qede_fp.c u8 nbd = 0; nbd 1489 drivers/net/ethernet/qlogic/qede/qede_fp.c nbd++; nbd 1500 drivers/net/ethernet/qlogic/qede/qede_fp.c nbd++; nbd 1505 drivers/net/ethernet/qlogic/qede/qede_fp.c nbd++; nbd 1613 drivers/net/ethernet/qlogic/qede/qede_fp.c qede_free_failed_tx_pkt(txq, first_bd, nbd, data_split); nbd 1627 drivers/net/ethernet/qlogic/qede/qede_fp.c for (; frag_idx < skb_shinfo(skb)->nr_frags; frag_idx++, nbd++) { nbd 1637 drivers/net/ethernet/qlogic/qede/qede_fp.c qede_free_failed_tx_pkt(txq, first_bd, nbd, data_split); nbd 1644 drivers/net/ethernet/qlogic/qede/qede_fp.c first_bd->data.nbds = nbd; nbd 3 include/trace/events/nbd.h #define TRACE_SYSTEM nbd