Lines Matching refs:fs

154 	struct virtio_fs *fs = vq->vdev->priv;  in vq_to_fsvq()  local
156 return &fs->vqs[vq->index]; in vq_to_fsvq()
177 struct virtio_fs *fs = container_of(kobj, struct virtio_fs, kobj); in tag_show() local
179 return sysfs_emit(buf, "%s\n", fs->tag); in tag_show()
205 static struct virtio_fs_vq *virtio_fs_kobj_to_vq(struct virtio_fs *fs, in virtio_fs_kobj_to_vq() argument
210 for (i = 0; i < fs->nvqs; i++) { in virtio_fs_kobj_to_vq()
211 if (kobj == fs->vqs[i].kobj) in virtio_fs_kobj_to_vq()
212 return &fs->vqs[i]; in virtio_fs_kobj_to_vq()
220 struct virtio_fs *fs = container_of(kobj->parent->parent, struct virtio_fs, kobj); in name_show() local
221 struct virtio_fs_vq *fsvq = virtio_fs_kobj_to_vq(fs, kobj); in name_show()
233 struct virtio_fs *fs = container_of(kobj->parent->parent, struct virtio_fs, kobj); in cpu_list_show() local
234 struct virtio_fs_vq *fsvq = virtio_fs_kobj_to_vq(fs, kobj); in cpu_list_show()
245 if (qid < VQ_REQUEST || (fs->mq_map[cpu] == qid - VQ_REQUEST)) { in cpu_list_show()
274 static void virtio_fs_put_locked(struct virtio_fs *fs) in virtio_fs_put_locked() argument
278 kobject_put(&fs->kobj); in virtio_fs_put_locked()
281 static void virtio_fs_put(struct virtio_fs *fs) in virtio_fs_put() argument
284 virtio_fs_put_locked(fs); in virtio_fs_put()
316 static void virtio_fs_drain_all_queues_locked(struct virtio_fs *fs) in virtio_fs_drain_all_queues_locked() argument
321 for (i = 0; i < fs->nvqs; i++) { in virtio_fs_drain_all_queues_locked()
322 fsvq = &fs->vqs[i]; in virtio_fs_drain_all_queues_locked()
327 static void virtio_fs_drain_all_queues(struct virtio_fs *fs) in virtio_fs_drain_all_queues() argument
336 virtio_fs_drain_all_queues_locked(fs); in virtio_fs_drain_all_queues()
340 static void virtio_fs_start_all_queues(struct virtio_fs *fs) in virtio_fs_start_all_queues() argument
345 for (i = 0; i < fs->nvqs; i++) { in virtio_fs_start_all_queues()
346 fsvq = &fs->vqs[i]; in virtio_fs_start_all_queues()
353 static void virtio_fs_delete_queues_sysfs(struct virtio_fs *fs) in virtio_fs_delete_queues_sysfs() argument
358 for (i = 0; i < fs->nvqs; i++) { in virtio_fs_delete_queues_sysfs()
359 fsvq = &fs->vqs[i]; in virtio_fs_delete_queues_sysfs()
364 static int virtio_fs_add_queues_sysfs(struct virtio_fs *fs) in virtio_fs_add_queues_sysfs() argument
370 for (i = 0; i < fs->nvqs; i++) { in virtio_fs_add_queues_sysfs()
371 fsvq = &fs->vqs[i]; in virtio_fs_add_queues_sysfs()
374 fsvq->kobj = kobject_create_and_add(buff, fs->mqs_kobj); in virtio_fs_add_queues_sysfs()
375 if (!fs->mqs_kobj) { in virtio_fs_add_queues_sysfs()
391 fsvq = &fs->vqs[j]; in virtio_fs_add_queues_sysfs()
399 struct virtio_fs *fs) in virtio_fs_add_instance() argument
407 if (strcmp(fs->tag, fs2->tag) == 0) { in virtio_fs_add_instance()
418 fs->kobj.kset = virtio_fs_kset; in virtio_fs_add_instance()
419 ret = kobject_add(&fs->kobj, NULL, "%d", vdev->index); in virtio_fs_add_instance()
423 fs->mqs_kobj = kobject_create_and_add("mqs", &fs->kobj); in virtio_fs_add_instance()
424 if (!fs->mqs_kobj) { in virtio_fs_add_instance()
429 ret = sysfs_create_link(&fs->kobj, &vdev->dev.kobj, "device"); in virtio_fs_add_instance()
433 ret = virtio_fs_add_queues_sysfs(fs); in virtio_fs_add_instance()
437 list_add_tail(&fs->list, &virtio_fs_instances); in virtio_fs_add_instance()
441 kobject_uevent(&fs->kobj, KOBJ_ADD); in virtio_fs_add_instance()
446 sysfs_remove_link(&fs->kobj, "device"); in virtio_fs_add_instance()
448 kobject_put(fs->mqs_kobj); in virtio_fs_add_instance()
450 kobject_del(&fs->kobj); in virtio_fs_add_instance()
459 struct virtio_fs *fs; in virtio_fs_find_instance() local
463 list_for_each_entry(fs, &virtio_fs_instances, list) { in virtio_fs_find_instance()
464 if (strcmp(fs->tag, tag) == 0) { in virtio_fs_find_instance()
465 kobject_get(&fs->kobj); in virtio_fs_find_instance()
470 fs = NULL; /* not found */ in virtio_fs_find_instance()
475 return fs; in virtio_fs_find_instance()
478 static void virtio_fs_free_devs(struct virtio_fs *fs) in virtio_fs_free_devs() argument
482 for (i = 0; i < fs->nvqs; i++) { in virtio_fs_free_devs()
483 struct virtio_fs_vq *fsvq = &fs->vqs[i]; in virtio_fs_free_devs()
494 static int virtio_fs_read_tag(struct virtio_device *vdev, struct virtio_fs *fs) in virtio_fs_read_tag() argument
509 fs->tag = devm_kmalloc(&vdev->dev, len + 1, GFP_KERNEL); in virtio_fs_read_tag()
510 if (!fs->tag) in virtio_fs_read_tag()
512 memcpy(fs->tag, tag_buf, len); in virtio_fs_read_tag()
513 fs->tag[len] = '\0'; in virtio_fs_read_tag()
519 if (strchr(fs->tag, '\n')) { in virtio_fs_read_tag()
856 static void virtio_fs_map_queues(struct virtio_device *vdev, struct virtio_fs *fs) in virtio_fs_map_queues() argument
867 for (q = 0; q < fs->num_request_queues; q++) { in virtio_fs_map_queues()
873 fs->mq_map[cpu] = q; in virtio_fs_map_queues()
879 masks = group_cpus_evenly(fs->num_request_queues); in virtio_fs_map_queues()
883 fs->mq_map[cpu] = 0; in virtio_fs_map_queues()
887 for (q = 0; q < fs->num_request_queues; q++) { in virtio_fs_map_queues()
889 fs->mq_map[cpu] = q; in virtio_fs_map_queues()
926 struct virtio_fs *fs) in virtio_fs_setup_vqs() argument
939 &fs->num_request_queues); in virtio_fs_setup_vqs()
940 if (fs->num_request_queues == 0) in virtio_fs_setup_vqs()
944 fs->num_request_queues = min_t(unsigned int, fs->num_request_queues, in virtio_fs_setup_vqs()
946 fs->nvqs = VQ_REQUEST + fs->num_request_queues; in virtio_fs_setup_vqs()
947 fs->vqs = kcalloc(fs->nvqs, sizeof(fs->vqs[VQ_HIPRIO]), GFP_KERNEL); in virtio_fs_setup_vqs()
948 if (!fs->vqs) in virtio_fs_setup_vqs()
951 vqs = kmalloc_array(fs->nvqs, sizeof(vqs[VQ_HIPRIO]), GFP_KERNEL); in virtio_fs_setup_vqs()
952 fs->mq_map = kcalloc_node(nr_cpu_ids, sizeof(*fs->mq_map), GFP_KERNEL, in virtio_fs_setup_vqs()
954 vqs_info = kcalloc(fs->nvqs, sizeof(*vqs_info), GFP_KERNEL); in virtio_fs_setup_vqs()
955 if (!vqs || !vqs_info || !fs->mq_map) { in virtio_fs_setup_vqs()
962 virtio_fs_init_vq(&fs->vqs[VQ_HIPRIO], "hiprio", VQ_HIPRIO); in virtio_fs_setup_vqs()
963 vqs_info[VQ_HIPRIO].name = fs->vqs[VQ_HIPRIO].name; in virtio_fs_setup_vqs()
966 for (i = VQ_REQUEST; i < fs->nvqs; i++) { in virtio_fs_setup_vqs()
970 virtio_fs_init_vq(&fs->vqs[i], vq_name, VQ_REQUEST); in virtio_fs_setup_vqs()
972 vqs_info[i].name = fs->vqs[i].name; in virtio_fs_setup_vqs()
975 ret = virtio_find_vqs(vdev, fs->nvqs, vqs, vqs_info, &desc); in virtio_fs_setup_vqs()
979 for (i = 0; i < fs->nvqs; i++) in virtio_fs_setup_vqs()
980 fs->vqs[i].vq = vqs[i]; in virtio_fs_setup_vqs()
982 virtio_fs_start_all_queues(fs); in virtio_fs_setup_vqs()
987 kfree(fs->vqs); in virtio_fs_setup_vqs()
988 kfree(fs->mq_map); in virtio_fs_setup_vqs()
1007 struct virtio_fs *fs = dax_get_private(dax_dev); in virtio_fs_direct_access() local
1009 size_t max_nr_pages = fs->window_len / PAGE_SIZE - pgoff; in virtio_fs_direct_access()
1012 *kaddr = fs->window_kaddr + offset; in virtio_fs_direct_access()
1014 *pfn = phys_to_pfn_t(fs->window_phys_addr + offset, in virtio_fs_direct_access()
1050 static int virtio_fs_setup_dax(struct virtio_device *vdev, struct virtio_fs *fs) in virtio_fs_setup_dax() argument
1060 dax_dev = alloc_dax(fs, &virtio_fs_dax_ops); in virtio_fs_setup_dax()
1101 fs->window_kaddr = devm_memremap_pages(&vdev->dev, pgmap); in virtio_fs_setup_dax()
1102 if (IS_ERR(fs->window_kaddr)) in virtio_fs_setup_dax()
1103 return PTR_ERR(fs->window_kaddr); in virtio_fs_setup_dax()
1105 fs->window_phys_addr = (phys_addr_t) cache_reg.addr; in virtio_fs_setup_dax()
1106 fs->window_len = (phys_addr_t) cache_reg.len; in virtio_fs_setup_dax()
1109 __func__, fs->window_kaddr, cache_reg.addr, cache_reg.len); in virtio_fs_setup_dax()
1111 fs->dax_dev = no_free_ptr(dax_dev); in virtio_fs_setup_dax()
1113 fs->dax_dev); in virtio_fs_setup_dax()
1118 struct virtio_fs *fs; in virtio_fs_probe() local
1121 fs = kzalloc(sizeof(*fs), GFP_KERNEL); in virtio_fs_probe()
1122 if (!fs) in virtio_fs_probe()
1124 kobject_init(&fs->kobj, &virtio_fs_ktype); in virtio_fs_probe()
1125 vdev->priv = fs; in virtio_fs_probe()
1127 ret = virtio_fs_read_tag(vdev, fs); in virtio_fs_probe()
1131 ret = virtio_fs_setup_vqs(vdev, fs); in virtio_fs_probe()
1135 virtio_fs_map_queues(vdev, fs); in virtio_fs_probe()
1137 ret = virtio_fs_setup_dax(vdev, fs); in virtio_fs_probe()
1146 ret = virtio_fs_add_instance(vdev, fs); in virtio_fs_probe()
1158 kobject_put(&fs->kobj); in virtio_fs_probe()
1162 static void virtio_fs_stop_all_queues(struct virtio_fs *fs) in virtio_fs_stop_all_queues() argument
1167 for (i = 0; i < fs->nvqs; i++) { in virtio_fs_stop_all_queues()
1168 fsvq = &fs->vqs[i]; in virtio_fs_stop_all_queues()
1177 struct virtio_fs *fs = vdev->priv; in virtio_fs_remove() local
1181 list_del_init(&fs->list); in virtio_fs_remove()
1182 virtio_fs_delete_queues_sysfs(fs); in virtio_fs_remove()
1183 sysfs_remove_link(&fs->kobj, "device"); in virtio_fs_remove()
1184 kobject_put(fs->mqs_kobj); in virtio_fs_remove()
1185 kobject_del(&fs->kobj); in virtio_fs_remove()
1186 virtio_fs_stop_all_queues(fs); in virtio_fs_remove()
1187 virtio_fs_drain_all_queues_locked(fs); in virtio_fs_remove()
1193 virtio_fs_put_locked(fs); in virtio_fs_remove()
1236 struct virtio_fs *fs = fiq->priv; in virtio_fs_send_forget() local
1237 struct virtio_fs_vq *fsvq = &fs->vqs[VQ_HIPRIO]; in virtio_fs_send_forget()
1474 struct virtio_fs *fs; in virtio_fs_send_req() local
1483 fs = fiq->priv; in virtio_fs_send_req()
1484 queue_id = VQ_REQUEST + fs->mq_map[raw_smp_processor_id()]; in virtio_fs_send_req()
1492 fsvq = &fs->vqs[queue_id]; in virtio_fs_send_req()
1541 struct virtio_fs *fs = fc->iq.priv; in virtio_fs_fill_super() local
1554 if (list_empty(&fs->list)) { in virtio_fs_fill_super()
1555 pr_info("virtio-fs: tag <%s> not found\n", fs->tag); in virtio_fs_fill_super()
1561 for (i = 0; i < fs->nvqs; i++) { in virtio_fs_fill_super()
1562 struct virtio_fs_vq *fsvq = &fs->vqs[i]; in virtio_fs_fill_super()
1572 if (ctx->dax_mode == FUSE_DAX_ALWAYS && !fs->dax_dev) { in virtio_fs_fill_super()
1578 ctx->dax_dev = fs->dax_dev; in virtio_fs_fill_super()
1584 for (i = 0; i < fs->nvqs; i++) { in virtio_fs_fill_super()
1585 struct virtio_fs_vq *fsvq = &fs->vqs[i]; in virtio_fs_fill_super()
1591 virtio_fs_start_all_queues(fs); in virtio_fs_fill_super()
1597 virtio_fs_free_devs(fs); in virtio_fs_fill_super()
1659 struct virtio_fs *fs; in virtio_fs_get_tree() local
1670 fs = virtio_fs_find_instance(fsc->source); in virtio_fs_get_tree()
1671 if (!fs) { in virtio_fs_get_tree()
1676 virtqueue_size = virtqueue_get_vring_size(fs->vqs[VQ_REQUEST].vq); in virtio_fs_get_tree()
1689 fuse_conn_init(fc, fm, fsc->user_ns, &virtio_fs_fiq_ops, fs); in virtio_fs_get_tree()
1722 virtio_fs_put(fs); in virtio_fs_get_tree()
1757 const struct virtio_fs *fs = container_of(kobj, struct virtio_fs, kobj); in virtio_fs_uevent() local
1759 add_uevent_var(env, "TAG=%s", fs->tag); in virtio_fs_uevent()