From patchwork Tue Jul 2 17:42:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11028483 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3D15914F6 for ; Tue, 2 Jul 2019 17:46:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 25617288DC for ; Tue, 2 Jul 2019 17:46:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 191362892C; Tue, 2 Jul 2019 17:46:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A2FBA288DC for ; Tue, 2 Jul 2019 17:46:25 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hiMpc-0007mO-Ji; Tue, 02 Jul 2019 17:44:40 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hiMnk-0007f2-DY for xen-devel@lists.xenproject.org; Tue, 02 Jul 2019 17:42:44 +0000 X-Inumbo-ID: c9b7df94-9cf0-11e9-9a18-57bb8326399f Received: from esa4.hgst.iphmx.com (unknown [216.71.154.42]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id c9b7df94-9cf0-11e9-9a18-57bb8326399f; Tue, 02 Jul 2019 17:42:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1562089361; x=1593625361; h=from:to:cc:subject:date:message-id; bh=ynTWt0LIGk94WvmkDMsXoNoeMmV+rcyKihqB3+wk4H4=; b=rH7HjoJoIacN2xy55cKs4YAjSZPDyhY8IhUdtbCfkwxNz18tehZVQGaK r+s9D2Rylqbf81z9udSgSkG53QpHAScuk0+J0F8uKjW/5yr8Qjkpmj6O8 5YcMejcbkIHVBF+NfvW1IjnDv25WJDa44djkmjrdkk5bS8aS2qf2IbgX0 RR0hYGN2D8dwrMss43wT6p1kj9HxFKKrJUpcXZCtOVYtjENQLGbi/2oTs Ft6valAEHc6QbEdLAEH8vCSxSzaQNPC/Vo96bJIPgMwaF/kplptmvHjMk dJj2zz53rX8sSakE9ssRbdsiuNPAYdIlfM9cSHZPlBrR0WrBjDw4Zsggd w==; IronPort-SDR: 8cFuRhbq70NE7bdnIUFnaGULFuYesuqLZrVO/KMqUarpzWlvYkLzGBFGH5WVQtRUZo3bE5QG+2 Nvjg+A6tHL6Nmkzt6aa1Y2O1fpu/rrfxP2UV94yANo18kDpmj4G+lLOKL5+kKtatVlht7KiPW3 4nt1WtmyImmdrnkl+drYjp8dpbsPoD5JfbDBi/FbAtKxvm9WnGnpRTCRbi4XmEuqDS6Ljr2jOd 0HTSPQeJVKW9uX5Fy9kbMv/F+g4XRqN/iWn0QShpFiEm3Pcz4EpDQXTBlbMoheVs2+2e564lrT pEc= X-IronPort-AV: E=Sophos;i="5.63,444,1557158400"; d="scan'208";a="112068293" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 03 Jul 2019 01:42:40 +0800 IronPort-SDR: tRKa9XFOjJ69uqD8OIhIxYtiJ5yc63Oeu1+RrmGXpIEgeubct8e3uWbQDhs1a8iV5S1eLDIAJ9 j/+/PPWHD3jNKaQwd36R00NPQKj2fcR2xgllnMDQX4AIr4XLOlxieGfHubfx60PYA4Pi/dLafc YJrEjzVxjj+hCUPaCyoo7gqNy9VnuvjsFpvT2nopOz3cEgaeLBx9jzwsrtIxCkeLXieMMk24iB Eux3dAayuRRnG6eMpuJdSDA4/uRNWEhbg99ooUXBH/uDhbsAPSD7r+q/xSdS1sXR++/rsvhNy1 YDu0FvDAhIqFjOUEZIzazgWu Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 02 Jul 2019 10:41:38 -0700 IronPort-SDR: xFK+TzJBQTZp/heqygJSJnRPo0tQ9hijWGueFKQDOd4LSg6sKwbpFgF0VvZqkwgjK2yMgs4+Or icXs+wEaddgqpAV5uoeT3dSDE9avA4PYEYQ5oQOJjphWIpVSmShDFuVRNWCHRdtW1Yhb1pYnjl aAwv+rDoH2vPT1ui3sUjymvCZWJL7whXkR2tb9dx3GoZfwOevSFFE/paM5Yqd4R5A9cUZ/LnHQ 6Kfo8rEQttUxmYSPyKgtw+OUaPzF/7x2osysgEy3nt5xgnr12RTiIDusa1T36wgh5pGspmUXoZ flA= Received: from cvenusqemu.hgst.com ([10.202.66.73]) by uls-op-cesaip02.wdc.com with ESMTP; 02 Jul 2019 10:42:39 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Date: Tue, 2 Jul 2019 10:42:26 -0700 Message-Id: <20190702174236.3332-1-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.17.0 X-Mailman-Approved-At: Tue, 02 Jul 2019 17:44:39 +0000 Subject: [Xen-devel] [PATCH V3 0/9] block: use right accessor to read nr_sects X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: damien.lemoal@wdc.com, linux-btrace@vger.kernel.org, bvanassche@acm.org, linux-scsi@vger.kernel.org, konrad.wilk@oracle.com, Chaitanya Kulkarni , yuchao0@huawei.com, colyli@suse.de, linux-bcache@vger.kernel.org, jaegeuk@kernel.org, xen-devel@lists.xenproject.org, kent.overstreet@gmail.com, roger.pau@citrix.com MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Hi, In the blk-zoned, bcache, f2fs, target-pscsi, xen and blktrace implementation block device->hd_part->number of sectors field is accessed directly without any appropriate locking or accessor function. There is an existing accessor function present in the in include/linux/genhd.h which should be used to read the bdev->hd_part->nr_sects. From ${KERN_DIR}/include/linux/genhd.h:- 714 /* 715 * Any access of part->nr_sects which is not protected by partition 716 * bd_mutex or gendisk bdev bd_mutex, should be done using this 717 * accessor function. 718 * 719 * Code written along the lines of i_size_read() and i_size_write(). 720 * CONFIG_PREEMPT case optimizes the case of UP kernel with preemption 721 * on. 722 */ 723 static inline sector_t part_nr_sects_read(struct hd_struct *part) 724 { This patch series introduces a helper function on the top of the part_nr_sects_read() and removes the all direct accesses to the bdev->hd_part->nr_sects. This series is based on :- 1. Repo :- git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git. 2. Branch :- for-next. Please consider this for 5.3. Changes from V2:- 1. Add target-pscsi patch. 2. Get rid of extra variable in the bdev_nr_setcs(). 3. Add compile only patch for xen/blkback. Chaitanya Kulkarni (9): block: add a helper function to read nr_setcs blk-zoned: update blkdev_nr_zones() with helper blk-zoned: update blkdev_report_zone() with helper blk-zoned: update blkdev_reset_zones() with helper bcache: update cached_dev_init() with helper f2fs: use helper in init_blkz_info() blktrace: use helper in blk_trace_setup_lba() target/pscsi: use helper in pscsi_get_blocks() xen/blkback: use helper in vbd_sz() block/blk-zoned.c | 12 ++++++------ drivers/block/xen-blkback/common.h | 2 +- drivers/md/bcache/super.c | 2 +- drivers/target/target_core_pscsi.c | 2 +- fs/f2fs/super.c | 2 +- include/linux/blkdev.h | 6 ++++++ kernel/trace/blktrace.c | 2 +- 7 files changed, 17 insertions(+), 11 deletions(-)