From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6284C56201 for ; Tue, 24 Nov 2020 13:34:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 51192205ED for ; Tue, 24 Nov 2020 13:34:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 51192205ED Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C01856B0130; Tue, 24 Nov 2020 08:34:24 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BB05B6B0132; Tue, 24 Nov 2020 08:34:24 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AC73D6B0133; Tue, 24 Nov 2020 08:34:24 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0205.hostedemail.com [216.40.44.205]) by kanga.kvack.org (Postfix) with ESMTP id 976F46B0130 for ; Tue, 24 Nov 2020 08:34:24 -0500 (EST) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 4C8BF8249980 for ; Tue, 24 Nov 2020 13:34:24 +0000 (UTC) X-FDA: 77519406048.26.geese43_22171ba2736e Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin26.hostedemail.com (Postfix) with ESMTP id 29F121804B65C for ; Tue, 24 Nov 2020 13:34:24 +0000 (UTC) X-HE-Tag: geese43_22171ba2736e X-Filterd-Recvd-Size: 3649 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf29.hostedemail.com (Postfix) with ESMTP for ; Tue, 24 Nov 2020 13:34:23 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 61EB5AF33; Tue, 24 Nov 2020 13:34:22 +0000 (UTC) Subject: Re: [PATCH 30/45] block: remove the nr_sects field in struct hd_struct To: Christoph Hellwig , Jens Axboe Cc: Tejun Heo , Josef Bacik , Konrad Rzeszutek Wilk , Mike Snitzer , Greg Kroah-Hartman , Jan Kara , Johannes Thumshirn , dm-devel@redhat.com, Richard Weinberger , Jan Kara , linux-block@vger.kernel.org, xen-devel@lists.xenproject.org, linux-bcache@vger.kernel.org, linux-mtd@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org References: <20201124132751.3747337-1-hch@lst.de> <20201124132751.3747337-31-hch@lst.de> From: Coly Li Message-ID: <044dd4ec-c64d-3c5d-cf54-a4ca665b8912@suse.de> Date: Tue, 24 Nov 2020 21:34:11 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:78.0) Gecko/20100101 Thunderbird/78.4.3 MIME-Version: 1.0 In-Reply-To: <20201124132751.3747337-31-hch@lst.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 11/24/20 9:27 PM, Christoph Hellwig wrote: > Now that the hd_struct always has a block device attached to it, there is > no need for having two size field that just get out of sync. > > Additional the field in hd_struct did not use proper serializiation, > possibly allowing for torn writes. By only using the block_device field > this problem also gets fixed. > > Signed-off-by: Christoph Hellwig > Reviewed-by: Greg Kroah-Hartman For the bcache part, Acked-by: Coly Li Thanks. Coly Li > --- > block/bio.c | 4 +- > block/blk-core.c | 2 +- > block/blk.h | 53 ---------------------- > block/genhd.c | 55 +++++++++++----------- > block/partitions/core.c | 17 ++++--- > drivers/block/loop.c | 1 - > drivers/block/nbd.c | 2 +- > drivers/block/xen-blkback/common.h | 4 +- > drivers/md/bcache/super.c | 2 +- > drivers/s390/block/dasd_ioctl.c | 4 +- > drivers/target/target_core_pscsi.c | 7 +-- > fs/block_dev.c | 73 +----------------------------- > fs/f2fs/super.c | 2 +- > fs/pstore/blk.c | 2 +- > include/linux/genhd.h | 29 +++--------- > kernel/trace/blktrace.c | 2 +- > 16 files changed, 60 insertions(+), 199 deletions(-) > [snipped] > diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c > index c55d3c58a7ef55..04fa40868fbe10 100644 > --- a/drivers/md/bcache/super.c > +++ b/drivers/md/bcache/super.c > @@ -1408,7 +1408,7 @@ static int cached_dev_init(struct cached_dev *dc, unsigned int block_size) > q->limits.raid_partial_stripes_expensive; > > ret = bcache_device_init(&dc->disk, block_size, > - dc->bdev->bd_part->nr_sects - dc->sb.data_offset, > + bdev_nr_sectors(dc->bdev) - dc->sb.data_offset, > dc->bdev, &bcache_cached_ops); > if (ret) > return ret; [snipped]