From patchwork Tue Jun 2 01:32:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11582815 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8C03114F6 for ; Tue, 2 Jun 2020 01:32:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 75A32207BB for ; Tue, 2 Jun 2020 01:32:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="EfMsOwiv" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725850AbgFBBcW (ORCPT ); Mon, 1 Jun 2020 21:32:22 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:17805 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725825AbgFBBcV (ORCPT ); Mon, 1 Jun 2020 21:32:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1591061542; x=1622597542; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=sDoybVasoZ04UZixGcW814inlyfwtTam+7XIO/YQipg=; b=EfMsOwiv2rA+iz1PWtdzNlzI69GmqTdte9Epw9RaNfWKv0J5JR/QVQEF Xdxvfqqf0E6lX+VzM2GAqNY3O6Cm4bFxH933Ztniqlok9imHLeDyjgAYp 41dp8KhaKOuVlUYlEy3KsQ70VoZrrKIBW3MA9GRo4Vw1Cd3E043QnmTZW nPN1TK3KlAG/HOWdCfiOKZwPyV+N5mxZWkPUMl3+dhNYKSwxWBop9+8b4 P1ikVHvPegaydt/PX+a6hZwoVnRAZI4SCpCeNL0F4NqzGcqkzinxAYsUg freXfsEeQoi/EgjhsFI6v1SW/kzouwweh5k8ZKaLQUT0qZQFA4EY8dbdZ A==; IronPort-SDR: 69nkzKnx6jiYAN0DzU/r7DdQTBnsZ6FHxtsHehn+BshtoYH+dc2iPrXN2slasyzApxj4B5Y8RR VUTB9gyW6rYGRJ6ooNvEEu/yrNO4wVIKCWQKRjdMscbgnTl3crhMl3YosA4XfGZMTluDuSH2eo eI5JwNeOyuUOGLKPZaAm4zROOOcWPOvLaXCO2U5A4pEBfgM65LM3m0QGRWGW/hL/ZLrT3YxZHg Qf6AikU25RtziT2jGeGzBAWxuVu2TabRe/Yk7yoijWXkiVPTaoePWgv/2vLf9n4Gd2AnEW1Ukb yLY= X-IronPort-AV: E=Sophos;i="5.73,462,1583164800"; d="scan'208";a="140411677" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 02 Jun 2020 09:32:21 +0800 IronPort-SDR: UqXP/UgT2RsoH2WY+x+sWlhVCFl0VC8e9QOFnLDMAtZCON+q2fvVWMNVTMqWYZ88+RmERPwBvA Z2LZ03aqMCwbAJ7GLUzETZnLOjyapp8qY= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jun 2020 18:21:29 -0700 IronPort-SDR: RwuWNjsCEgLwu53fguVc3Rvnw16w5YElhzEMZ6tLc5TDoABcp0qWRizc+Qo/uwyZQkeJEGP/Q0 cbrHmb9YAmXg== WDCIronportException: Internal Received: from iouring.labspan.wdc.com (HELO iouring.sc.wdc.com) ([10.6.138.107]) by uls-op-cesaip01.wdc.com with ESMTP; 01 Jun 2020 18:32:20 -0700 From: Chaitanya Kulkarni To: axboe@kernel.dk Cc: linux-block@vger.kernel.org, Chaitanya Kulkarni Subject: [PATCH 1/4] blktrace: use rcu calls to access q->blk_trace Date: Mon, 1 Jun 2020 18:32:05 -0700 Message-Id: <20200602013208.4325-2-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200602013208.4325-1-chaitanya.kulkarni@wdc.com> References: <20200602013208.4325-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Since request queue's blk_trace member is been markds as __rcu, replace xchg() and cmdxchg() calls with appropriate rcu API. This removes the sparse warnings. The xchg() call is replaced with rcu_replace_pointer() since all the calls for xchg are protected are q->blk_trace_mutex. On replacing the pointer rcu_replace_pointer returns the old value if that value is NULL then existing code returns an error. In setup functions cmpxchg() call is replaced with calls to rcu_dereference_pointer() and rcu_replace_pointer(). The first dereference pointer call returns the existing value. If the value is not NULL existing code returns an error, otherwise the second call to replace pointer sets the new value.         Signed-off-by: Chaitanya Kulkarni --- kernel/trace/blktrace.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index ea47f2084087..27c19db01ba4 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -344,7 +344,8 @@ static int __blk_trace_remove(struct request_queue *q) { struct blk_trace *bt; - bt = xchg(&q->blk_trace, NULL); + bt = rcu_replace_pointer(q->blk_trace, NULL, + lockdep_is_held(&q->blk_trace_mutex)); if (!bt) return -EINVAL; @@ -544,9 +545,13 @@ static int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev, bt->trace_state = Blktrace_setup; ret = -EBUSY; - if (cmpxchg(&q->blk_trace, NULL, bt)) + if (rcu_dereference_protected(q->blk_trace, + lockdep_is_held(&q->blk_trace_mutex))) goto err; + rcu_replace_pointer(q->blk_trace, bt, + lockdep_is_held(&q->blk_trace_mutex)); + get_probe_ref(); ret = 0; @@ -1637,7 +1642,8 @@ static int blk_trace_remove_queue(struct request_queue *q) { struct blk_trace *bt; - bt = xchg(&q->blk_trace, NULL); + bt = rcu_replace_pointer(q->blk_trace, NULL, + lockdep_is_held(&q->blk_trace_mutex)); if (bt == NULL) return -EINVAL; @@ -1670,9 +1676,13 @@ static int blk_trace_setup_queue(struct request_queue *q, blk_trace_setup_lba(bt, bdev); ret = -EBUSY; - if (cmpxchg(&q->blk_trace, NULL, bt)) + if (rcu_dereference_protected(q->blk_trace, + lockdep_is_held(&q->blk_trace_mutex))) goto free_bt; + rcu_replace_pointer(q->blk_trace, bt, + lockdep_is_held(&q->blk_trace_mutex)); + get_probe_ref(); return 0; From patchwork Tue Jun 2 01:32:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11582817 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A865214F6 for ; Tue, 2 Jun 2020 01:32:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 92074207BB for ; Tue, 2 Jun 2020 01:32:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="VinNRjFm" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725900AbgFBBc3 (ORCPT ); Mon, 1 Jun 2020 21:32:29 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:17815 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725825AbgFBBc2 (ORCPT ); Mon, 1 Jun 2020 21:32:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1591061548; x=1622597548; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2rev2lubp18j9iAaweNQ/2EK4fagwYwFLzMIMtj1Rzo=; b=VinNRjFmw7koDXpXrFHIWRbakdihX97+jErsqjb+wegE662W3tfn78+V FnQy5f9UeySUqpGZldlxlDsoMZP3xxQhMeiISz5RCx8Trvf20SehRnhEc ofLp1TgBb58uvwJsQdtyLoErnTxPNIc4dJ5FxyEO7yqHpUydm1muwSVUr W8CThj8W5kKbbVgjwgr9IK4gUcX7749s7uX1Zp6U+OAuVhPiEjmmV+AVQ iNgjvUcnIWBCnzZwzpEE+pdEqMc8Dfq9S4rUoqSNLneB41vGbaboVWo6U 1WuezyevhVNvofrH+mzEzGd5JVjZ3IjyfmaBadrOOjRqPRfuRkcolz81f g==; IronPort-SDR: fdMjnkXTO135e8JZRETx9X9Q0/PcXXG22Gti2lnZe7fbf21Mrg94o2gFr59/xFrxXViKWM3Q98 2xWdyXRMvulmT+Yfzr2soRnEh5RDj0g2xsGcEu590cdbEvmB+u2DiJB846WEaCvX8Q2LHdep+j Nh+naE0mq5mev7/aiqYLVH0iiHgX23oHgTtgJKFkNGdescR663QiG+34ZNQiFnO/jTeb8yx3Z9 WqI4FYpObKQVRv4W4ovSnkdM5UA/WGzt2iebGCMugQ35DKfmR/nY+v7QXHCfJp39Q1DWO/LzhL Z08= X-IronPort-AV: E=Sophos;i="5.73,462,1583164800"; d="scan'208";a="140411685" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 02 Jun 2020 09:32:28 +0800 IronPort-SDR: 6vMFFB61/csOBtmDSvm42lkH43EwIhtrw/vDO4Sjn3WTNGCeaIOnhjdSJL+ZzJENSBd+PSJe6d qBb4KFMpGkSAEUzYDQNhU0bUyok4oAy+I= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jun 2020 18:21:36 -0700 IronPort-SDR: EenE78uCC4g9oOjdode9DQnVBxZ7NiHEzD7ZMzUTUSugu0tQOTiQkBUDzRmpgt6Vxj24pKCO5d JDKFqztsHpUw== WDCIronportException: Internal Received: from iouring.labspan.wdc.com (HELO iouring.sc.wdc.com) ([10.6.138.107]) by uls-op-cesaip01.wdc.com with ESMTP; 01 Jun 2020 18:32:27 -0700 From: Chaitanya Kulkarni To: axboe@kernel.dk Cc: linux-block@vger.kernel.org, Chaitanya Kulkarni Subject: [PATCH 2/4] blktrace: use errno instead of bi_status Date: Mon, 1 Jun 2020 18:32:06 -0700 Message-Id: <20200602013208.4325-3-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200602013208.4325-1-chaitanya.kulkarni@wdc.com> References: <20200602013208.4325-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org In blk_add_trace_spliti() blk_add_trace_bio_remap() use blk_status_to_errno() to pass the error instead of pasing the bi_status. This fixes the sparse warning. Signed-off-by: Chaitanya Kulkarni --- kernel/trace/blktrace.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 27c19db01ba4..44a2678b8f44 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -1000,8 +1000,10 @@ static void blk_add_trace_split(void *ignore, __blk_add_trace(bt, bio->bi_iter.bi_sector, bio->bi_iter.bi_size, bio_op(bio), bio->bi_opf, - BLK_TA_SPLIT, bio->bi_status, sizeof(rpdu), - &rpdu, blk_trace_bio_get_cgid(q, bio)); + BLK_TA_SPLIT, + blk_status_to_errno(bio->bi_status), + sizeof(rpdu), &rpdu, + blk_trace_bio_get_cgid(q, bio)); } rcu_read_unlock(); } @@ -1038,7 +1040,8 @@ static void blk_add_trace_bio_remap(void *ignore, r.sector_from = cpu_to_be64(from); __blk_add_trace(bt, bio->bi_iter.bi_sector, bio->bi_iter.bi_size, - bio_op(bio), bio->bi_opf, BLK_TA_REMAP, bio->bi_status, + bio_op(bio), bio->bi_opf, BLK_TA_REMAP, + blk_status_to_errno(bio->bi_status), sizeof(r), &r, blk_trace_bio_get_cgid(q, bio)); rcu_read_unlock(); } From patchwork Tue Jun 2 01:32:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11582819 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 12B65912 for ; Tue, 2 Jun 2020 01:32:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E7F7C207D5 for ; Tue, 2 Jun 2020 01:32:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="cMMBpKJb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725915AbgFBBce (ORCPT ); Mon, 1 Jun 2020 21:32:34 -0400 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:10253 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725825AbgFBBce (ORCPT ); Mon, 1 Jun 2020 21:32:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1591061553; x=1622597553; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LVdDTKYe0jW/7mmJ83E3o37G4o6wcSwxMeRq1VoDK2Y=; b=cMMBpKJb1rMuX6qsVC13cuQoVGXaoW9V4mV1cNt48bwl2K6NRq2+vAE8 IBJqifzpkKd45cZyfFq7eJkqszENiJvqaADZxLNnQklI9aJ/Vj6xRF7ZF tOkHvCuHneVMxQRsf9Sc51xeTd0MKM/pBjr4FhyO0zDw3JbRJX/ppamb6 fMNjsNEGEpHg4uIUjMmdrWlCuyrB7Nu8gqcqT83zu+VtV4XeMy9nYmrTK p/4y0U7Sd9T5W4MVl6tBYlppLSl3y7boJDoPj0e4isixqfh6enLOhhrlm /aa9V8b1dj+dmydS+SNfXcKCLeT92IND+kTI/ZcljGUwiIdXf3LID9UGr w==; IronPort-SDR: ovQLiLZR2YWLQEjNU/Hxl433YOG1K5DMe0N+vFOPVoofZem/HsOpAVlPTrNz+4i7xsyatfCANu wbiY2YOsIBQ3tDVsa99tolYP1RwbeO10YYCfvshUf24FvcbZtnsKecSpGC1Js0UwWM28F3dw3R AWNgObj0H3XlVnpluKuQ6chFJ11Jy9+zNSciFhYaoA3vK5BsjifZCNRw+2HWKozxk6FCaA2Dlz 1TU8b8fpQcvU9Bxmc8gsjW6mra5AsFMDZBQX55PZaapPyk+hO71ZWEht0BfGLRiIQA7bDDWLWN c7U= X-IronPort-AV: E=Sophos;i="5.73,462,1583164800"; d="scan'208";a="248073652" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 02 Jun 2020 09:32:33 +0800 IronPort-SDR: QQoM8rIO9Q+QCybvPrJG+T9qqi5THg+ntsrbH16xfQYIvJpC2SwKERtR8Rqtt/rVm96Wn71bko RuA6LRUvyltS/pRwlXCAXYROlMtCgrR2M= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jun 2020 18:21:41 -0700 IronPort-SDR: YlbtWR5ueFA5cCBVd6ilkhhD1MfVKj98oBvXqmTGyuo17SRhudW13PhtMAQ2vhP9IQ4lbpRNpJ vrADZY/ZKzYw== WDCIronportException: Internal Received: from iouring.labspan.wdc.com (HELO iouring.sc.wdc.com) ([10.6.138.107]) by uls-op-cesaip01.wdc.com with ESMTP; 01 Jun 2020 18:32:33 -0700 From: Chaitanya Kulkarni To: axboe@kernel.dk Cc: linux-block@vger.kernel.org, Chaitanya Kulkarni Subject: [PATCH 3/4] blktrace: fix endianness in get_pdu_int() Date: Mon, 1 Jun 2020 18:32:07 -0700 Message-Id: <20200602013208.4325-4-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200602013208.4325-1-chaitanya.kulkarni@wdc.com> References: <20200602013208.4325-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org In function get_pdu_len() replace variable type from __u64 to __be64. This fixes sparse warning. Signed-off-by: Chaitanya Kulkarni --- kernel/trace/blktrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 44a2678b8f44..01e192a52c9f 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -1261,7 +1261,7 @@ static inline __u16 t_error(const struct trace_entry *ent) static __u64 get_pdu_int(const struct trace_entry *ent, bool has_cg) { - const __u64 *val = pdu_start(ent, has_cg); + const __be64 *val = pdu_start(ent, has_cg); return be64_to_cpu(*val); } From patchwork Tue Jun 2 01:32:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11582821 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 01FEF14F6 for ; Tue, 2 Jun 2020 01:32:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DE46E207D5 for ; Tue, 2 Jun 2020 01:32:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="YK1HzSKk" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725940AbgFBBck (ORCPT ); Mon, 1 Jun 2020 21:32:40 -0400 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:23320 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725825AbgFBBck (ORCPT ); Mon, 1 Jun 2020 21:32:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1591061559; x=1622597559; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZIStS7QK3y/yf+e+Le1HUW+ifkiVvMBbmge90umbnHI=; b=YK1HzSKkewwTN9THsC4x648P16/nlFoIzF5wvf3A+Z4ZdzoBeIZHfvDZ HdVLJTjOgCuHqdV/RU+5EXeMt/CpVe7zAR2nDSYZTv+mRNDNJtnTlm+p1 AbwMxjpHlzaAnBqJ1BcYiUtn/u6914cijZDtU9SmSAzMiLf304Cw5dV8J 5Jn45UpwN6yfEb9mGpcsIGPzgJNL1ZKN4wbTSOGp+/SdyRvOr5TexFXIs Wpf6eiX7Z3c7YeEmobLt8pcuidYI2hCsgMxHQx21R9IBZYPlxqLPaW/kk sppYQlBXvkCpx1Scp7uVdGjtUJjeex4G8OY5JkeXcsknQRtDNH6wHFRmA w==; IronPort-SDR: 57hvK0+e1PKyfbNN1XLGeFSqtP3SG8/N4nj+ANBeBoSIYY1vxE8nBKGtgaWdyBWdhOn79vtCFj pbnVm5ydhMTmiN4hkiCXcCaEqRSvTD5alpXLzDEJYMUmSTv0sZ3A2ch4F/p1dN1viUUoEAc65f dx0d/uCqFyMh7UYu9ov/O3K6YOfbXYY+tpjtpLjELvLXT4lCi7PBO7bnDJMZupNr0SDHRUqXvm rjPIehn/W+kB7JaCsiI61Wc/+ReMAV/s7EayaJ6fHctgItazpXh4kkczm1AxNly/JA6p4O5XCL gFs= X-IronPort-AV: E=Sophos;i="5.73,462,1583164800"; d="scan'208";a="143316969" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 02 Jun 2020 09:32:39 +0800 IronPort-SDR: Oh2jWmirCPV66n7FXG/aqrFNI2Upb4Rz25LD/mxpHdVnPpjhoQK3ldNEvSwAsvpOFqdo6Ydm8t Q6zXxH5O8mXvrT+8zMV6f9cqliHrNwBOI= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jun 2020 18:21:47 -0700 IronPort-SDR: kRUQIeOnFhpZd90KBOnn61pXNVawD6TAaYARaU+ZQfT82QeLeTLzYYDSIlM+5Kai6VsnXzMaDX z8q1ostJdXsg== WDCIronportException: Internal Received: from iouring.labspan.wdc.com (HELO iouring.sc.wdc.com) ([10.6.138.107]) by uls-op-cesaip01.wdc.com with ESMTP; 01 Jun 2020 18:32:38 -0700 From: Chaitanya Kulkarni To: axboe@kernel.dk Cc: linux-block@vger.kernel.org, Chaitanya Kulkarni Subject: [PATCH 4/4] blktrace: fix endianness for blk_log_remap() Date: Mon, 1 Jun 2020 18:32:08 -0700 Message-Id: <20200602013208.4325-5-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200602013208.4325-1-chaitanya.kulkarni@wdc.com> References: <20200602013208.4325-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The function blk_log_remap() can be simplified by removing the call to get_pdu_remap() that copies the values into extra variable to print the data, which also fixes the endiannness warning reported by sparse. Signed-off-by: Chaitanya Kulkarni --- kernel/trace/blktrace.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 01e192a52c9f..7cfc293f9697 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -1265,17 +1265,6 @@ static __u64 get_pdu_int(const struct trace_entry *ent, bool has_cg) return be64_to_cpu(*val); } -static void get_pdu_remap(const struct trace_entry *ent, - struct blk_io_trace_remap *r, bool has_cg) -{ - const struct blk_io_trace_remap *__r = pdu_start(ent, has_cg); - __u64 sector_from = __r->sector_from; - - r->device_from = be32_to_cpu(__r->device_from); - r->device_to = be32_to_cpu(__r->device_to); - r->sector_from = be64_to_cpu(sector_from); -} - typedef void (blk_log_action_t) (struct trace_iterator *iter, const char *act, bool has_cg); @@ -1415,13 +1404,13 @@ static void blk_log_with_error(struct trace_seq *s, static void blk_log_remap(struct trace_seq *s, const struct trace_entry *ent, bool has_cg) { - struct blk_io_trace_remap r = { .device_from = 0, }; + const struct blk_io_trace_remap *__r = pdu_start(ent, has_cg); - get_pdu_remap(ent, &r, has_cg); trace_seq_printf(s, "%llu + %u <- (%d,%d) %llu\n", t_sector(ent), t_sec(ent), - MAJOR(r.device_from), MINOR(r.device_from), - (unsigned long long)r.sector_from); + MAJOR(be32_to_cpu(__r->device_from)), + MINOR(be32_to_cpu(__r->device_from)), + be64_to_cpu(__r->sector_from)); } static void blk_log_plug(struct trace_seq *s, const struct trace_entry *ent, bool has_cg)