From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8757D17FB for ; Wed, 6 Apr 2022 08:53:51 +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=1649235232; x=1680771232; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=LFM3dJ4XtmmQmpjm/ADKwYliPf/iPacGMSt9/3x5IFU=; b=f6ypYCzlm+ondAQv6e7Lia42zEldWusAvcrQbzXpJTUj6PM/SqPFrQnA T+13wEy4zZW+YlLCacjTHFLiDTEvxW/JGtyeF1zga2qVgWvnmxMebMtpA AZSVo5RIhdp0S8UGumMYxbYDKkM6KecLwOB+4BMZQiN6eOg49XH2mnm7Z RrMpJF6p/W91urQSsJ2kyfQtdo5q8wZU3HoiHLoGO9tUAg61l6sqCCMjK 4l7QeHeBV54qSrs09Mk1dJJnNfEgytmuRbj9TfKU/fj9DpJBT8E5Mi7nF 4UcONl8tTum80EB9MvKZVxAQO0HV18/UQpDJnK+8VE8+RYbnpS28Y5J6G g==; X-IronPort-AV: E=Sophos;i="5.90,239,1643644800"; d="scan'208";a="196092189" 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; 06 Apr 2022 16:52:43 +0800 IronPort-SDR: TRsYsvR+diQ7e9de2UZXYvgitV93YzqDmSTqYSwKlhVBhU03vxvDY6XPZ6TaSqMdDVv9uWlSGk aQ78FTdG0RL8uG8lOhcY9v+xNUGewW76q+PsAHHLQTKLfxA2tvnIH3r2/VsX8v+gwRfquvRDnO utGUsgGeCiKY8+MF5oe9JkBB06ddxkavBhFArlzv2M/zA/tYEh8vGjD84GS5foveOTn0gAKQoH If2Zy48fkNplbj7xHSzqdMG0HvzIPHvrh6f2tRi8xle7LSX4V4YaZinfaZ5wR1mr+QQ/QBzKJk eQmB8XjhDK5a9AyI77arcKiH Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 06 Apr 2022 01:23:24 -0700 IronPort-SDR: zidiocLyHMsXwpTGppQTKym/XKJQUtkaMWNdDO1Q3628I3ZDg2P5frM68da/yY+BdJwJ57bsxb e5q2DCurLh4HpiMTzPSnWD3EnUjlyDVe3C2lR+McWX5m5rmToL/KwkbL9Y5QnE+dhQLvNaY5zK t7+trea1g9Cg5JyCHAm4uZQfZ0VsEcyYBXyxJRGdbFg7GO3NnC+cBOPo1mTip+sPArBM9x096I JlNtcf/bj6Hgbpy1RyOxHi17XXTldk8FUymqFKzFiMl0EK2v5PKhm7dNbuSZ7unDFEGCcpL63K 7/w= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 06 Apr 2022 01:52:43 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4KYJDp2lbfz1SVp3 for ; Wed, 6 Apr 2022 01:52:42 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:content-type :in-reply-to:organization:from:references:to:content-language :subject:user-agent:mime-version:date:message-id; s=dkim; t= 1649235161; x=1651827162; bh=LFM3dJ4XtmmQmpjm/ADKwYliPf/iPacGMSt 9/3x5IFU=; b=qvkCgjbtXOykeK3hzZNeB4nFZLJBLeVyzVQiFxPBd+c54HMRQrR r3mHxfVWNdkNw5DIJA4fgfkXPh93epK0mDoQ3kgu2fpFkbSa8brjeKFgTDNdjUXK QEdaChXXlXS0VTxT7h9gL19ju3gtHs6R6Mypq0Cc5OI+h1pEURz6XYf1UQ1mcqds uMy2QNMB1cQhY28LO46skbuCxOrF4i88P2mQlM7t3vtuiUBfVFmxO2ZMvku2/0fT GRED3B4iBwE6imVQ9DU7YD88eHs1K7YN6+E1hQRftlmDiNgCGpghEuxtQnop4vN/ eOwwsoVyhIxEYaxD0ZFdcLlRFvL5b8ALceg== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 08KxBiHsagMs for ; Wed, 6 Apr 2022 01:52:41 -0700 (PDT) Received: from [10.149.53.254] (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4KYJDg4WyPz1Rvlx; Wed, 6 Apr 2022 01:52:35 -0700 (PDT) Message-ID: Date: Wed, 6 Apr 2022 17:52:34 +0900 Precedence: bulk X-Mailing-List: ntfs3@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH 14/27] block: add a bdev_max_zone_append_sectors helper Content-Language: en-US To: Christoph Hellwig , Jens Axboe Cc: dm-devel@redhat.com, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-um@lists.infradead.org, linux-block@vger.kernel.org, drbd-dev@lists.linbit.com, nbd@other.debian.org, ceph-devel@vger.kernel.org, virtualization@lists.linux-foundation.org, xen-devel@lists.xenproject.org, linux-bcache@vger.kernel.org, linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org, linux-mtd@lists.infradead.org, linux-nvme@lists.infradead.org, linux-s390@vger.kernel.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com, jfs-discussion@lists.sourceforge.net, linux-nilfs@vger.kernel.org, ntfs3@lists.linux.dev, ocfs2-devel@oss.oracle.com, linux-mm@kvack.org References: <20220406060516.409838-1-hch@lst.de> <20220406060516.409838-15-hch@lst.de> From: Damien Le Moal Organization: Western Digital Research In-Reply-To: <20220406060516.409838-15-hch@lst.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 4/6/22 15:05, Christoph Hellwig wrote: > Add a helper to check the max supported sectors for zone append based on > the block_device instead of having to poke into the block layer internal > request_queue. > > Signed-off-by: Christoph Hellwig > --- > drivers/nvme/target/zns.c | 3 +-- > fs/zonefs/super.c | 3 +-- > include/linux/blkdev.h | 6 ++++++ > 3 files changed, 8 insertions(+), 4 deletions(-) > > diff --git a/drivers/nvme/target/zns.c b/drivers/nvme/target/zns.c > index e34718b095504..82b61acf7a72b 100644 > --- a/drivers/nvme/target/zns.c > +++ b/drivers/nvme/target/zns.c > @@ -34,8 +34,7 @@ static int validate_conv_zones_cb(struct blk_zone *z, > > bool nvmet_bdev_zns_enable(struct nvmet_ns *ns) > { > - struct request_queue *q = ns->bdev->bd_disk->queue; > - u8 zasl = nvmet_zasl(queue_max_zone_append_sectors(q)); > + u8 zasl = nvmet_zasl(bdev_max_zone_append_sectors(ns->bdev)); > struct gendisk *bd_disk = ns->bdev->bd_disk; > int ret; > > diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c > index 3614c7834007d..7a63807b736c4 100644 > --- a/fs/zonefs/super.c > +++ b/fs/zonefs/super.c > @@ -678,13 +678,12 @@ static ssize_t zonefs_file_dio_append(struct kiocb *iocb, struct iov_iter *from) > struct inode *inode = file_inode(iocb->ki_filp); > struct zonefs_inode_info *zi = ZONEFS_I(inode); > struct block_device *bdev = inode->i_sb->s_bdev; > - unsigned int max; > + unsigned int max = bdev_max_zone_append_sectors(bdev); > struct bio *bio; > ssize_t size; > int nr_pages; > ssize_t ret; > > - max = queue_max_zone_append_sectors(bdev_get_queue(bdev)); > max = ALIGN_DOWN(max << SECTOR_SHIFT, inode->i_sb->s_blocksize); > iov_iter_truncate(from, max); > > diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h > index a433798c3343e..f8c50b77543eb 100644 > --- a/include/linux/blkdev.h > +++ b/include/linux/blkdev.h > @@ -1188,6 +1188,12 @@ static inline unsigned int queue_max_zone_append_sectors(const struct request_qu > return min(l->max_zone_append_sectors, l->max_sectors); > } > > +static inline unsigned int > +bdev_max_zone_append_sectors(struct block_device *bdev) > +{ > + return queue_max_zone_append_sectors(bdev_get_queue(bdev)); > +} > + > static inline unsigned queue_logical_block_size(const struct request_queue *q) > { > int retval = 512; Looks good. Acked-by: Damien Le Moal -- Damien Le Moal Western Digital Research 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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E0CE2C433EF for ; Wed, 6 Apr 2022 08:53:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=e9AvnTvDTbkCWcuiVKJYVkWe99u6c382SZGEnPGzOrA=; b=3zuAdLFxHutm7H nGZf5HFRj1nPJ+gwwU58AcKvNxVEOaS0eFCceOy4wwQKauMfKDtwAGN3n806wyWLL+7otSErVsy0g K+593pYe8Eb8MWcqidhMuDkluKLA/z6rSrVpqAKwrHB0mWg5QwKl0PKIhqxA+nZCP9AsKuJQThjlP /0+4xUw/PRm50aaEMy0TRAkClym5Y/Qo6jwDp0mE/JIMuVpWDu6koxyReKBdOtJ9+TlTzmp4bnNNO Q1sA5/Kp+YFZXvF3KAHeQnPpb9TZDiqlBrQNAulVGPvbTe2eGfGtt/bviOxZAGxIHnsnLPYz2vjgl yOIm/GMX5nVzxNFDRyPw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nc1PG-004paG-4Q; Wed, 06 Apr 2022 08:52:50 +0000 Received: from esa1.hgst.iphmx.com ([68.232.141.245]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nc1PC-004pXk-G9 for linux-mtd@lists.infradead.org; Wed, 06 Apr 2022 08:52:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1649235166; x=1680771166; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=LFM3dJ4XtmmQmpjm/ADKwYliPf/iPacGMSt9/3x5IFU=; b=hmhLN3V5Z6I/dn0yqIgflvVCJzkcT0OG42JXTzhuKlithAaWuoMFy5k1 PxqIU97/5aoxQWEl03MvKvQ4y+HieZ1mhtNVYm2PxiUQIkj6ADANNPgYI qRyTmcV+yOYApZ80cHLmOsitoiv0ASq2aHeADxtS7fy83UXvYBnuqPY5L G9RwisIuGeyJ0qLPczRLOdGGjgdXFykgZQmvwXANVyhf7tVFMRN2no8Df jYMWFWOiVsejgWa7Duz/lSs35ckMQC4Y+rlUJze+dM9kEeH0ebWUvDr0S nqjfSW7RZbg0jski/seH1sHngdreweombUZRq9k03qX9kaeuchnAVBnpo A==; X-IronPort-AV: E=Sophos;i="5.90,239,1643644800"; d="scan'208";a="309182681" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 06 Apr 2022 16:52:42 +0800 IronPort-SDR: IcA5eeNKdupme8898KQS8hPffYOnXCpB+gvYaJZO+/3mET/IHoMX2MLdM5sfMP5qpPSXnCnct3 xLAuRy79WakL+aIkz8EEegYXoF8pAn+DTHuLG7Zlcso/s9S+2UakPsSNvDNBHmopxb/lG5bvwK Owv6cnYejNZ6azB7SyvGUFgNBCKQmO7aSZrpFqfoVrxKSHKlzZRFXSNIBvD0GhIcAV5CLenBGW MpY0hIFO0pZ+zSBXiD1BY7vCrhasdX1mi6NBDxgoHT4Hnl07BLt0SXKhNKibhzlw7qjQja1F1M iC6O7jEESrKQUt+ZJ9N+YEiM Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 06 Apr 2022 01:23:23 -0700 IronPort-SDR: qgH03MZCfPOpnBSEkDB16Sb9J7X4riyZjNGIU/gQ+Us/KDAA/5ulmOFrZ3q0hKfD/+E1R3kTLQ r3MnAfC8uILYkNuDLbTGEXCy5Uc0cVr3lCI7i84oOHBsyWtHTXbk6HNlvpmpdWifI6zxLtZNfU nkM1F/1g7jVFPTxwYITNA7RyjeKWKlOR4n/BFVpSjWMooY2SYNr5aM2R0hSkqT1DUaEdtJftQQ idYTVoQVe9aZnsKcpAe6YBG/WwBrKi2mE3N2A4IxbqJuQT7PR0G1KJymplrC7sik1Zv/G2IwYM 5A8= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 06 Apr 2022 01:52:43 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4KYJDn1q5yz1SVp5 for ; Wed, 6 Apr 2022 01:52:41 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:content-type :in-reply-to:organization:from:references:to:content-language :subject:user-agent:mime-version:date:message-id; s=dkim; t= 1649235160; x=1651827161; bh=LFM3dJ4XtmmQmpjm/ADKwYliPf/iPacGMSt 9/3x5IFU=; b=FzUociJ5h7WAQTsg6/of1WcVO/OsM8WZr8TGwq4XsiCjPsWYnIG 8/w+gKZQabfM5/6lPmJQreKk5Ou6wFCFKuKzU34LNEBfiEEQgQdKgaFRiQjCbS+v bXmYOK12GNp/Ja0XBlu9I1309M6iplipC0iSH4zUASq/4DY1Z1ntJWZZ2gnz7v04 gr+tHwiyI12IKqfvshI8zep4+bgj/F03PH6lDam0sCy+54uxyIAUOpes7fa1mbqW oKbTS+GZl8C4hDtpg8QtlcOVicbeOAAs2w8xnnXnZGy/42U80yMH8z7K4uMfNY4W C4OWYxx5B6+JAZVIxV0TMfw3Lljnnr2SA9w== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id kwVH3luVvLi3 for ; Wed, 6 Apr 2022 01:52:40 -0700 (PDT) Received: from [10.149.53.254] (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4KYJDg4WyPz1Rvlx; Wed, 6 Apr 2022 01:52:35 -0700 (PDT) Message-ID: Date: Wed, 6 Apr 2022 17:52:34 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH 14/27] block: add a bdev_max_zone_append_sectors helper Content-Language: en-US To: Christoph Hellwig , Jens Axboe Cc: dm-devel@redhat.com, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-um@lists.infradead.org, linux-block@vger.kernel.org, drbd-dev@lists.linbit.com, nbd@other.debian.org, ceph-devel@vger.kernel.org, virtualization@lists.linux-foundation.org, xen-devel@lists.xenproject.org, linux-bcache@vger.kernel.org, linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org, linux-mtd@lists.infradead.org, linux-nvme@lists.infradead.org, linux-s390@vger.kernel.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com, jfs-discussion@lists.sourceforge.net, linux-nilfs@vger.kernel.org, ntfs3@lists.linux.dev, ocfs2-devel@oss.oracle.com, linux-mm@kvack.org References: <20220406060516.409838-1-hch@lst.de> <20220406060516.409838-15-hch@lst.de> From: Damien Le Moal Organization: Western Digital Research In-Reply-To: <20220406060516.409838-15-hch@lst.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220406_015246_630064_2757C9ED X-CRM114-Status: GOOD ( 22.03 ) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-mtd" Errors-To: linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org On 4/6/22 15:05, Christoph Hellwig wrote: > Add a helper to check the max supported sectors for zone append based on > the block_device instead of having to poke into the block layer internal > request_queue. > > Signed-off-by: Christoph Hellwig > --- > drivers/nvme/target/zns.c | 3 +-- > fs/zonefs/super.c | 3 +-- > include/linux/blkdev.h | 6 ++++++ > 3 files changed, 8 insertions(+), 4 deletions(-) > > diff --git a/drivers/nvme/target/zns.c b/drivers/nvme/target/zns.c > index e34718b095504..82b61acf7a72b 100644 > --- a/drivers/nvme/target/zns.c > +++ b/drivers/nvme/target/zns.c > @@ -34,8 +34,7 @@ static int validate_conv_zones_cb(struct blk_zone *z, > > bool nvmet_bdev_zns_enable(struct nvmet_ns *ns) > { > - struct request_queue *q = ns->bdev->bd_disk->queue; > - u8 zasl = nvmet_zasl(queue_max_zone_append_sectors(q)); > + u8 zasl = nvmet_zasl(bdev_max_zone_append_sectors(ns->bdev)); > struct gendisk *bd_disk = ns->bdev->bd_disk; > int ret; > > diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c > index 3614c7834007d..7a63807b736c4 100644 > --- a/fs/zonefs/super.c > +++ b/fs/zonefs/super.c > @@ -678,13 +678,12 @@ static ssize_t zonefs_file_dio_append(struct kiocb *iocb, struct iov_iter *from) > struct inode *inode = file_inode(iocb->ki_filp); > struct zonefs_inode_info *zi = ZONEFS_I(inode); > struct block_device *bdev = inode->i_sb->s_bdev; > - unsigned int max; > + unsigned int max = bdev_max_zone_append_sectors(bdev); > struct bio *bio; > ssize_t size; > int nr_pages; > ssize_t ret; > > - max = queue_max_zone_append_sectors(bdev_get_queue(bdev)); > max = ALIGN_DOWN(max << SECTOR_SHIFT, inode->i_sb->s_blocksize); > iov_iter_truncate(from, max); > > diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h > index a433798c3343e..f8c50b77543eb 100644 > --- a/include/linux/blkdev.h > +++ b/include/linux/blkdev.h > @@ -1188,6 +1188,12 @@ static inline unsigned int queue_max_zone_append_sectors(const struct request_qu > return min(l->max_zone_append_sectors, l->max_sectors); > } > > +static inline unsigned int > +bdev_max_zone_append_sectors(struct block_device *bdev) > +{ > + return queue_max_zone_append_sectors(bdev_get_queue(bdev)); > +} > + > static inline unsigned queue_logical_block_size(const struct request_queue *q) > { > int retval = 512; Looks good. Acked-by: Damien Le Moal -- Damien Le Moal Western Digital Research ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ 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 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7DD50C433F5 for ; Wed, 6 Apr 2022 08:54:03 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-620-5LK0kytbNCOqq5orlAOgGQ-1; Wed, 06 Apr 2022 04:53:59 -0400 X-MC-Unique: 5LK0kytbNCOqq5orlAOgGQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 53526899EC5; Wed, 6 Apr 2022 08:53:57 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2C6377AF0; Wed, 6 Apr 2022 08:53:56 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D431D1940369; Wed, 6 Apr 2022 08:53:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 00FF51947BBB for ; Wed, 6 Apr 2022 08:53:54 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id D35777AE4; Wed, 6 Apr 2022 08:53:54 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CECB57AE8 for ; Wed, 6 Apr 2022 08:53:47 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A4444185A79C for ; Wed, 6 Apr 2022 08:53:47 +0000 (UTC) Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-554-eIrEUuPIMACS7351Xg4vXQ-2; Wed, 06 Apr 2022 04:53:46 -0400 X-MC-Unique: eIrEUuPIMACS7351Xg4vXQ-2 X-IronPort-AV: E=Sophos;i="5.90,239,1643644800"; d="scan'208";a="196092186" 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; 06 Apr 2022 16:52:43 +0800 IronPort-SDR: EMfp12JdwWzjejd18+fwVqxukBDODbD11IUMA8yhFWa2t+kPtUpfWDvDXfovJkRXDWdlgEFDvz 2/DtZ1nuyuE5knUkWEGVew/ObDgIgKM3PCjdo6pfYhmB5Wxzx90unEP8b3+H9HF5soUm4l1jru tlaMmtiUULd/t5GIjJ8hi4pNd9sMKQ/oox7naG7/NKb04d/3yNwYafD/lMUnL115KenwDgZcsO 8/4ws75Dp+Q39PtyPABtv6DBoHZOQ6FtETgTZyQwj3yOoNBO8DAMZL3dEN8LWjxDMTlhmUTwDm UTMfNOtRycwZz0HfO2NkWqWr Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 06 Apr 2022 01:23:23 -0700 IronPort-SDR: yG22vGsaFb1fBPPaemoPc658Nm/5U7faqQFbLGcaminxUHvKPWbYDx+tNQ6TQ2ya4Dp9Y3418k pYr2w97PTn8K3QYk3EYmCUGlmM66cWuIa/XmJ1oQNTVBLUyGQPyEjm8fzIId7TZJfnMZww0+v4 MrwMc3wfUKhiYb86jGAaazXsm+3mJhfWzsfwJRJ4RfE8T4xQsp+OA4UaNnP6jROrie9VaLLXvM YplOep7H6Uc/6YlhwzVy48tgG42Z92LwagoJ7sFihtzcvoUOkvXaCfvs3wvsV8N5ePyLo427uT 3Hg= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 06 Apr 2022 01:52:43 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4KYJDm63jQz1SVp2 for ; Wed, 6 Apr 2022 01:52:40 -0700 (PDT) X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id W8X_HfGUuR1K for ; Wed, 6 Apr 2022 01:52:39 -0700 (PDT) Received: from [10.149.53.254] (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4KYJDg4WyPz1Rvlx; Wed, 6 Apr 2022 01:52:35 -0700 (PDT) Message-ID: Date: Wed, 6 Apr 2022 17:52:34 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 To: Christoph Hellwig , Jens Axboe References: <20220406060516.409838-1-hch@lst.de> <20220406060516.409838-15-hch@lst.de> From: Damien Le Moal Organization: Western Digital Research In-Reply-To: <20220406060516.409838-15-hch@lst.de> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 Subject: Re: [dm-devel] [PATCH 14/27] block: add a bdev_max_zone_append_sectors helper X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jfs-discussion@lists.sourceforge.net, linux-nvme@lists.infradead.org, virtualization@lists.linux-foundation.org, linux-mm@kvack.org, dm-devel@redhat.com, target-devel@vger.kernel.org, linux-mtd@lists.infradead.org, drbd-dev@lists.linbit.com, linux-s390@vger.kernel.org, linux-nilfs@vger.kernel.org, linux-scsi@vger.kernel.org, cluster-devel@redhat.com, xen-devel@lists.xenproject.org, linux-ext4@vger.kernel.org, linux-um@lists.infradead.org, nbd@other.debian.org, linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, ceph-devel@vger.kernel.org, linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org, ocfs2-devel@oss.oracle.com, linux-fsdevel@vger.kernel.org, ntfs3@lists.linux.dev, linux-btrfs@vger.kernel.org Errors-To: dm-devel-bounces@redhat.com Sender: "dm-devel" X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" On 4/6/22 15:05, Christoph Hellwig wrote: > Add a helper to check the max supported sectors for zone append based on > the block_device instead of having to poke into the block layer internal > request_queue. > > Signed-off-by: Christoph Hellwig > --- > drivers/nvme/target/zns.c | 3 +-- > fs/zonefs/super.c | 3 +-- > include/linux/blkdev.h | 6 ++++++ > 3 files changed, 8 insertions(+), 4 deletions(-) > > diff --git a/drivers/nvme/target/zns.c b/drivers/nvme/target/zns.c > index e34718b095504..82b61acf7a72b 100644 > --- a/drivers/nvme/target/zns.c > +++ b/drivers/nvme/target/zns.c > @@ -34,8 +34,7 @@ static int validate_conv_zones_cb(struct blk_zone *z, > > bool nvmet_bdev_zns_enable(struct nvmet_ns *ns) > { > - struct request_queue *q = ns->bdev->bd_disk->queue; > - u8 zasl = nvmet_zasl(queue_max_zone_append_sectors(q)); > + u8 zasl = nvmet_zasl(bdev_max_zone_append_sectors(ns->bdev)); > struct gendisk *bd_disk = ns->bdev->bd_disk; > int ret; > > diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c > index 3614c7834007d..7a63807b736c4 100644 > --- a/fs/zonefs/super.c > +++ b/fs/zonefs/super.c > @@ -678,13 +678,12 @@ static ssize_t zonefs_file_dio_append(struct kiocb *iocb, struct iov_iter *from) > struct inode *inode = file_inode(iocb->ki_filp); > struct zonefs_inode_info *zi = ZONEFS_I(inode); > struct block_device *bdev = inode->i_sb->s_bdev; > - unsigned int max; > + unsigned int max = bdev_max_zone_append_sectors(bdev); > struct bio *bio; > ssize_t size; > int nr_pages; > ssize_t ret; > > - max = queue_max_zone_append_sectors(bdev_get_queue(bdev)); > max = ALIGN_DOWN(max << SECTOR_SHIFT, inode->i_sb->s_blocksize); > iov_iter_truncate(from, max); > > diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h > index a433798c3343e..f8c50b77543eb 100644 > --- a/include/linux/blkdev.h > +++ b/include/linux/blkdev.h > @@ -1188,6 +1188,12 @@ static inline unsigned int queue_max_zone_append_sectors(const struct request_qu > return min(l->max_zone_append_sectors, l->max_sectors); > } > > +static inline unsigned int > +bdev_max_zone_append_sectors(struct block_device *bdev) > +{ > + return queue_max_zone_append_sectors(bdev_get_queue(bdev)); > +} > + > static inline unsigned queue_logical_block_size(const struct request_queue *q) > { > int retval = 512; Looks good. Acked-by: Damien Le Moal -- Damien Le Moal Western Digital Research -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel 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 Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 33666C433F5 for ; Wed, 6 Apr 2022 09:08:28 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.94.2) (envelope-from ) id 1nc1eL-0003RB-H2; Wed, 06 Apr 2022 09:08:26 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nc1eK-0003R5-07 for linux-f2fs-devel@lists.sourceforge.net; Wed, 06 Apr 2022 09:08:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: From:References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=6e5T+sIABv1llA3nY2078mDuWVILL0MDZSdgf8H3bng=; b=d2kTXeM3dhvILBzm34gUjjzn08 qCnJBo0WINeMduYqSzRhBD7hERIZartQPAp1ruYlaqBeu0XPZhNqppHMt+a+RdAZoGYpmAeorL8Ch UqDqjzQ3No2USVerHXxGAHyq6/pH+xmaYWrXSYrtvG5C7IW0b4zaEXnQVYl0QGhr66ss=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=6e5T+sIABv1llA3nY2078mDuWVILL0MDZSdgf8H3bng=; b=UUNy16cFz/IoGzDaCxPgB05dBj hWOv1UcjkCFjFLKTG4Pdz5vjOd4A+aa0qezT+ewrtrc/nJf10oAYXZHfq9FWAlLpqlq6AVT45m/Lx GbH+jH3K6ef/3A7EFx0X27dqkUJ00g6srh9oY91kZv0jIasQKQ32ell8g1uc131i+SSU=; Received: from esa1.hgst.iphmx.com ([68.232.141.245]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.94.2) id 1nc1eI-0003II-Rw for linux-f2fs-devel@lists.sourceforge.net; Wed, 06 Apr 2022 09:08:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1649236102; x=1680772102; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=LFM3dJ4XtmmQmpjm/ADKwYliPf/iPacGMSt9/3x5IFU=; b=CIDsKfXUSPoHVLEmF5EMggI/M3x6VlcZxK8tgN+PIW+gMkvjvUKdx42T Q9GsOoPMMjQyVSWVei5EVTdWNWBgpO6tww8k6o9l9FleExHZmS8qK7MGy 6HS9QRV/5kKuLCaFx2cV7rMuYKnQ/8MzBkZ1JiY+W0uEmTjv9lbDUuwi5 LRgYxO6Bli4CItm7Y6Gv32yynRLunxJsqFP3tTWtTGzBzy+OeXDzm+nQq hGmUUjYddxYlisaRJyxe7uIMEjStesXYsepLwjY6NQEzv9FSmi006YB4S sBi9uQxaBD7TL3dAyrRxIPVFN6Q+gQkhJ9Jx1ryXCCYs29vhkXdeNeQmr Q==; X-IronPort-AV: E=Sophos;i="5.90,239,1643644800"; d="scan'208";a="309182687" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 06 Apr 2022 16:52:42 +0800 IronPort-SDR: +GrlBtZ1OFU1N/Ejtao+u+zvAeK5P0qEUNEsin9+Rpsjg3/LNLx4ERcbrWDSZlb0NB/mB27tRY KZsp9UZhERtAbkfVxvYWk4tLd7f2phRiGK8oFAvGaa0khC6RwLt8P5EiBYd4XMUk1trcujop+2 qexzksF+xZiMQCeJv4gjoLQ6ltoEg8v+RJ8GVdn+GD5HyDj1rD13bQt2krh8YKwbYV8O8GnLQj QvAIy7oqZLRH50fe+vQwvyLdMXt9yfFhpdpFdbWjWayqmD8fzfIk01xDzNJz1OtPJigvi+iyX8 zFTmln2BcXuqX3GH+rZWqEEB Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 06 Apr 2022 01:24:14 -0700 IronPort-SDR: /jX1sACLHMLkOJ7j2ebv9+i+yZTgGvJfveA1HTG8y8CXdgDVs0d7YJDhrLBcMH7oq9y2RQjm+3 k4oMrislKzo5aRUnrYmfHgDw+5mpvGZA99qvnk4/P+lNaF0te+RfVVVk3ou2reDNvH0SCh2gyH 1xpFVjHiiDMAB59RqL2KtooOIuvHIYhg4ZlPNnbohZHaOoK/0gln2+OHhk4LuslfpiRwse3dvm KR6TrmlKOPLOn4VrJqZpB8vzn1tm00rGUojtclTY6BTTP10J29hCyqgghqIJUo4KqJJPeXZEp2 bBM= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 06 Apr 2022 01:52:43 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4KYJDn2rpGz1SVpC for ; Wed, 6 Apr 2022 01:52:41 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:content-type :in-reply-to:organization:from:references:to:content-language :subject:user-agent:mime-version:date:message-id; s=dkim; t= 1649235160; x=1651827161; bh=LFM3dJ4XtmmQmpjm/ADKwYliPf/iPacGMSt 9/3x5IFU=; b=FzUociJ5h7WAQTsg6/of1WcVO/OsM8WZr8TGwq4XsiCjPsWYnIG 8/w+gKZQabfM5/6lPmJQreKk5Ou6wFCFKuKzU34LNEBfiEEQgQdKgaFRiQjCbS+v bXmYOK12GNp/Ja0XBlu9I1309M6iplipC0iSH4zUASq/4DY1Z1ntJWZZ2gnz7v04 gr+tHwiyI12IKqfvshI8zep4+bgj/F03PH6lDam0sCy+54uxyIAUOpes7fa1mbqW oKbTS+GZl8C4hDtpg8QtlcOVicbeOAAs2w8xnnXnZGy/42U80yMH8z7K4uMfNY4W C4OWYxx5B6+JAZVIxV0TMfw3Lljnnr2SA9w== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Yl01hQ9mFsNX for ; Wed, 6 Apr 2022 01:52:40 -0700 (PDT) Received: from [10.149.53.254] (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4KYJDg4WyPz1Rvlx; Wed, 6 Apr 2022 01:52:35 -0700 (PDT) Message-ID: Date: Wed, 6 Apr 2022 17:52:34 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Content-Language: en-US To: Christoph Hellwig , Jens Axboe References: <20220406060516.409838-1-hch@lst.de> <20220406060516.409838-15-hch@lst.de> Organization: Western Digital Research In-Reply-To: <20220406060516.409838-15-hch@lst.de> X-Headers-End: 1nc1eI-0003II-Rw Subject: Re: [f2fs-dev] [PATCH 14/27] block: add a bdev_max_zone_append_sectors helper X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Damien Le Moal via Linux-f2fs-devel Reply-To: Damien Le Moal Cc: jfs-discussion@lists.sourceforge.net, linux-nvme@lists.infradead.org, virtualization@lists.linux-foundation.org, linux-mm@kvack.org, dm-devel@redhat.com, target-devel@vger.kernel.org, linux-mtd@lists.infradead.org, drbd-dev@lists.linbit.com, linux-s390@vger.kernel.org, linux-nilfs@vger.kernel.org, linux-scsi@vger.kernel.org, cluster-devel@redhat.com, xen-devel@lists.xenproject.org, linux-ext4@vger.kernel.org, linux-um@lists.infradead.org, nbd@other.debian.org, linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, ceph-devel@vger.kernel.org, linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org, ocfs2-devel@oss.oracle.com, linux-fsdevel@vger.kernel.org, ntfs3@lists.linux.dev, linux-btrfs@vger.kernel.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net On 4/6/22 15:05, Christoph Hellwig wrote: > Add a helper to check the max supported sectors for zone append based on > the block_device instead of having to poke into the block layer internal > request_queue. > > Signed-off-by: Christoph Hellwig > --- > drivers/nvme/target/zns.c | 3 +-- > fs/zonefs/super.c | 3 +-- > include/linux/blkdev.h | 6 ++++++ > 3 files changed, 8 insertions(+), 4 deletions(-) > > diff --git a/drivers/nvme/target/zns.c b/drivers/nvme/target/zns.c > index e34718b095504..82b61acf7a72b 100644 > --- a/drivers/nvme/target/zns.c > +++ b/drivers/nvme/target/zns.c > @@ -34,8 +34,7 @@ static int validate_conv_zones_cb(struct blk_zone *z, > > bool nvmet_bdev_zns_enable(struct nvmet_ns *ns) > { > - struct request_queue *q = ns->bdev->bd_disk->queue; > - u8 zasl = nvmet_zasl(queue_max_zone_append_sectors(q)); > + u8 zasl = nvmet_zasl(bdev_max_zone_append_sectors(ns->bdev)); > struct gendisk *bd_disk = ns->bdev->bd_disk; > int ret; > > diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c > index 3614c7834007d..7a63807b736c4 100644 > --- a/fs/zonefs/super.c > +++ b/fs/zonefs/super.c > @@ -678,13 +678,12 @@ static ssize_t zonefs_file_dio_append(struct kiocb *iocb, struct iov_iter *from) > struct inode *inode = file_inode(iocb->ki_filp); > struct zonefs_inode_info *zi = ZONEFS_I(inode); > struct block_device *bdev = inode->i_sb->s_bdev; > - unsigned int max; > + unsigned int max = bdev_max_zone_append_sectors(bdev); > struct bio *bio; > ssize_t size; > int nr_pages; > ssize_t ret; > > - max = queue_max_zone_append_sectors(bdev_get_queue(bdev)); > max = ALIGN_DOWN(max << SECTOR_SHIFT, inode->i_sb->s_blocksize); > iov_iter_truncate(from, max); > > diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h > index a433798c3343e..f8c50b77543eb 100644 > --- a/include/linux/blkdev.h > +++ b/include/linux/blkdev.h > @@ -1188,6 +1188,12 @@ static inline unsigned int queue_max_zone_append_sectors(const struct request_qu > return min(l->max_zone_append_sectors, l->max_sectors); > } > > +static inline unsigned int > +bdev_max_zone_append_sectors(struct block_device *bdev) > +{ > + return queue_max_zone_append_sectors(bdev_get_queue(bdev)); > +} > + > static inline unsigned queue_logical_block_size(const struct request_queue *q) > { > int retval = 512; Looks good. Acked-by: Damien Le Moal -- Damien Le Moal Western Digital Research _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa1.hgst.iphmx.com ([68.232.141.245]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nc1PE-004pZP-K4 for linux-um@lists.infradead.org; Wed, 06 Apr 2022 08:52:50 +0000 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4KYJDp2RWvz1SVp0 for ; Wed, 6 Apr 2022 01:52:42 -0700 (PDT) Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id uR0jpi7Uo5Pe for ; Wed, 6 Apr 2022 01:52:40 -0700 (PDT) Message-ID: Date: Wed, 6 Apr 2022 17:52:34 +0900 MIME-Version: 1.0 Subject: Re: [PATCH 14/27] block: add a bdev_max_zone_append_sectors helper Content-Language: en-US References: <20220406060516.409838-1-hch@lst.de> <20220406060516.409838-15-hch@lst.de> From: Damien Le Moal In-Reply-To: <20220406060516.409838-15-hch@lst.de> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-um" Errors-To: linux-um-bounces+geert=linux-m68k.org@lists.infradead.org To: Christoph Hellwig , Jens Axboe Cc: dm-devel@redhat.com, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-um@lists.infradead.org, linux-block@vger.kernel.org, drbd-dev@lists.linbit.com, nbd@other.debian.org, ceph-devel@vger.kernel.org, virtualization@lists.linux-foundation.org, xen-devel@lists.xenproject.org, linux-bcache@vger.kernel.org, linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org, linux-mtd@lists.infradead.org, linux-nvme@lists.infradead.org, linux-s390@vger.kernel.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com, jfs-discussion@lists.sourceforge.net, linux-nilfs@vger.kernel.org, ntfs3@lists.linux.dev, ocfs2-devel@oss.oracle.com, linux-mm@kvack.org On 4/6/22 15:05, Christoph Hellwig wrote: > Add a helper to check the max supported sectors for zone append based on > the block_device instead of having to poke into the block layer internal > request_queue. > > Signed-off-by: Christoph Hellwig > --- > drivers/nvme/target/zns.c | 3 +-- > fs/zonefs/super.c | 3 +-- > include/linux/blkdev.h | 6 ++++++ > 3 files changed, 8 insertions(+), 4 deletions(-) > > diff --git a/drivers/nvme/target/zns.c b/drivers/nvme/target/zns.c > index e34718b095504..82b61acf7a72b 100644 > --- a/drivers/nvme/target/zns.c > +++ b/drivers/nvme/target/zns.c > @@ -34,8 +34,7 @@ static int validate_conv_zones_cb(struct blk_zone *z, > > bool nvmet_bdev_zns_enable(struct nvmet_ns *ns) > { > - struct request_queue *q = ns->bdev->bd_disk->queue; > - u8 zasl = nvmet_zasl(queue_max_zone_append_sectors(q)); > + u8 zasl = nvmet_zasl(bdev_max_zone_append_sectors(ns->bdev)); > struct gendisk *bd_disk = ns->bdev->bd_disk; > int ret; > > diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c > index 3614c7834007d..7a63807b736c4 100644 > --- a/fs/zonefs/super.c > +++ b/fs/zonefs/super.c > @@ -678,13 +678,12 @@ static ssize_t zonefs_file_dio_append(struct kiocb *iocb, struct iov_iter *from) > struct inode *inode = file_inode(iocb->ki_filp); > struct zonefs_inode_info *zi = ZONEFS_I(inode); > struct block_device *bdev = inode->i_sb->s_bdev; > - unsigned int max; > + unsigned int max = bdev_max_zone_append_sectors(bdev); > struct bio *bio; > ssize_t size; > int nr_pages; > ssize_t ret; > > - max = queue_max_zone_append_sectors(bdev_get_queue(bdev)); > max = ALIGN_DOWN(max << SECTOR_SHIFT, inode->i_sb->s_blocksize); > iov_iter_truncate(from, max); > > diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h > index a433798c3343e..f8c50b77543eb 100644 > --- a/include/linux/blkdev.h > +++ b/include/linux/blkdev.h > @@ -1188,6 +1188,12 @@ static inline unsigned int queue_max_zone_append_sectors(const struct request_qu > return min(l->max_zone_append_sectors, l->max_sectors); > } > > +static inline unsigned int > +bdev_max_zone_append_sectors(struct block_device *bdev) > +{ > + return queue_max_zone_append_sectors(bdev_get_queue(bdev)); > +} > + > static inline unsigned queue_logical_block_size(const struct request_queue *q) > { > int retval = 512; Looks good. Acked-by: Damien Le Moal -- Damien Le Moal Western Digital Research _______________________________________________ linux-um mailing list linux-um@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-um From mboxrd@z Thu Jan 1 00:00:00 1970 From: Damien Le Moal Date: Wed, 6 Apr 2022 17:52:34 +0900 Subject: [Cluster-devel] [PATCH 14/27] block: add a bdev_max_zone_append_sectors helper In-Reply-To: <20220406060516.409838-15-hch@lst.de> References: <20220406060516.409838-1-hch@lst.de> <20220406060516.409838-15-hch@lst.de> Message-ID: List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On 4/6/22 15:05, Christoph Hellwig wrote: > Add a helper to check the max supported sectors for zone append based on > the block_device instead of having to poke into the block layer internal > request_queue. > > Signed-off-by: Christoph Hellwig > --- > drivers/nvme/target/zns.c | 3 +-- > fs/zonefs/super.c | 3 +-- > include/linux/blkdev.h | 6 ++++++ > 3 files changed, 8 insertions(+), 4 deletions(-) > > diff --git a/drivers/nvme/target/zns.c b/drivers/nvme/target/zns.c > index e34718b095504..82b61acf7a72b 100644 > --- a/drivers/nvme/target/zns.c > +++ b/drivers/nvme/target/zns.c > @@ -34,8 +34,7 @@ static int validate_conv_zones_cb(struct blk_zone *z, > > bool nvmet_bdev_zns_enable(struct nvmet_ns *ns) > { > - struct request_queue *q = ns->bdev->bd_disk->queue; > - u8 zasl = nvmet_zasl(queue_max_zone_append_sectors(q)); > + u8 zasl = nvmet_zasl(bdev_max_zone_append_sectors(ns->bdev)); > struct gendisk *bd_disk = ns->bdev->bd_disk; > int ret; > > diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c > index 3614c7834007d..7a63807b736c4 100644 > --- a/fs/zonefs/super.c > +++ b/fs/zonefs/super.c > @@ -678,13 +678,12 @@ static ssize_t zonefs_file_dio_append(struct kiocb *iocb, struct iov_iter *from) > struct inode *inode = file_inode(iocb->ki_filp); > struct zonefs_inode_info *zi = ZONEFS_I(inode); > struct block_device *bdev = inode->i_sb->s_bdev; > - unsigned int max; > + unsigned int max = bdev_max_zone_append_sectors(bdev); > struct bio *bio; > ssize_t size; > int nr_pages; > ssize_t ret; > > - max = queue_max_zone_append_sectors(bdev_get_queue(bdev)); > max = ALIGN_DOWN(max << SECTOR_SHIFT, inode->i_sb->s_blocksize); > iov_iter_truncate(from, max); > > diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h > index a433798c3343e..f8c50b77543eb 100644 > --- a/include/linux/blkdev.h > +++ b/include/linux/blkdev.h > @@ -1188,6 +1188,12 @@ static inline unsigned int queue_max_zone_append_sectors(const struct request_qu > return min(l->max_zone_append_sectors, l->max_sectors); > } > > +static inline unsigned int > +bdev_max_zone_append_sectors(struct block_device *bdev) > +{ > + return queue_max_zone_append_sectors(bdev_get_queue(bdev)); > +} > + > static inline unsigned queue_logical_block_size(const struct request_queue *q) > { > int retval = 512; Looks good. Acked-by: Damien Le Moal -- Damien Le Moal Western Digital Research