From nobody Wed Oct 8 02:05:53 2025 Received: from baidu.com (mx24.baidu.com [111.206.215.185]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E145B291C3B; Thu, 3 Jul 2025 06:48:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=111.206.215.185 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751525307; cv=none; b=f/YOwBsMj9Fju7XNHRqU/hHf36FhU4GXzrw918Z7L5gJrdEHCWshW8Lsnm63I0CxMWSGz08xjrOhAdcd/gPh5QxgKh8pd3ANtR+Lya5PSxpYC2txyOszsfKFh4gd+C9B5vDVdeUN5QDmU8H81muuZaeWa7+HkrgHMm3tR4ApcsY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751525307; c=relaxed/simple; bh=LnsEpGxDtvoAsm6ceZ7Zgj8qH0jfanHvQzlEfk/g9iU=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=VIEeFqRdwoNh5/ffWKtEK07h0pFaDd6P5nOhZhulRhLe0qCVW+mGDt/nJxH8hd9XAvFkMZUjTHpb5X2fmsDYIjXM/+f46Lq7OEx2m5HpqS21Ud2UdrY/NgkBtx9ETW1H79/23LHiAbegEflJvgUCCHNH7qO7XFqpHvWipibBEAE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=baidu.com; spf=pass smtp.mailfrom=baidu.com; arc=none smtp.client-ip=111.206.215.185 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=baidu.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baidu.com From: lirongqing To: , , , , , , CC: Li RongQing , Fushuai Wang Subject: [PATCH] virtio_fs: fix the hash table using in virtio_fs_enqueue_req() Date: Thu, 3 Jul 2025 14:47:38 +0800 Message-ID: <20250703064738.2631-1-lirongqing@baidu.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: bjkjy-exc14.internal.baidu.com (172.31.51.14) To bjkjy-exc3.internal.baidu.com (172.31.50.47) X-FEAS-Client-IP: 172.31.50.41 X-FE-Policy-ID: 52:10:53:SYSTEM Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Li RongQing The original commit be2ff42c5d6e ("fuse: Use hash table to link processing request") converted fuse_pqueue->processing to a hash table, but virtio_fs_enqueue_req() was not updated to use it correctly. So use fuse_pqueue->processing as a hash table, this make the code more coherent Co-developed-by: Fushuai Wang Signed-off-by: Fushuai Wang Signed-off-by: Li RongQing Reviewed-by: Stefan Hajnoczi --- fs/fuse/dev.c | 1 + fs/fuse/virtio_fs.c | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index e80cd8f..4659bc8 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -322,6 +322,7 @@ unsigned int fuse_req_hash(u64 unique) { return hash_long(unique & ~FUSE_INT_REQ_BIT, FUSE_PQ_HASH_BITS); } +EXPORT_SYMBOL_GPL(fuse_req_hash); =20 /* * A new request is available, wake fiq->waitq diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c index b8a99d3..d050470 100644 --- a/fs/fuse/virtio_fs.c +++ b/fs/fuse/virtio_fs.c @@ -21,6 +21,7 @@ #include #include #include "fuse_i.h" +#include "fuse_dev_i.h" =20 /* Used to help calculate the FUSE connection's max_pages limit for a requ= est's * size. Parts of the struct fuse_req are sliced into scattergather lists = in @@ -1382,7 +1383,7 @@ static int virtio_fs_enqueue_req(struct virtio_fs_vq = *fsvq, unsigned int out_sgs =3D 0; unsigned int in_sgs =3D 0; unsigned int total_sgs; - unsigned int i; + unsigned int i, hash; int ret; bool notify; struct fuse_pqueue *fpq; @@ -1442,8 +1443,9 @@ static int virtio_fs_enqueue_req(struct virtio_fs_vq = *fsvq, =20 /* Request successfully sent. */ fpq =3D &fsvq->fud->pq; + hash =3D fuse_req_hash(req->in.h.unique); spin_lock(&fpq->lock); - list_add_tail(&req->list, fpq->processing); + list_add_tail(&req->list, &fpq->processing[hash]); spin_unlock(&fpq->lock); set_bit(FR_SENT, &req->flags); /* matches barrier in request_wait_answer() */ --=20 2.9.4