From patchwork Tue Dec 31 20:22:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 854417 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp7089989wrq; Tue, 31 Dec 2024 12:25:24 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV0N01n2srZq4oA1qG3mEaaMFICbHtwPKfNLDUjvLiazAMlky7srrSc49XWkDSbSePI8E9rbw==@linaro.org X-Google-Smtp-Source: AGHT+IEbX4DiBACYlNNOs0tsqorinJ7c5eLZgBWokGsp6DvfPJWs8MuEZMmBXy9rMPR/aCsQRHw9 X-Received: by 2002:a05:620a:3185:b0:7b7:106a:19a0 with SMTP id af79cd13be357-7b9ba799addmr6361910885a.24.1735676723878; Tue, 31 Dec 2024 12:25:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1735676723; cv=none; d=google.com; s=arc-20240605; b=jnZeZvCBXq7gfva8qIfy2/yNroqIdUzNii4Ap1Son5CK0+KqKup5GNAKtKPXxjX3H5 0PmHhE13HK3900FwtfCrWgmDOE49jvEy2JCAftMe/kbMXIp/hK/SS6Wrf09vJ2q7FZV8 3zEAFIYjvNeCjkR1G9csWtJ2Rn0rlhK1dHhQmpTApbdLI+WGw4FDANM497dOaDuMqhuX KS/shl7PAiSP3Y3IWQeMF5RUMxcHymdNxXCzrSmAqLWIc/I/VgIxmrGP5kfE6V1hF3Al ObnO1az3cHXlEKz/2+GJR8RD2rhSMaFbEIIL4sAwv1FuOEo2LilY0vOZFxgkyS9UjwPS /42w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yVuDlgyVY1jvmkQEUInHR9nAZd4EhLEP8pFEQwDV8v4=; fh=tyn3H0ySGZ/3GeTr+63AnxEBt54onnjIpRgEvvPl10Q=; b=i7r0ccKRrEBD7ee2k+vEC/CLyqd0Nd+S5HP15cfroSHwU49qsh3kqFpZSRApDCBYXf mD4s3qg48G9+qr97M0K9bxc8+4vSTARts2A4hnnkA731urP+6OfI0PC+JK1kKERkjxOi IkxpUxnno7ke/NleSY+FBOIm/iGjmryfyRFuv5GQUj5hT/k0aNAFqG1Sc9qI4e1WuTpt 92RMLMjTuE62+f7AJ4f+8kOnBQDFsMt4bdUnMH6jIoAc6UJksDygBAWKQMNG1JtdttjL 3ruGVSd/Y/nUOA/+EoCWt0Z8wJX8iCEwRjzF6fNhAx55F0mfw2U16/GfAUagjAi2eFdb db2g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Q45qF+VQ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b9ac4fa5acsi3110831785a.554.2024.12.31.12.25.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 31 Dec 2024 12:25:23 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Q45qF+VQ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tSimx-0006px-Iq; Tue, 31 Dec 2024 15:24:29 -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 1tSimj-0006Zx-BU for qemu-devel@nongnu.org; Tue, 31 Dec 2024 15:24:13 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tSimg-0000ww-0h for qemu-devel@nongnu.org; Tue, 31 Dec 2024 15:24:13 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4363dc916ceso66468765e9.0 for ; Tue, 31 Dec 2024 12:24:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735676648; x=1736281448; 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=yVuDlgyVY1jvmkQEUInHR9nAZd4EhLEP8pFEQwDV8v4=; b=Q45qF+VQmDXRnVLVfeIY/tv+dgeYWuHK20J4XcaCvCJVbhRLMtjPXHB29aqA/ULY8M +X3mq2LkxkrAFzsG7rml4DXFxP3Pg+8r/k5tR2mw62YohJ9gUaAW4qa5m7MKaYbp5mSn 81hxERT8u7HaL471F2kY/z2/VExQc2+wJkUN04qF5aMKlpRDCr7uhLSzvbGi9Mb5cC0N peunCl1QMheLKArliuylcKPzBpNz86ghQYknQRYIWGsWMTkUMNz4Bh5D3xZjM9u0h+oj r01ReQgb498QOgwVYAJaiTS4cLDB+WHNSy6KrVQD5mT5CIrF1pYmEexaNc/16gU0tCC3 4IAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735676648; x=1736281448; 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=yVuDlgyVY1jvmkQEUInHR9nAZd4EhLEP8pFEQwDV8v4=; b=oTvaxEAYb3ZsZXOo9j6Ze9jjway4VoenNg+xFBuGNh0xo+6O2tQXnzF/YSmR/0L44i 1VXSYED2h562B6fYMJEFDCP99/wyZN1eHZwOAEZMk8ENakpPsjwZJBgwZgHGJxDM5Pjg ha1uz0wshh6N8msVEDC6jLmQs5tli42x+ID8YpSsdtsG7Y84lA+88cJdozk+aSzMJVJj LMR74j6Sr/e/40qL4onI6xT+fS5Xg4uxxy56uBbrbZtuxraiCoEVdLkXSw5+lRBY7bsl MXZsbkpdghC7TV4xH0kr6dbYjBv0Yn+3JQ3rOQqbi+JMMUO1z1g5Y94c9WFngsB4zC/v /iFQ== X-Gm-Message-State: AOJu0Yzv41Y3jQ9XVFQ4qnvnScnUa7LL/OjJwRreiaTMO4ltQWJ0NbKc /Sb2W/Xas/k5PSmTeHnpdNY95aH35k4igw+11Cabp95Xd5+s2JcFBBc2I7no4+1TLwNBp2s7XtA Bncc= X-Gm-Gg: ASbGncuy0UxNBi/A2Aq1K/Pv76/M/kbjtT7+5z4kL6H6RV2yrVsUcXjyjjgO+OpcMZ7 DwTgoFVEcym53dshKmTZskM+rqY1tekaD4KAosVt6IVlDlSuc1AVGesMQ1NJBFIvyo8eK4sVfJ8 uYfNd++7WHElHjwA18HenuD3jdLr5JrlmAX3AtRJRBkQQp4F46x/fE1EjpSwLTWcxgwhcxPrsar y6txepTE/bfIzSeSyC9QgOJnbPhNlpuwi8yOFGs76EMxzies5oUUgKKv45OBt3SEiNCnwYsWteF c1OTj/yZZnIzSwrv6oLGM8DFtyM9iHU= X-Received: by 2002:adf:a392:0:b0:385:fc35:1f75 with SMTP id ffacd0b85a97d-38a22a11b62mr28089066f8f.12.1735676647994; Tue, 31 Dec 2024 12:24:07 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a1c6ad3e3sm34816944f8f.0.2024.12.31.12.24.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 31 Dec 2024 12:24:07 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Phil Dennis-Jordan , Akihiko Odaki , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PULL 20/29] hw/block/virtio-blk: Replaces request free function with g_free Date: Tue, 31 Dec 2024 21:22:19 +0100 Message-ID: <20241231202228.28819-21-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241231202228.28819-1-philmd@linaro.org> References: <20241231202228.28819-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=philmd@linaro.org; helo=mail-wm1-x332.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Phil Dennis-Jordan 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 Tested-by: Akihiko Odaki Message-ID: <20241223221645.29911-14-phil@philjordan.eu> Signed-off-by: Philippe Mathieu-Daudé --- hw/block/virtio-blk.c | 43 +++++++++++++++++++------------------------ 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 8806c03f7c6..e0acce89e1e 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, VirtQueue *vq, req->mr_next = NULL; } -static void virtio_blk_free_request(VirtIOBlockReq *req) -{ - g_free(req); -} - static void virtio_blk_req_complete(VirtIOBlockReq *req, unsigned char status) { VirtIOBlock *s = 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); } blk_error_action(s->blk, action, is_read, error); @@ -136,7 +131,7 @@ static void virtio_blk_rw_complete(void *opaque, int ret) 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); } } @@ -151,7 +146,7 @@ static void virtio_blk_flush_complete(void *opaque, int ret) 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); } static void virtio_blk_discard_write_zeroes_complete(void *opaque, int ret) @@ -169,7 +164,7 @@ static void virtio_blk_discard_write_zeroes_complete(void *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); } static VirtIOBlockReq *virtio_blk_get_request(VirtIOBlock *s, VirtQueue *vq) @@ -214,7 +209,7 @@ static void virtio_blk_handle_scsi(VirtIOBlockReq *req) fail: virtio_blk_req_complete(req, status); - virtio_blk_free_request(req); + g_free(req); } static inline void submit_requests(VirtIOBlock *s, MultiReqBuffer *mrb, @@ -612,7 +607,7 @@ static void virtio_blk_zone_report_complete(void *opaque, int ret) 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(VirtIOBlockReq *req, return; out: virtio_blk_req_complete(req, err_status); - virtio_blk_free_request(req); + g_free(req); } 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) } virtio_blk_req_complete(req, err_status); - virtio_blk_free_request(req); + g_free(req); } 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; } @@ -750,7 +745,7 @@ static void virtio_blk_zone_append_complete(void *opaque, int ret) out: virtio_blk_req_complete(req, err_status); - virtio_blk_free_request(req); + g_free(req); g_free(data); } @@ -788,7 +783,7 @@ static int virtio_blk_handle_zone_append(VirtIOBlockReq *req, out: virtio_blk_req_complete(req, err_status); - virtio_blk_free_request(req); + g_free(req); return err_status; } @@ -855,7 +850,7 @@ static int virtio_blk_handle_request(VirtIOBlockReq *req, 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_READ); - virtio_blk_free_request(req); + g_free(req); return 0; } @@ -911,7 +906,7 @@ static int virtio_blk_handle_request(VirtIOBlockReq *req, 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 *req, 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; } @@ -960,14 +955,14 @@ static int virtio_blk_handle_request(VirtIOBlockReq *req, MultiReqBuffer *mrb) is_write_zeroes); if (err_status != VIRTIO_BLK_S_OK) { virtio_blk_req_complete(req, err_status); - virtio_blk_free_request(req); + g_free(req); } break; } default: virtio_blk_req_complete(req, VIRTIO_BLK_S_UNSUPP); - virtio_blk_free_request(req); + g_free(req); } return 0; } @@ -988,7 +983,7 @@ void virtio_blk_handle_vq(VirtIOBlock *s, VirtQueue *vq) while ((req = 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; } } @@ -1038,7 +1033,7 @@ static void virtio_blk_dma_restart_bh(void *opaque) while (req) { next = req->next; virtqueue_detach_element(req->vq, &req->elem, 0); - virtio_blk_free_request(req); + g_free(req); req = next; } break; @@ -1121,7 +1116,7 @@ static void virtio_blk_reset(VirtIODevice *vdev) /* No other threads can access req->vq here */ virtqueue_detach_element(req->vq, &req->elem, 0); - virtio_blk_free_request(req); + g_free(req); } }