From patchwork Wed Aug 21 06:14:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11105523 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 1A099112C for ; Wed, 21 Aug 2019 06:15:58 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E8D1F216F4 for ; Wed, 21 Aug 2019 06:15:57 +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="UIS+/zsj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E8D1F216F4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i0JtA-0003uY-4V; Wed, 21 Aug 2019 06:14:32 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i0Jt8-0003uT-5q for xen-devel@lists.xenproject.org; Wed, 21 Aug 2019 06:14:30 +0000 X-Inumbo-ID: ee00a6c2-c3da-11e9-ac23-bc764e2007e4 Received: from esa3.hgst.iphmx.com (unknown [216.71.153.141]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id ee00a6c2-c3da-11e9-ac23-bc764e2007e4; Wed, 21 Aug 2019 06:14:28 +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=1566368068; x=1597904068; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=tDUu6OfCZAgiE5vxUUEYM/lctnZ4+mN4P7Ofucvf8cQ=; b=UIS+/zsj3dLIDYj3hVm0weckNR8UeVKmQAHGtwZeoEfftE3LhOOjfk30 R9rdQ+vpnRSJonxpu/Tc/n9JfoRNn/agDkbtxrchZjGdHni6BwctGh22D 3MV8vEpGwSv+md8b3xl+YbJ9Dq7RKt/aB7fr4bqmWVXhELudBfG17hJnq Es5n95m/anVg6bn4BFlYbqec/SmN5Sh7QdLNff/2Awmz1ZvTTEEt7W5vm f7yLYrfr8C+d3tNzs94KE6L2kL4+u3JnsIZ52Yn6OXy53Ji6rcSln4mLt STgBaiBOLiAVfi/NT2TOZf8dXsI4HonH6Srjburqmg1bX+rveFmM/s4Cl w==; IronPort-SDR: 2clqy71Snpeu0Pts/D0cRAiIvo5Oj4vx+wSC8NMVzXOkBdRS/5pY5S3wtcuEIm1JkfPs/onBZw LYIICj8sc48ht6gIKk14QswwDp/sMT7+DQhq7eHLg6dGByfyaGDiAiUN73gNvMP3fANm3/HLhq uczUwZVK4n785Jyi6rKeBkA02IefLkydcGkpOVDUQHJLSowuql4p5tHhmvvKc4Uhe3buR5BV12 vF4hTM6CL1NSzQzvzKmDV4C3KdukXtdSJjf7zyDYQHn9061P+RIRTawhNMwUy2JlYEJQeRufuE Ax0= X-IronPort-AV: E=Sophos;i="5.64,411,1559491200"; d="scan'208";a="120898325" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 21 Aug 2019 14:14:27 +0800 IronPort-SDR: 9GNt5ufBRxZOE9xLcPieFC6mAodbro/zKkBTl2rzQ5aJRH/qqrYyK98sAw/MmI4wLOMF5xsDD/ yFD1eOKXjevTumcjBquUexhstpdad7+7Cj+a308bzmyJPCVPR8Nc91yx0OHxJvyw7DjSaG9CHv 8uKfI7XSvOaRw93CYeKfdSQJVISI0mQcpJZO5lqebBb9HAW/b9db5JxCgCHgI1YIk1Xm1jx9gW Bwy4SekE70LkDZObRF0KLy04lFKjfqpDIZqcQ7E12rBmzuWjO0Wbu6qMGvUSy+z4T8ooFuVI10 XSHn14CXmaXGP5zzItT3v16s 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; 20 Aug 2019 23:11:48 -0700 IronPort-SDR: ZGZ6fU+fR5RzuuKyQ2BV7Qtj88cD9Ywgd0u1B2kvbxKN/qhuT5iNaowYnD43Mmvlu5PKoVZxFu EwuFv5WC4mXRvu1Ot2FMKpU7WEJTvW8+WuLi+qEjPsNYZ7a1WaPn3nzKPMvQTxa+AP6VJ7jrhh yDltPRtYNqQZHfK0/qhkoQE7+cYR6iw0FLrIjEhPi7rl5kCUe1BDydqeNMnl4XwqCi6Ihev3Rh 5960wvlRjEiKwa7McvK8/Zoh2N34Yk0PQUrrYQBNjhsSvbtu2ZY5ExsJRLBEA81+ZpGG/t3gaq ce4= WDCIronportException: Internal Received: from cvenusqemu.hgst.com ([10.202.66.73]) by uls-op-cesaip01.wdc.com with ESMTP; 20 Aug 2019 23:14:26 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org Date: Tue, 20 Aug 2019 23:14:14 -0700 Message-Id: <20190821061423.3408-1-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.17.0 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH V5 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 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" 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. Changes from V4:- 1. Adjust code for latest branch. 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 | 5 +++++ kernel/trace/blktrace.c | 2 +- 7 files changed, 16 insertions(+), 11 deletions(-) Reviewed-by: Bart Van Assche