Skip to content

Commit df28040

Browse files
mgurtovoymstsirkin
authored andcommitted
virtio_fs: store actual queue index in mq_map
This will eliminate the need for index recalculation during the fast path. Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com> Message-Id: <20241006184341.9081-1-mgurtovoy@nvidia.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
1 parent 22d984f commit df28040

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

fs/fuse/virtio_fs.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ static ssize_t cpu_list_show(struct kobject *kobj,
242242

243243
qid = fsvq->vq->index;
244244
for (cpu = 0; cpu < nr_cpu_ids; cpu++) {
245-
if (qid < VQ_REQUEST || (fs->mq_map[cpu] == qid - VQ_REQUEST)) {
245+
if (qid < VQ_REQUEST || (fs->mq_map[cpu] == qid)) {
246246
if (first)
247247
ret = snprintf(buf + pos, size - pos, "%u", cpu);
248248
else
@@ -871,23 +871,23 @@ static void virtio_fs_map_queues(struct virtio_device *vdev, struct virtio_fs *f
871871
goto fallback;
872872

873873
for_each_cpu(cpu, mask)
874-
fs->mq_map[cpu] = q;
874+
fs->mq_map[cpu] = q + VQ_REQUEST;
875875
}
876876

877877
return;
878878
fallback:
879879
/* Attempt to map evenly in groups over the CPUs */
880880
masks = group_cpus_evenly(fs->num_request_queues);
881-
/* If even this fails we default to all CPUs use queue zero */
881+
/* If even this fails we default to all CPUs use first request queue */
882882
if (!masks) {
883883
for_each_possible_cpu(cpu)
884-
fs->mq_map[cpu] = 0;
884+
fs->mq_map[cpu] = VQ_REQUEST;
885885
return;
886886
}
887887

888888
for (q = 0; q < fs->num_request_queues; q++) {
889889
for_each_cpu(cpu, &masks[q])
890-
fs->mq_map[cpu] = q;
890+
fs->mq_map[cpu] = q + VQ_REQUEST;
891891
}
892892
kfree(masks);
893893
}
@@ -1482,7 +1482,7 @@ static void virtio_fs_send_req(struct fuse_iqueue *fiq, struct fuse_req *req)
14821482
clear_bit(FR_PENDING, &req->flags);
14831483

14841484
fs = fiq->priv;
1485-
queue_id = VQ_REQUEST + fs->mq_map[raw_smp_processor_id()];
1485+
queue_id = fs->mq_map[raw_smp_processor_id()];
14861486

14871487
pr_debug("%s: opcode %u unique %#llx nodeid %#llx in.len %u out.len %u queue_id %u\n",
14881488
__func__, req->in.h.opcode, req->in.h.unique,

0 commit comments

Comments
 (0)