From nobody Sat Nov 23 21:44:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1731276110; cv=none; d=zohomail.com; s=zohoarc; b=eN52v2NxsWANcFMEX8Amnwofg67RtbegbCwIssxUa/2D23GfgWKgi3+GPTya/DAFM3+wHqCCyG1RJ3tVObvbnC0+k4s1a2G7STNVXbLa6KfLZ2KYfL1Tq6WL/Y6nlPUs4oH4jIMxQdRty+QyCehWYDwykunxchGfuq1vERf6e64= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731276110; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=gAKddM5nbaKYo+JyrHvT71KySzTBNvFz5xcX/3O7Las=; b=OSiKSnaBvVWUxsyUgrPeLAabUu46FYJLoKtL1+oNGUC2qNsjru2V6l/MZrFopXXUTXxTddJclP6AeBcCSUGsFSRfmXodlP5xpuAVArYLoePRfBC05l5WwDkTp9MzWWhzHkhHF5XJyper7aKvawNZwIr+hYDcKD5iAU19yI4t9Nc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731276110003673.0252905218698; Sun, 10 Nov 2024 14:01:50 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tAFuZ-00041D-Po; Sun, 10 Nov 2024 16:55:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tAFuX-000402-PE for qemu-devel@nongnu.org; Sun, 10 Nov 2024 16:55:57 -0500 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tAFuV-00046A-Dx for qemu-devel@nongnu.org; Sun, 10 Nov 2024 16:55:57 -0500 Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-5c941623a5aso8750544a12.0 for ; Sun, 10 Nov 2024 13:55:55 -0800 (PST) Received: from localhost.localdomain (h082218084190.host.wavenet.at. [82.218.84.190]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9ee0e2f731sm523715566b.189.2024.11.10.13.55.52 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 10 Nov 2024 13:55:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=philjordan-eu.20230601.gappssmtp.com; s=20230601; t=1731275754; x=1731880554; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gAKddM5nbaKYo+JyrHvT71KySzTBNvFz5xcX/3O7Las=; b=1KpxwJENpOPeKi6LHYF5RHAzk1L5uYB3XXjVMK4hZf9b4E+JmDWB0EHVS3NWEfJYIN WHMRDi0mqy+kIXypY622ZBa1VhsOq43LlxzFRC6TzJkRMTwhEOmC7Y6fxbVNyTVO0lJS jAFl0UqkNNyZsV7e2Mb3th6VUuGLjBctAksCSrXGV8lV8KIMiYaCZowecmOOgXiMNKOT 4noqOMFEzmymwVbrp1stwZqOPnKrv/CYk+sq7zDFnPeFLzJtK8mY1dK0TpYIOPcbjYgi 6KMCepdLAi/1jj3JPDqbKSPEHWiv+zp5PYUR5KN7nVIQeJChhrQXyHMRYfUKoFhlRV9D tX5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731275754; x=1731880554; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gAKddM5nbaKYo+JyrHvT71KySzTBNvFz5xcX/3O7Las=; b=W8gw5uGzOENvcnFqar/C4L0Gi5x2dUj6ea6IZWvN+tXfz2XuRScynnql4xeYeAqCsj aCQTJ4l22b8wuY7LqsCmIpVjoBa06bw2kMKPnDP20eNyermVwt74v570AN/WGUBSG2tu jREvdXBhEKc4bwh7Jm5VUUhmO8vXxaEtLp5R9ygKLV6yge3Cj/jmD/BuwAjyP8ddZpzm KjxtK+4RtfSmjpDsYbRBia8VpVjYT6G6QdqtTRmjt8WSn64FvhDEBhjIVhGD0eNFqg8Q dGviCF4fhOmkRF5MCCSArmlE6WDq1+aCFPNnUcQG0GC8+O3fQWtF0u/8JJSZXe8/Ou3U 4zoQ== X-Gm-Message-State: AOJu0Ywu31P6z1XTOOophnd0vTolbIcTSDinZPqWVthu30mBliB0gA2K H21KBgIrQS365suDOn8E8chxLLc1beMDE5G5VfXRLq4g2EbCLBac7Xlh63LZPeQnkh30ZhOvxdT tGA== X-Google-Smtp-Source: AGHT+IGo7uJ3hxRgIjK5JsN/lz8kc+cz2fkfz+OZKHv4xkNeySIa6UFGA2IdChcWQDWxGKCafpd6eg== X-Received: by 2002:a17:907:3e29:b0:a9a:f19:8c2a with SMTP id a640c23a62f3a-a9eec764f79mr1151822366b.6.1731275753914; Sun, 10 Nov 2024 13:55:53 -0800 (PST) From: Phil Dennis-Jordan To: qemu-devel@nongnu.org Cc: agraf@csgraf.de, phil@philjordan.eu, peter.maydell@linaro.org, pbonzini@redhat.com, rad@semihalf.com, quic_llindhol@quicinc.com, stefanha@redhat.com, mst@redhat.com, slp@redhat.com, richard.henderson@linaro.org, eduardo@habkost.net, marcel.apfelbaum@gmail.com, gaosong@loongson.cn, jiaxun.yang@flygoat.com, chenhuacai@kernel.org, kwolf@redhat.com, hreitz@redhat.com, philmd@linaro.org, shorne@gmail.com, palmer@dabbelt.com, alistair.francis@wdc.com, bmeng.cn@gmail.com, liwei1518@gmail.com, dbarboza@ventanamicro.com, zhiwei_liu@linux.alibaba.com, jcmvbkbc@gmail.com, marcandre.lureau@redhat.com, berrange@redhat.com, akihiko.odaki@daynix.com, qemu-arm@nongnu.org, qemu-block@nongnu.org, qemu-riscv@nongnu.org Subject: [PATCH v9 14/16] hw/block/virtio-blk: Replaces request free function with g_free Date: Sun, 10 Nov 2024 22:55:17 +0100 Message-Id: <20241110215519.49150-15-phil@philjordan.eu> X-Mailer: git-send-email 2.39.3 (Apple Git-145) In-Reply-To: <20241110215519.49150-1-phil@philjordan.eu> References: <20241110215519.49150-1-phil@philjordan.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: neutral client-ip=2a00:1450:4864:20::52e; envelope-from=phil@philjordan.eu; helo=mail-ed1-x52e.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NEUTRAL=0.779 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @philjordan-eu.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1731276111598116600 Content-Type: text/plain; charset="utf-8" The virtio_blk_free_request() function has been a 1-liner forwarding to g_free() for a while now. We may as well call g_free on the request pointer directly. Signed-off-by: Phil Dennis-Jordan Reviewed-by: Akihiko Odaki --- hw/block/virtio-blk.c | 43 +++++++++++++++------------------- hw/vmapple/virtio-blk.c | 2 +- include/hw/virtio/virtio-blk.h | 1 - 3 files changed, 20 insertions(+), 26 deletions(-) diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 9e8337bb639..40d2c9bc591 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -50,11 +50,6 @@ static void virtio_blk_init_request(VirtIOBlock *s, Virt= Queue *vq, req->mr_next =3D NULL; } =20 -void virtio_blk_free_request(VirtIOBlockReq *req) -{ - g_free(req); -} - void virtio_blk_req_complete(VirtIOBlockReq *req, unsigned char status) { VirtIOBlock *s =3D req->dev; @@ -93,7 +88,7 @@ static int virtio_blk_handle_rw_error(VirtIOBlockReq *req= , int error, if (acct_failed) { block_acct_failed(blk_get_stats(s->blk), &req->acct); } - virtio_blk_free_request(req); + g_free(req); } =20 blk_error_action(s->blk, action, is_read, error); @@ -136,7 +131,7 @@ static void virtio_blk_rw_complete(void *opaque, int re= t) =20 virtio_blk_req_complete(req, VIRTIO_BLK_S_OK); block_acct_done(blk_get_stats(s->blk), &req->acct); - virtio_blk_free_request(req); + g_free(req); } } =20 @@ -151,7 +146,7 @@ static void virtio_blk_flush_complete(void *opaque, int= ret) =20 virtio_blk_req_complete(req, VIRTIO_BLK_S_OK); block_acct_done(blk_get_stats(s->blk), &req->acct); - virtio_blk_free_request(req); + g_free(req); } =20 static void virtio_blk_discard_write_zeroes_complete(void *opaque, int ret) @@ -169,7 +164,7 @@ static void virtio_blk_discard_write_zeroes_complete(vo= id *opaque, int ret) if (is_write_zeroes) { block_acct_done(blk_get_stats(s->blk), &req->acct); } - virtio_blk_free_request(req); + g_free(req); } =20 static VirtIOBlockReq *virtio_blk_get_request(VirtIOBlock *s, VirtQueue *v= q) @@ -214,7 +209,7 @@ static void virtio_blk_handle_scsi(VirtIOBlockReq *req) =20 fail: virtio_blk_req_complete(req, status); - virtio_blk_free_request(req); + g_free(req); } =20 static inline void submit_requests(VirtIOBlock *s, MultiReqBuffer *mrb, @@ -612,7 +607,7 @@ static void virtio_blk_zone_report_complete(void *opaqu= e, int ret) =20 out: virtio_blk_req_complete(req, err_status); - virtio_blk_free_request(req); + g_free(req); g_free(data->zone_report_data.zones); g_free(data); } @@ -661,7 +656,7 @@ static void virtio_blk_handle_zone_report(VirtIOBlockRe= q *req, return; out: virtio_blk_req_complete(req, err_status); - virtio_blk_free_request(req); + g_free(req); } =20 static void virtio_blk_zone_mgmt_complete(void *opaque, int ret) @@ -677,7 +672,7 @@ static void virtio_blk_zone_mgmt_complete(void *opaque,= int ret) } =20 virtio_blk_req_complete(req, err_status); - virtio_blk_free_request(req); + g_free(req); } =20 static int virtio_blk_handle_zone_mgmt(VirtIOBlockReq *req, BlockZoneOp op) @@ -719,7 +714,7 @@ static int virtio_blk_handle_zone_mgmt(VirtIOBlockReq *= req, BlockZoneOp op) return 0; out: virtio_blk_req_complete(req, err_status); - virtio_blk_free_request(req); + g_free(req); return err_status; } =20 @@ -750,7 +745,7 @@ static void virtio_blk_zone_append_complete(void *opaqu= e, int ret) =20 out: virtio_blk_req_complete(req, err_status); - virtio_blk_free_request(req); + g_free(req); g_free(data); } =20 @@ -788,7 +783,7 @@ static int virtio_blk_handle_zone_append(VirtIOBlockReq= *req, =20 out: virtio_blk_req_complete(req, err_status); - virtio_blk_free_request(req); + g_free(req); return err_status; } =20 @@ -855,7 +850,7 @@ static int virtio_blk_handle_request(VirtIOBlockReq *re= q, MultiReqBuffer *mrb) virtio_blk_req_complete(req, VIRTIO_BLK_S_IOERR); block_acct_invalid(blk_get_stats(s->blk), is_write ? BLOCK_ACCT_WRITE : BLOCK_ACCT_RE= AD); - virtio_blk_free_request(req); + g_free(req); return 0; } =20 @@ -911,7 +906,7 @@ static int virtio_blk_handle_request(VirtIOBlockReq *re= q, MultiReqBuffer *mrb) VIRTIO_BLK_ID_BYTES)); iov_from_buf(in_iov, in_num, 0, serial, size); virtio_blk_req_complete(req, VIRTIO_BLK_S_OK); - virtio_blk_free_request(req); + g_free(req); break; } case VIRTIO_BLK_T_ZONE_APPEND & ~VIRTIO_BLK_T_OUT: @@ -943,7 +938,7 @@ static int virtio_blk_handle_request(VirtIOBlockReq *re= q, MultiReqBuffer *mrb) if (unlikely(!(type & VIRTIO_BLK_T_OUT) || out_len > sizeof(dwz_hdr))) { virtio_blk_req_complete(req, VIRTIO_BLK_S_UNSUPP); - virtio_blk_free_request(req); + g_free(req); return 0; } =20 @@ -960,7 +955,7 @@ static int virtio_blk_handle_request(VirtIOBlockReq *re= q, MultiReqBuffer *mrb) is_write_zeroe= s); if (err_status !=3D VIRTIO_BLK_S_OK) { virtio_blk_req_complete(req, err_status); - virtio_blk_free_request(req); + g_free(req); } =20 break; @@ -975,7 +970,7 @@ static int virtio_blk_handle_request(VirtIOBlockReq *re= q, MultiReqBuffer *mrb) if (!vbk->handle_unknown_request || !vbk->handle_unknown_request(req, mrb, type)) { virtio_blk_req_complete(req, VIRTIO_BLK_S_UNSUPP); - virtio_blk_free_request(req); + g_free(req); } } } @@ -998,7 +993,7 @@ void virtio_blk_handle_vq(VirtIOBlock *s, VirtQueue *vq) while ((req =3D virtio_blk_get_request(s, vq))) { if (virtio_blk_handle_request(req, &mrb)) { virtqueue_detach_element(req->vq, &req->elem, 0); - virtio_blk_free_request(req); + g_free(req); break; } } @@ -1048,7 +1043,7 @@ static void virtio_blk_dma_restart_bh(void *opaque) while (req) { next =3D req->next; virtqueue_detach_element(req->vq, &req->elem, 0); - virtio_blk_free_request(req); + g_free(req); req =3D next; } break; @@ -1131,7 +1126,7 @@ static void virtio_blk_reset(VirtIODevice *vdev) /* No other threads can access req->vq here */ virtqueue_detach_element(req->vq, &req->elem, 0); =20 - virtio_blk_free_request(req); + g_free(req); } } =20 diff --git a/hw/vmapple/virtio-blk.c b/hw/vmapple/virtio-blk.c index 16928d09685..40b33bbdac5 100644 --- a/hw/vmapple/virtio-blk.c +++ b/hw/vmapple/virtio-blk.c @@ -58,7 +58,7 @@ static bool vmapple_virtio_blk_handle_unknown_request(Vir= tIOBlockReq *req, qemu_log_mask(LOG_UNIMP, "%s: Barrier requests are currently no-op= s\n", __func__); virtio_blk_req_complete(req, VIRTIO_BLK_S_OK); - virtio_blk_free_request(req); + g_free(req); return true; default: return false; diff --git a/include/hw/virtio/virtio-blk.h b/include/hw/virtio/virtio-blk.h index 28d5046ea6c..dcb2c89aed5 100644 --- a/include/hw/virtio/virtio-blk.h +++ b/include/hw/virtio/virtio-blk.h @@ -109,7 +109,6 @@ typedef struct VirtIOBlkClass { } VirtIOBlkClass; =20 void virtio_blk_handle_vq(VirtIOBlock *s, VirtQueue *vq); -void virtio_blk_free_request(VirtIOBlockReq *req); void virtio_blk_req_complete(VirtIOBlockReq *req, unsigned char status); =20 #endif --=20 2.39.3 (Apple Git-145)