From patchwork Fri Feb 3 15:06:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13127841 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0CF2EC636D7 for ; Fri, 3 Feb 2023 15:07:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 056B76B0080; Fri, 3 Feb 2023 10:07:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E8E856B007B; Fri, 3 Feb 2023 10:07:48 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C448D6B0072; Fri, 3 Feb 2023 10:07:48 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id A99E36B0072 for ; Fri, 3 Feb 2023 10:07:48 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 50B9641116 for ; Fri, 3 Feb 2023 15:07:48 +0000 (UTC) X-FDA: 80426310216.27.C186200 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf05.hostedemail.com (Postfix) with ESMTP id 3FF22100007 for ; Fri, 3 Feb 2023 15:07:45 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=jThz1+8n; dmarc=none; spf=none (imf05.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675436866; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=0dnvJ4/YC2qBSRJoUXjkVbZEbeJtTI76nFk14xqdiQw=; b=t+TLGreoD6Mpv7qIlKzFedb9CpA5/68VrF8qbJav6mqgG9uUN+yt3+E6oHj8jyFGPTdPJ9 hT4J3ZBbAixGDVc8qmp020slZgRGTBn/RRUkGIP/xJJr4DnDL3M8kd9jd/JJRq+9V6/AQC C5edfNKQTbJ2LY6QsJBS52WxXfjdD/Y= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=jThz1+8n; dmarc=none; spf=none (imf05.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675436866; a=rsa-sha256; cv=none; b=xQx/CeeCgAqqNIorAJqrQSVqU2kRiCvI5cd5kllg6dqmlB3/6p7OIQlnnuU3QyTKRtiaCk pnSyBeM1CRCmcKspj8zLku32CIH5RYLRc5aoi+5HX23U7nhPVKAwe1j252waiIlgiTDxs/ AkR8QsBuAN8Z1fPtkejmy3dDuhUqH2E= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=0dnvJ4/YC2qBSRJoUXjkVbZEbeJtTI76nFk14xqdiQw=; b=jThz1+8n2gvxR38Zi9f42VmE45 A0CQMmeY4zEOFyZVpnGrj7P3ElL65WJv08LoA8qb4oLRV9x/A+fETre1KW3oI0WTHrjKsgFn+udP9 s8a7hrQusDgbFYCjIl78yvwptpj2jEEGnKDDzqCGq/bYeCWCTdbYIGBEdQ6rFkqzFD5JMgegY/DME 2+tmqE2azh6NMd1kOiaut0xU3w249YI9lKsJhI7VvYjZLGRpGu26md2fN2faz+WSsNcmtIb3zqiwu pTf6YtHpE9SOvDbM4uz3U03Q9zSNtoPuZYSLX0u2MBqlOX+a5b/Mm5OP0GBEkpqNc/X1qmsSVgNln AYxdeXlw==; Received: from [2001:4bb8:19a:272a:910:bb67:7287:f956] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNxeB-002ac4-UN; Fri, 03 Feb 2023 15:06:40 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Ilya Dryomov , "Michael S. Tsirkin" , Jason Wang , Minchan Kim , Sergey Senozhatsky , Keith Busch , Sagi Grimberg , Chaitanya Kulkarni , "Martin K. Petersen" , David Howells , Marc Dionne , Xiubo Li , Steve French , Trond Myklebust , Anna Schumaker , Mike Marshall , Andrew Morton , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Chuck Lever , linux-block@vger.kernel.org, ceph-devel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, kvm@vger.kernel.org, netdev@vger.kernel.org, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, devel@lists.orangefs.org, io-uring@vger.kernel.org, linux-mm@kvack.org, Johannes Thumshirn Subject: [PATCH 01/23] block: factor out a bvec_set_page helper Date: Fri, 3 Feb 2023 16:06:12 +0100 Message-Id: <20230203150634.3199647-2-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230203150634.3199647-1-hch@lst.de> References: <20230203150634.3199647-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspamd-Queue-Id: 3FF22100007 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: 3uhxndmorgpsrr1rrpr7hx1g6ejm61iw X-HE-Tag: 1675436865-956229 X-HE-Meta: U2FsdGVkX18wC5ZA1OWDY5VF4hWoEDHkesx3nmtd/Zuigqtqycictwxqyg8l6JXfdJmUT8MR6pCCFjay7P02Un6HsSe/8tssHvUk0wf1ameMtroLGPrOzdD1ZL+5qy5b2eHK5YxCdb/r0PXVtTKvn23LvZXO4GjO8LAn2iHd9i6dVCO+SHR/Rd4Wc2tNMqzg5/I2WCRiKU5WihjNCFDl/wa86P6W143Ylf+4gKCrDNasLsl70PoSaGqQ9ZVrvDJjHMUfiMZuA9KHsV0/u+FoCR6z0FNGOxW8ATA7LX1hAbnAvOV7RHhgm0OL0AwxsWEIRDFgXTI9hhoF7jTfQ1jLXRhwb4tUHeM+QvqMYVdDNdLkVL9D/FT5nIe29vADJ7BN5fvNP7nGn/Ztyu3BhPB1A0Ywf1hVSDMZ1pAfA6epts4rxnpjHfAflcJnA/LXqtkMyfTHJbB5Fn6jH7rASOH5L7MG0sylDhNryKYbGqQDZvxZuFMya/LfII95lmuKvyEgBNkodhDPxSUNpzJYyq7gMKrJOWteuFTkM+Z+CTTOi2uhV35jayCgvwJZBSrguwHFuwkbf9R5Z7zC4dShHjru3qJMH0xY+DzFmNxKG24qbEMlIdOHoCuAHlJ8mBZ2R+UmAqgDcIZO+rzL5EY/25WuMOwtO8LQVl8ggWNMZbesmBlThDTn21accP34Tr9Tj0d3pF4QK7cKGtpkUa03m197YyASMvyIkyX782gDaN0jEcOWVoYHTUOd0wXyeCo5PhrMVnBdVeVKD1KTUv/AtiU6tHMytDyDIqWyeQLAobSpzkXqM0Dd6Ysrlon8mlkm0sBz8Imx9X4ry+NwNLtFmr43AmpfX6zve/p/OlQiqA/1mSwvNbyhfQa7y5JH29Cqah5uivH9Hac4lRTU2QExDhwkIsMu2G1ZX+8gxGdAJ8p63Q4ZBWU630/yPuULKhnwpS/IhqWMfKUslSIigohJAkT g+d3KjHX TKhEH1AKCIQ5ZRUxA6+u0/JR4Wo28SkqiUNnppkYX/76vZJj4KQ9VpiBdnFXyTMrlX8V2NEmiZ0FnWML3zIH/+M76U0eOf9RplOAaCzZd3ckJ+nRNKG1M1JZgsQv7vk2EkQLNb+4aJ1Z6l7o5MMI/O46EXjZpANamJ1zLjz7a87OJGDxewDZ63i3KkUtWBJjHhL/9bY1ne2WkCuQU/qnflrxWkESD7Dyge+4Q8dNQkj2UcTnxoPD2sHEdtSixaqEKeMrsRBKYAm7JCnt9W/pE3EFCZhowaoG2scWzdGF7m6EB4HNdGRIcJU0BaoqY42ptgC/xG9yCjkgJKt4NB0jFlch4L3aNgmRTBINO4+pZKs5qmZixzQNs+LSH9Hyi+MVXydrj7FbbYxZZkh3zf4m7nToxnDtKqXTZ2wWLpfdH6HsaBYl/TN0xEpZzunprKak4xf/LKnYlLGgxtORovRUSqi1w0jVNPs2wmlwxJCpM3yU+wEmdH+bUzEEK+WfaQKOYkonMuqyJI12IwCn/pg8Vn0zJY2S9mivI518UhKVcNuJ9otPkfrG+vE5j4A== 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: Add a helper to initialize a bvec based of a page pointer. This will help removing various open code bvec initializations. Signed-off-by: Christoph Hellwig Reviewed-by: Chaitanya Kulkarni Reviewed-by: Johannes Thumshirn --- block/bio-integrity.c | 7 +------ block/bio.c | 12 ++---------- include/linux/bvec.h | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index 3f5685c00e360b..a3776064c52a16 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -124,23 +124,18 @@ int bio_integrity_add_page(struct bio *bio, struct page *page, unsigned int len, unsigned int offset) { struct bio_integrity_payload *bip = bio_integrity(bio); - struct bio_vec *iv; if (bip->bip_vcnt >= bip->bip_max_vcnt) { printk(KERN_ERR "%s: bip_vec full\n", __func__); return 0; } - iv = bip->bip_vec + bip->bip_vcnt; - if (bip->bip_vcnt && bvec_gap_to_prev(&bdev_get_queue(bio->bi_bdev)->limits, &bip->bip_vec[bip->bip_vcnt - 1], offset)) return 0; - iv->bv_page = page; - iv->bv_len = len; - iv->bv_offset = offset; + bvec_set_page(&bip->bip_vec[bip->bip_vcnt], page, len, offset); bip->bip_vcnt++; return len; diff --git a/block/bio.c b/block/bio.c index d7fbc7adfc50aa..71e411a0c12950 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1029,10 +1029,7 @@ int bio_add_hw_page(struct request_queue *q, struct bio *bio, if (bio->bi_vcnt >= queue_max_segments(q)) return 0; - bvec = &bio->bi_io_vec[bio->bi_vcnt]; - bvec->bv_page = page; - bvec->bv_len = len; - bvec->bv_offset = offset; + bvec_set_page(&bio->bi_io_vec[bio->bi_vcnt], page, len, offset); bio->bi_vcnt++; bio->bi_iter.bi_size += len; return len; @@ -1108,15 +1105,10 @@ EXPORT_SYMBOL_GPL(bio_add_zone_append_page); void __bio_add_page(struct bio *bio, struct page *page, unsigned int len, unsigned int off) { - struct bio_vec *bv = &bio->bi_io_vec[bio->bi_vcnt]; - WARN_ON_ONCE(bio_flagged(bio, BIO_CLONED)); WARN_ON_ONCE(bio_full(bio, len)); - bv->bv_page = page; - bv->bv_offset = off; - bv->bv_len = len; - + bvec_set_page(&bio->bi_io_vec[bio->bi_vcnt], page, len, off); bio->bi_iter.bi_size += len; bio->bi_vcnt++; } diff --git a/include/linux/bvec.h b/include/linux/bvec.h index 35c25dff651a5e..9e3dac51eb26b6 100644 --- a/include/linux/bvec.h +++ b/include/linux/bvec.h @@ -35,6 +35,21 @@ struct bio_vec { unsigned int bv_offset; }; +/** + * bvec_set_page - initialize a bvec based off a struct page + * @bv: bvec to initialize + * @page: page the bvec should point to + * @len: length of the bvec + * @offset: offset into the page + */ +static inline void bvec_set_page(struct bio_vec *bv, struct page *page, + unsigned int len, unsigned int offset) +{ + bv->bv_page = page; + bv->bv_len = len; + bv->bv_offset = offset; +} + struct bvec_iter { sector_t bi_sector; /* device address in 512 byte sectors */ From patchwork Fri Feb 3 15:06:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13127842 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97239C6FD1B for ; Fri, 3 Feb 2023 15:07:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 481146B0082; Fri, 3 Feb 2023 10:07:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 393116B0078; Fri, 3 Feb 2023 10:07:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CE2B06B007D; Fri, 3 Feb 2023 10:07:48 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id AFDCB6B007B for ; Fri, 3 Feb 2023 10:07:48 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 6CE45A1152 for ; Fri, 3 Feb 2023 15:07:48 +0000 (UTC) X-FDA: 80426310216.24.35CAB3D Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf15.hostedemail.com (Postfix) with ESMTP id CF0AAA0027 for ; Fri, 3 Feb 2023 15:07:45 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=D+S3e79r; dmarc=none; spf=none (imf15.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675436866; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=CiyB48vb6mrmTaEOVbqLR4u5Ie+kSkIibxGdt/yEGrQ=; b=sQKctHnl9dBbMmMC16HsZ2Ipea676gUyVC1kAeO278IXsNCnFl901XP4bqZ8R21ECWPmD1 jSJXwUMIajcoZ51W+wAIKb7NepWUxkD238ijcgV3Hk8alloCuhFGjZCMWXMhUDwQ3YvItF mlvyiwT8nHJ81SbjrU/cN1OynPfUjd8= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=D+S3e79r; dmarc=none; spf=none (imf15.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675436866; a=rsa-sha256; cv=none; b=veVqn727Gp61LAu1mG3Z+0+mbjrTdMTsi4Gygw1QxuQkgM47k/apE5WCbMmqrT18vxE0k8 y1ow74Yf0zqUXsMDFVUS47EAqOSznRvCjUEE+BltqDOjbGQqQ+58c8rF7maiDFHz23ItGR grU2gvKkJ9YcDFXAx9NxeLcPUEoBS2I= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=CiyB48vb6mrmTaEOVbqLR4u5Ie+kSkIibxGdt/yEGrQ=; b=D+S3e79rKed63zGKQODZ2ajajk tY9PTZKFAa2fY7TmJOLLnb65WB73dEl4Jgj/gOugeSqMbkmLbXohy1C6IwWfuiZo77jdisGjM3yt4 9xvdaWC7YH4+evg/huO/wnallnWJ+vAfbAy+KZ1lxMwOxypC9YvrMMgminhOcGcxNYLxnvCObX1OD yOODt3y4LRWDt6sPzQe9gbo91x07bQX4zJYyv+FuFp5RkEeW42m5CZNG2NJ+PmXd8QRNdkVwaLx8u Ed4Ftp13pBU7ExNTD2TCUOM24LHzJnSBzaVBjKWd5mYX39pRy/ZbN9BsCfck6fVftE+tsT0WOITG1 xZXpO+3Q==; Received: from [2001:4bb8:19a:272a:910:bb67:7287:f956] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNxeE-002adJ-Pc; Fri, 03 Feb 2023 15:06:43 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Ilya Dryomov , "Michael S. Tsirkin" , Jason Wang , Minchan Kim , Sergey Senozhatsky , Keith Busch , Sagi Grimberg , Chaitanya Kulkarni , "Martin K. Petersen" , David Howells , Marc Dionne , Xiubo Li , Steve French , Trond Myklebust , Anna Schumaker , Mike Marshall , Andrew Morton , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Chuck Lever , linux-block@vger.kernel.org, ceph-devel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, kvm@vger.kernel.org, netdev@vger.kernel.org, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, devel@lists.orangefs.org, io-uring@vger.kernel.org, linux-mm@kvack.org, Johannes Thumshirn Subject: [PATCH 02/23] block: add a bvec_set_folio helper Date: Fri, 3 Feb 2023 16:06:13 +0100 Message-Id: <20230203150634.3199647-3-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230203150634.3199647-1-hch@lst.de> References: <20230203150634.3199647-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: CF0AAA0027 X-Stat-Signature: rduproc9pq47obyeeyjzrsk7n58r1xso X-HE-Tag: 1675436865-902501 X-HE-Meta: U2FsdGVkX19Y5Y82DQUvXAI8wo/RP8phAijSSwBZspeh62GxqpDGOJcZLSDfGlPjz65wXmrisidvqSJldbxRlSgjc5xqqIuxklqMajQzNTG2ZETaDz1ZVytcV0eXR/OTPuZuwrKlNZNUStOBFdkvw3+OgGQH0vn3KkGH7BlWTLNcfeotPxC0vPywXdLrGl6x1+6mAV8MDtt17ck6U7Yb1jl/qE2u6Gah7CmzUy0BMlXgE3+zqjkhx/4eqPsWlAVlJ8+RCuazcSCggP3DJ5pAQ0V7HR9TR+fciC8U3iPJwH5sEuaxRcI5uVv4dbTmxAUltA3QXcYYLGCjJX3TP8Py0sMrkhmZ8boLsRWxzLC4fjYkzzJFYBqnMnIXUFpWxXSh+OSp+SlEtR100G1fcBIjLFY6YEJyWDKyqI5yrelwAjVCU2fgjgLI1Vp+ewpkZtBhNTO7ZYNm9bWWC1qp8e12yZ0JRFk8cB84g1z+F0wk8yj9SIMbmVioq302ZjnR8Fj+229uJrU9gP95icN1YmHL4sEpGcuSsFx2oGUav5nPuFEyBkOQQfkOaPYRxwIjrfRBRWsgMzWLbWhvyMzLfcp3RLIOV4WDYTi25gu9KsGKQig3SjxYD7hYSxhGS2BIBUJwDbGtPcBz6wMtyhd/Y+9dylMs2yIcTGSMHHkY/yooDRGLq0fITx3um6BF16EO/P0W7nyPuqOqnOnEiBQGk+und8MOoEwAZlOtmK+GwRi0gUl2HQm4mbMkQgc2INSKIYXbVXQ60cwfOs/qjee3BysBKIMBao5X4HuVTPnmm2cV9mxhh25N59V2Xn4voJ+Rm6pZEwfpzQMerPPPw/sK7K5UUPEdX5ANGXIgZgoPh9i63PrnJTqS+81Q/6k+84fxHZaWkTBp5JqmkEI9nJn3Pm1F3XQTlBFzWAdX0xspL06EyNRnDqlJsycXw+G8YH2fA+09qsP+DyUEtbyOgWkT6rs GqdzlYK+ at/JwZ78IAftRP1z9nUbn3dE8FJNJ1FDpQT2XF93ZVgY33iiiRxIIqFYzWKv/owicRJivnb9LjNByCKfrhN+gYnIPMA8OJdx4xo2/g70i7R6haJe8BkhPi/x/0HU4YLp/FYZNv7c1/qHq7hRVXyNAOCx66ES1hQzxy6h/LLOX5asD+9hL2Fpd4/uo5E8v+p16C87u8Ft1cWLIAwvffSWXz5/YJ9jazf6ZiRD4FsfEecRWQzFb08sP3amM1o8GNrnni+/QCvg5S2mDsdn5320GzCHTqn5m8ybZjhf+pikzVzLKWwsJFImzKmkuvQ5BIczZotBNtGzjxxmdZl1axqOM86okY7fXd7Tw1q6B/Vpk/XsP4iSCiuHtrzwQqQzLLqeqS4SI6/1MD0qhYE/aBCpY4QDC9ye/OwWip2GKE2hIc8pxwr88emLkanfx16stbpiUxVNUngMeFoVxJkdej/KeFm5Umf0XRQ9lkE5YRbpTkAjimPjZvs/2sUjo++RgTDHCeqwVZ1Hk9XmFdhIFtdQoNrakDq+C0rCquf2JRP1etzqZSda8Ev0kj/GOEw== 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: A smaller wrapper around bvec_set_page that takes a folio instead. There are only two potential users for this in the tree, but the number will grow in the future. Signed-off-by: Christoph Hellwig Reviewed-by: Chaitanya Kulkarni Reviewed-by: Johannes Thumshirn --- include/linux/bvec.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/linux/bvec.h b/include/linux/bvec.h index 9e3dac51eb26b6..2bae1134499e7f 100644 --- a/include/linux/bvec.h +++ b/include/linux/bvec.h @@ -50,6 +50,19 @@ static inline void bvec_set_page(struct bio_vec *bv, struct page *page, bv->bv_offset = offset; } +/** + * bvec_set_folio - initialize a bvec based off a struct folio + * @bv: bvec to initialize + * @folio: folio the bvec should point to + * @len: length of the bvec + * @offset: offset into the folio + */ +static inline void bvec_set_folio(struct bio_vec *bv, struct folio *folio, + unsigned int len, unsigned int offset) +{ + bvec_set_page(bv, &folio->page, len, offset); +} + struct bvec_iter { sector_t bi_sector; /* device address in 512 byte sectors */ From patchwork Fri Feb 3 15:06:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13127845 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A29E6C677F1 for ; Fri, 3 Feb 2023 15:07:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D92886B0074; Fri, 3 Feb 2023 10:07:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A22126B007B; Fri, 3 Feb 2023 10:07:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 341EA6B007B; Fri, 3 Feb 2023 10:07:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id AC97C6B0074 for ; Fri, 3 Feb 2023 10:07:48 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 4B31D1C5DB1 for ; Fri, 3 Feb 2023 15:07:48 +0000 (UTC) X-FDA: 80426310216.22.1D4D6C2 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf17.hostedemail.com (Postfix) with ESMTP id 3C1D14000A for ; Fri, 3 Feb 2023 15:07:45 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=s4yrPDzV; spf=none (imf17.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675436866; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=i8uz5/Cr3yI4AKad2Qe+HNOvXzb51PMMHxDJaU9rAgw=; b=Rg5nq6n0KkW3GrRv4JArnCkGqrVMRIPvS/HxErbzZRgIBRpSm4CVNKWTBenchDQ9G51ZgR wFpzaFRE5rkzN0071TS8OasneqfXYUUjPvPchrL4hIuWBc9ApxGUHSnEEFfys8j7AKG2YV jgz94WGAwEC27ZG3KjITWAKzBj/0Mdg= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=s4yrPDzV; spf=none (imf17.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675436866; a=rsa-sha256; cv=none; b=TRXid4zIJtSlGXG/N6yXRXvDHpQDQOt3aoFdGDjw0ggHcdvloAWKdpj1rl1SC773+as1e6 h1YyuWccU2NQUt4+6pfz/HQ3P90bMpfnI8anszkN6ljFjXoD1M2CmZfMvG+CWVJCBTSIVB OpKIp89ip3ZM0UnCxM68Rs5tFMRxT6Q= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=i8uz5/Cr3yI4AKad2Qe+HNOvXzb51PMMHxDJaU9rAgw=; b=s4yrPDzVMBpi6l0+EETwcbHIFv 2xwcbaenQAG3iI5OovZK8STydd1dXIrGWK8akwiQeQc2RIPwmHAQ3tB2YwFvPQAvHmMaIfIucx7Zp ajCj3SDxghdOlCv370eNnsuOoiH8YZgL2rB/Cifv8UVmXFYQH6UlD0uleebs0+/Lp4g3yoat0NQTP 3i4Ky2rvVCEbWtE/DFAD0kzDmDDcPhmnQe69wiJFwjPi1Kk71QZJfJKGcGt7gJuRlLjYYYrRMvnfN FFYd2dyKm+M7lYhIqCJrAgzbIeZRKknEymVkn8XFqgs4xeMmPgxEo3i4PzL6eEbspvJoriHHKn7qw v2H1dBXw==; Received: from [2001:4bb8:19a:272a:910:bb67:7287:f956] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNxeH-002aen-LR; Fri, 03 Feb 2023 15:06:46 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Ilya Dryomov , "Michael S. Tsirkin" , Jason Wang , Minchan Kim , Sergey Senozhatsky , Keith Busch , Sagi Grimberg , Chaitanya Kulkarni , "Martin K. Petersen" , David Howells , Marc Dionne , Xiubo Li , Steve French , Trond Myklebust , Anna Schumaker , Mike Marshall , Andrew Morton , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Chuck Lever , linux-block@vger.kernel.org, ceph-devel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, kvm@vger.kernel.org, netdev@vger.kernel.org, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, devel@lists.orangefs.org, io-uring@vger.kernel.org, linux-mm@kvack.org, Johannes Thumshirn Subject: [PATCH 03/23] block: add a bvec_set_virt helper Date: Fri, 3 Feb 2023 16:06:14 +0100 Message-Id: <20230203150634.3199647-4-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230203150634.3199647-1-hch@lst.de> References: <20230203150634.3199647-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 3C1D14000A X-Stat-Signature: 99z8cwawdaynw1yt9kgi693fowu6ssyd X-Rspam-User: X-HE-Tag: 1675436865-723652 X-HE-Meta: U2FsdGVkX1/BIgjl03ni5K0OqaJJrnLfjeuQSUKNaNbUHGWFb6KDeA55oIziMWhO4spTTZwmwaVbIEnD0F9M+APBXdLkza4OxetVGzgcIQx0JB54jvi+PM5GVl2jhjmEcLCd3fH8aX5PCQHZw5XSJ8Gv2ONVvzt6MhIgaoZ+N9siBHMXR69sYCGFMjY2htp75Ttgz3R1aLaUwbAY8msLzjBhMUQyIbWKOepeMPfjSaSAuneJr0BmJtLsBlJgl2CsBSX5os+JDMb7Fb/nK1mKpl0T0Y3VkFv12E3Qfo8yOnmSBY6zKmFsPaGXkrhqobJFK5m3UULygxHGGp/r+ZG8fgIeMod8CIBs4r4Fo6EfkCTD3C9CIO6WlZJILCa6iNW+aCngP0H3v39+qFcnfIKJ650YmykoRYH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FqL9U1XuEPwNbe4Fxp1IMSl9QvLf8gLhijKIhFh5sEu/rxxU8mZLddToK1I3+w== 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: A small wrapper around bvec_set_page for callers that have a virtual address. Signed-off-by: Christoph Hellwig Reviewed-by: Chaitanya Kulkarni Reviewed-by: Johannes Thumshirn --- include/linux/bvec.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/linux/bvec.h b/include/linux/bvec.h index 2bae1134499e7f..f2d22931f3030a 100644 --- a/include/linux/bvec.h +++ b/include/linux/bvec.h @@ -63,6 +63,18 @@ static inline void bvec_set_folio(struct bio_vec *bv, struct folio *folio, bvec_set_page(bv, &folio->page, len, offset); } +/** + * bvec_set_virt - initialize a bvec based on a virtual address + * @bv: bvec to initialize + * @vaddr: virtual address to set the bvec to + * @len: length of the bvec + */ +static inline void bvec_set_virt(struct bio_vec *bv, void *vaddr, + unsigned int len) +{ + bvec_set_page(bv, virt_to_page(vaddr), len, offset_in_page(vaddr)); +} + struct bvec_iter { sector_t bi_sector; /* device address in 512 byte sectors */ From patchwork Fri Feb 3 15:06:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13127840 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A45CC64ED6 for ; Fri, 3 Feb 2023 15:07:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C4FD66B0075; Fri, 3 Feb 2023 10:07:48 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BD0996B0080; Fri, 3 Feb 2023 10:07:48 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A2EFB6B0075; Fri, 3 Feb 2023 10:07:48 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 8C1006B0072 for ; Fri, 3 Feb 2023 10:07:48 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 5D1F51A1178 for ; Fri, 3 Feb 2023 15:07:48 +0000 (UTC) X-FDA: 80426310216.21.E6A492A Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf11.hostedemail.com (Postfix) with ESMTP id CEC1D40018 for ; Fri, 3 Feb 2023 15:07:45 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=VvdE+ZMN; dmarc=none; spf=none (imf11.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675436866; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=nFCgusCGETcddag92jej4sXk0TvWuHs0ZPKsULSCPb4=; b=YN0IDB9QXIH9O22e+fJkavzdTm9mZdN8MvZvdj//xUW92KR2zVTn5iActbMD9VkIaK6i9X GbC2VHoPnCpSFu11DiYraHFBj2pmaBkK115p7Ji4BMt7b7EVDMQIa8l0ck25NDC5IUJUbh Fm7Vzx8YWxMFyGvJ/Ba6fsVY+WsJAm8= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=VvdE+ZMN; dmarc=none; spf=none (imf11.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675436866; a=rsa-sha256; cv=none; b=bKIWd2iCGDUJ3f+sHDmYaonGVY6uuUxxjJmUP3szsHPUmKx7e0fPD8L/cQZp498afoUL7y U141lnvGyrt+svnl3M69kOKBXwPy6xSbzKM+S5jGwwt7QZhaVckCD0BcyuQJcMUAwl56hy r08gBa0mkXRgTxEZywRs1H2fim6ueAQ= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=nFCgusCGETcddag92jej4sXk0TvWuHs0ZPKsULSCPb4=; b=VvdE+ZMNDitBJaDdEp8YyznFtB iN9Z/tIQLsz5kAYFso0Gnb29VhMIMMjq0Xa52Hg2oAwra3qYJ8leh61xv2WRAmp6eYYEnF9rPB0hn CGP4sJszmLXtbIu3oxAhBi+tVJRqU5ijKNzXBSeXgn0S5/8UNYECoUx1AT2C6CQWflLpHcHO3elmk uhkrh15eFLQWZt0+lFjCIzywMB3BS5yrZHdPmDhECnToZPgve299mjDhwNv3YpUc90wJVBRSay8qM 5KPFXtBhcrG0zPARc13WWewfCF4RKRRehkdJ7hfXkiFxiBJGOoWmbWiCdqrOOO2VdL9nKra4pLm23 DC1xa06w==; Received: from [2001:4bb8:19a:272a:910:bb67:7287:f956] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNxeL-002afR-1b; Fri, 03 Feb 2023 15:06:49 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Ilya Dryomov , "Michael S. Tsirkin" , Jason Wang , Minchan Kim , Sergey Senozhatsky , Keith Busch , Sagi Grimberg , Chaitanya Kulkarni , "Martin K. Petersen" , David Howells , Marc Dionne , Xiubo Li , Steve French , Trond Myklebust , Anna Schumaker , Mike Marshall , Andrew Morton , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Chuck Lever , linux-block@vger.kernel.org, ceph-devel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, kvm@vger.kernel.org, netdev@vger.kernel.org, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, devel@lists.orangefs.org, io-uring@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 04/23] sd: factor out a sd_set_special_bvec helper Date: Fri, 3 Feb 2023 16:06:15 +0100 Message-Id: <20230203150634.3199647-5-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230203150634.3199647-1-hch@lst.de> References: <20230203150634.3199647-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: CEC1D40018 X-Stat-Signature: rxxeuj8bsuq6dwoxxa8k479oak9ukyug X-HE-Tag: 1675436865-844802 X-HE-Meta: U2FsdGVkX18YMWqdeN8zYj4z3pHT0U58nYEirRoyCMuq4WACWqV08zDP7GOIW9fifmc4TbpVByCPbT4xXDO0DIIEUwHgtdRrqWqZsu+ROwjuOVdZJe1aAtPXpoPgdiPpF1rzSE2fQBwZA1IA4Vo1ZBzEK+Ru3g2uR0kiWVz4sv21A4YYpSyttt9TPS8OmHEqwdXFGfbjcm67oKSxQeC7/dcQb+T1cFYLSh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+gtr/g/qQmD11fqljOya1zJl2v80fCbfEbUchI+w27kv+PLlbA27kWJzFbEgLPyGDvoAOmsXAS4yoZv4bWB/l+aBmdSobVKR2TPjTQs4Ncs+sdcqw4eD90DU2AmBDCzYI7yrep//1uQ0YOdYRv5guHta2628kea5yIYTW0pVYcpkDLAwGar0wZkhiC0M1qOCzUQKuMVRVTWjV 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: Add a helper for setting up the special_bvec instead of open coding it in three place, and use the new bvec_set_page helper to initialize special_vec. Signed-off-by: Christoph Hellwig Reviewed-by: Chaitanya Kulkarni --- drivers/scsi/sd.c | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 47dafe6b8a66d1..277960decc104b 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -831,6 +831,19 @@ static void sd_config_discard(struct scsi_disk *sdkp, unsigned int mode) blk_queue_max_discard_sectors(q, max_blocks * (logical_block_size >> 9)); } +static void *sd_set_special_bvec(struct request *rq, unsigned int data_len) +{ + struct page *page; + + page = mempool_alloc(sd_page_pool, GFP_ATOMIC); + if (!page) + return NULL; + clear_highpage(page); + bvec_set_page(&rq->special_vec, page, data_len, 0); + rq->rq_flags |= RQF_SPECIAL_PAYLOAD; + return bvec_virt(&rq->special_vec); +} + static blk_status_t sd_setup_unmap_cmnd(struct scsi_cmnd *cmd) { struct scsi_device *sdp = cmd->device; @@ -841,19 +854,14 @@ static blk_status_t sd_setup_unmap_cmnd(struct scsi_cmnd *cmd) unsigned int data_len = 24; char *buf; - rq->special_vec.bv_page = mempool_alloc(sd_page_pool, GFP_ATOMIC); - if (!rq->special_vec.bv_page) + buf = sd_set_special_bvec(rq, data_len); + if (!buf) return BLK_STS_RESOURCE; - clear_highpage(rq->special_vec.bv_page); - rq->special_vec.bv_offset = 0; - rq->special_vec.bv_len = data_len; - rq->rq_flags |= RQF_SPECIAL_PAYLOAD; cmd->cmd_len = 10; cmd->cmnd[0] = UNMAP; cmd->cmnd[8] = 24; - buf = bvec_virt(&rq->special_vec); put_unaligned_be16(6 + 16, &buf[0]); put_unaligned_be16(16, &buf[2]); put_unaligned_be64(lba, &buf[8]); @@ -876,13 +884,8 @@ static blk_status_t sd_setup_write_same16_cmnd(struct scsi_cmnd *cmd, u32 nr_blocks = sectors_to_logical(sdp, blk_rq_sectors(rq)); u32 data_len = sdp->sector_size; - rq->special_vec.bv_page = mempool_alloc(sd_page_pool, GFP_ATOMIC); - if (!rq->special_vec.bv_page) + if (!sd_set_special_bvec(rq, data_len)) return BLK_STS_RESOURCE; - clear_highpage(rq->special_vec.bv_page); - rq->special_vec.bv_offset = 0; - rq->special_vec.bv_len = data_len; - rq->rq_flags |= RQF_SPECIAL_PAYLOAD; cmd->cmd_len = 16; cmd->cmnd[0] = WRITE_SAME_16; @@ -908,13 +911,8 @@ static blk_status_t sd_setup_write_same10_cmnd(struct scsi_cmnd *cmd, u32 nr_blocks = sectors_to_logical(sdp, blk_rq_sectors(rq)); u32 data_len = sdp->sector_size; - rq->special_vec.bv_page = mempool_alloc(sd_page_pool, GFP_ATOMIC); - if (!rq->special_vec.bv_page) + if (!sd_set_special_bvec(rq, data_len)) return BLK_STS_RESOURCE; - clear_highpage(rq->special_vec.bv_page); - rq->special_vec.bv_offset = 0; - rq->special_vec.bv_len = data_len; - rq->rq_flags |= RQF_SPECIAL_PAYLOAD; cmd->cmd_len = 10; cmd->cmnd[0] = WRITE_SAME; From patchwork Fri Feb 3 15:06:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13127844 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28C21C61DA4 for ; Fri, 3 Feb 2023 15:07:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AF2AB6B0078; Fri, 3 Feb 2023 10:07:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 89FF36B007E; Fri, 3 Feb 2023 10:07:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 47B7D6B0074; Fri, 3 Feb 2023 10:07:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id DC7F76B0081 for ; Fri, 3 Feb 2023 10:07:48 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 8EB24C1156 for ; Fri, 3 Feb 2023 15:07:48 +0000 (UTC) X-FDA: 80426310216.22.C212CC3 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf23.hostedemail.com (Postfix) with ESMTP id AE35B14001F for ; Fri, 3 Feb 2023 15:07:46 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=U7gHGI4+; dmarc=none; spf=none (imf23.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675436866; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=yYE/od14GoUSfS3SrqxEgI5AwVsNpiRxxWihLgbj1lM=; b=E8tQDHVJ267wcN3vmaa5WOG2hnYyq0WkKrxhCJaAO4Dc9VPaJ+rPkd5mA1Vu4Y3nM7aQ8A aBikpf2Ziqi0wUFcMd3PSIsZ5Zf6etbv3L2KvFgkzw0WktiOlXpKW/1Wgeg1/cQ6kDyDz0 Sq12NvuKVUB2csKK5PaR9wnE+OhWY54= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=U7gHGI4+; dmarc=none; spf=none (imf23.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675436866; a=rsa-sha256; cv=none; b=OqXuR51xN5OqJvCnoqiA7ICqvcdF+f58mV8u5qjqkd41vF3Argq4B/oqkY8i6Zo1nBJzek C+NC9+ibkyydhUlfhxcUDJQHeRscoRd05tFF0eGE79O/CqmiAhTadoYEk0dDBBSwbx/+zL HkhV9p2nEESzaY3PxiF1UGorJykTOS0= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=yYE/od14GoUSfS3SrqxEgI5AwVsNpiRxxWihLgbj1lM=; b=U7gHGI4+jFww+bLgY2qB+UJ4Eb YA2OMvfnZAc5GIuqbs0dC0b5/ypXraaHVc3zXOzYoz92nlDl6cc9tfrbD8QiR5RuddFZ/24vxgEs3 tAQvsBOWvRR4DnM/Ts7iPycHDqB8SLxXBlwRo2qrTh3FfGjdSgSWlLXk/MAT7/txciVBFyq66zTF6 7jbBNwJc5NB1VF8aIBvk7ciGc/6w/kjvXfgX7GT/MIdD5VzKXBo9WHkJeCcWHzlVRUL3orKCIcveH k3IsETytcOcYa4M7MebhZowmCK48eVnfXowJXtyuxT4UQQZueio9wZREhVWDQtXDqeIGzpsaH3iWh VhCYEFnw==; Received: from [2001:4bb8:19a:272a:910:bb67:7287:f956] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNxeO-002aht-77; Fri, 03 Feb 2023 15:06:52 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Ilya Dryomov , "Michael S. Tsirkin" , Jason Wang , Minchan Kim , Sergey Senozhatsky , Keith Busch , Sagi Grimberg , Chaitanya Kulkarni , "Martin K. Petersen" , David Howells , Marc Dionne , Xiubo Li , Steve French , Trond Myklebust , Anna Schumaker , Mike Marshall , Andrew Morton , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Chuck Lever , linux-block@vger.kernel.org, ceph-devel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, kvm@vger.kernel.org, netdev@vger.kernel.org, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, devel@lists.orangefs.org, io-uring@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 05/23] target: use bvec_set_page to initialize bvecs Date: Fri, 3 Feb 2023 16:06:16 +0100 Message-Id: <20230203150634.3199647-6-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230203150634.3199647-1-hch@lst.de> References: <20230203150634.3199647-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: AE35B14001F X-Stat-Signature: hwmx5k8tjh8jq5q9ugfmeh6zazo6bq4t X-HE-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r6FFHXHNUHwdJ2arZ6dFUAWgxm2bXMo3a6PSADULof1ZThFPUI66UdO1f8VitL9fEaDwCYB9CRjmABabXGM0/LncWUQt1hf5sJt5zOHClQolD29k9TuUEubEuGmXi//FTxLmTkF9Psj40xV9BXPBfm3lVfKwo/b2rqEWtAi282fCAIYe7dLLdjzZLv6sy73fThoMUpy0d+LFzcwW3X1wP1KP0fhnJKe1H/6wl6B2Yk/XoJk83i+idIMT+6/+rWcgeXLiaL0tt6vYKRWV3NQVQUdKXQSSbphPhAT87MDdJL88g2u+mdbhMg9N02UnVGMoLachgR4HZ6WROPKweeNs+b4uw6nQtfDoHARks2W9EKSKenoP14EQ2SwpsPzWrQ5vjd+odzWk3SpnzuVXHPEzkSDPxGLeKtGJsEox2NC1Qr5sNc9rtlhbnfRk0fbSuK 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: Use the bvec_set_page helper to initialize bvecs. Signed-off-by: Christoph Hellwig Reviewed-by: Chaitanya Kulkarni --- drivers/target/target_core_file.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c index fd584111da45c0..ce0e000b74fc39 100644 --- a/drivers/target/target_core_file.c +++ b/drivers/target/target_core_file.c @@ -281,10 +281,8 @@ fd_execute_rw_aio(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; for_each_sg(sgl, sg, sgl_nents, i) { - aio_cmd->bvecs[i].bv_page = sg_page(sg); - aio_cmd->bvecs[i].bv_len = sg->length; - aio_cmd->bvecs[i].bv_offset = sg->offset; - + bvec_set_page(&aio_cmd->bvecs[i], sg_page(sg), sg->length, + sg->offset); len += sg->length; } @@ -329,10 +327,7 @@ static int fd_do_rw(struct se_cmd *cmd, struct file *fd, } for_each_sg(sgl, sg, sgl_nents, i) { - bvec[i].bv_page = sg_page(sg); - bvec[i].bv_len = sg->length; - bvec[i].bv_offset = sg->offset; - + bvec_set_page(&bvec[i], sg_page(sg), sg->length, sg->offset); len += sg->length; } @@ -465,10 +460,9 @@ fd_execute_write_same(struct se_cmd *cmd) return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; for (i = 0; i < nolb; i++) { - bvec[i].bv_page = sg_page(&cmd->t_data_sg[0]); - bvec[i].bv_len = cmd->t_data_sg[0].length; - bvec[i].bv_offset = cmd->t_data_sg[0].offset; - + bvec_set_page(&bvec[i], sg_page(&cmd->t_data_sg[0]), + cmd->t_data_sg[0].length, + cmd->t_data_sg[0].offset); len += se_dev->dev_attrib.block_size; } From patchwork Fri Feb 3 15:06:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13127843 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 755A1C64ED8 for ; Fri, 3 Feb 2023 15:07:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8A0E16B0081; Fri, 3 Feb 2023 10:07:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7636A6B0078; Fri, 3 Feb 2023 10:07:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 00F186B0072; Fri, 3 Feb 2023 10:07:48 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id A3A9B6B0078 for ; Fri, 3 Feb 2023 10:07:48 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 796EC1A117B for ; Fri, 3 Feb 2023 15:07:48 +0000 (UTC) X-FDA: 80426310216.19.602C424 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf08.hostedemail.com (Postfix) with ESMTP id 6BC9C160004 for ; Fri, 3 Feb 2023 15:07:46 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=aF5Qbqrg; spf=none (imf08.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675436866; a=rsa-sha256; cv=none; b=neHZEfucv6V0EipL5P1bge3El4tUADkTXXxhpPC1WOodWhuF2z7VvLl9KeZz6mZqYg/PQy QECL2ma9YHts8TTUmoK5vMAuFhJ97g1NVj1xX1OtMv3CEyVneEdmngtYS6M8JuQpfBVnWY rKsgF/ucrZh4/YwOz0RffEo7tEVNf7c= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=aF5Qbqrg; spf=none (imf08.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675436866; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=qOELs8Cf+3DRHH4YZ5i8Y7BY08du3RSg74OTiYB5sHQ=; b=buuJLz29Rs3ukaqNjoiyepiu8az86W0RMHjDDrvKxXQGTdTY6b1jfCEfWK22Pa9tJjjRVU yZLwDQ7IrpbJLf/nPkQLQ/IuYZ/XggOGoXCrQBDLhaOiW4//o67YgGaLyYHgptIlmMO2vJ jbyFRFk2ziF4FkgTt4w7id5rxaR3t/4= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=qOELs8Cf+3DRHH4YZ5i8Y7BY08du3RSg74OTiYB5sHQ=; b=aF5Qbqrg1yclOtyaI4gTKBWydF RggQAyGRBco620c8Fi869LlPO2pe8evEIqDoV1ozOXdNfytn1MRinE/6QYY5k2oPlPJhB01no6VtD eldvco5iwWgUqJuF6Ln9UEwZNa6v1GVbT/6Kwoxq6v6E47EA3+X0x/5UWmfkwWrsPlCary6PtwIur 8CI+Wl9GP1YyGgxKum6MPQS4lap8xnIx1Ov95K0LpqVrUkLoMLragJkM0cWq7Yw5U2U5JFh4+zQgw adzFS91VzTwjl1q4AJys+nyWOqDq0dqD/Ug/qOVE9Xw8ZapK+WSEj6v0Tc7w/kwwgNzmawXYW/9S4 JiaBbcyQ==; Received: from [2001:4bb8:19a:272a:910:bb67:7287:f956] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNxeR-002aju-IY; Fri, 03 Feb 2023 15:06:56 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Ilya Dryomov , "Michael S. Tsirkin" , Jason Wang , Minchan Kim , Sergey Senozhatsky , Keith Busch , Sagi Grimberg , Chaitanya Kulkarni , "Martin K. Petersen" , David Howells , Marc Dionne , Xiubo Li , Steve French , Trond Myklebust , Anna Schumaker , Mike Marshall , Andrew Morton , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Chuck Lever , linux-block@vger.kernel.org, ceph-devel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, kvm@vger.kernel.org, netdev@vger.kernel.org, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, devel@lists.orangefs.org, io-uring@vger.kernel.org, linux-mm@kvack.org, Johannes Thumshirn Subject: [PATCH 06/23] nvmet: use bvec_set_page to initialize bvecs Date: Fri, 3 Feb 2023 16:06:17 +0100 Message-Id: <20230203150634.3199647-7-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230203150634.3199647-1-hch@lst.de> References: <20230203150634.3199647-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspam-User: X-Rspamd-Queue-Id: 6BC9C160004 X-Rspamd-Server: rspam01 X-Stat-Signature: paeqp5uztmezotemkn3zzgcznydihgf4 X-HE-Tag: 1675436866-997318 X-HE-Meta: U2FsdGVkX19xMOPhvcnY1Us78CONrDLIpSfnlPYdTOQqWki6+FVvVp+NYS1ff/iYYAjRo+xs7zlQAn+MhL6alfG9nvq3th3di9jXqqXTMiLdIu16ghrT9Jg9ZGPt4VpOTrBWWs8kQgkZzmTW0otFe+O6bxmXyTW5ghsttsMTyS/PrpI03Fa5xxOVwC96mun91ffd1Lf5lMlV/g+GZ3XRLBBm1h74TjiPNfY0Y0IlVLPcejLrz7l+iP7loO9bBPzD2R4hfS3llivP5pLC1WhpcnGIVpfmNJhVdB1yzk1jmpxNONeS3yTL515W+K3hWsGaUAXc8eQevrcXBCjgWcKgjjmuY6TPRRRQTlnH4aZujNG/oZ0zpJbKcrlgjj9LT2LvM9X8J1B0GLsESHNXztPVB421LPXtvUeBztq/7Hj1AUimhXUirMOW/jpaaR7VMvn44bb/UeO9nS93gcX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bXDaABzEU5pyGC9S3yo/A== 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: Use the bvec_set_page helper to initialize bvecs. Signed-off-by: Christoph Hellwig Reviewed-by: Chaitanya Kulkarni Reviewed-by: Johannes Thumshirn --- drivers/nvme/target/io-cmd-file.c | 10 ++-------- drivers/nvme/target/tcp.c | 5 ++--- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/nvme/target/io-cmd-file.c b/drivers/nvme/target/io-cmd-file.c index 871c4f32f443f5..2d068439b129c5 100644 --- a/drivers/nvme/target/io-cmd-file.c +++ b/drivers/nvme/target/io-cmd-file.c @@ -73,13 +73,6 @@ int nvmet_file_ns_enable(struct nvmet_ns *ns) return ret; } -static void nvmet_file_init_bvec(struct bio_vec *bv, struct scatterlist *sg) -{ - bv->bv_page = sg_page(sg); - bv->bv_offset = sg->offset; - bv->bv_len = sg->length; -} - static ssize_t nvmet_file_submit_bvec(struct nvmet_req *req, loff_t pos, unsigned long nr_segs, size_t count, int ki_flags) { @@ -146,7 +139,8 @@ static bool nvmet_file_execute_io(struct nvmet_req *req, int ki_flags) memset(&req->f.iocb, 0, sizeof(struct kiocb)); for_each_sg(req->sg, sg, req->sg_cnt, i) { - nvmet_file_init_bvec(&req->f.bvec[bv_cnt], sg); + bvec_set_page(&req->f.bvec[bv_cnt], sg_page(sg), sg->length, + sg->offset); len += req->f.bvec[bv_cnt].bv_len; total_len += req->f.bvec[bv_cnt].bv_len; bv_cnt++; diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c index cc05c094de221d..c5759eb503d004 100644 --- a/drivers/nvme/target/tcp.c +++ b/drivers/nvme/target/tcp.c @@ -321,9 +321,8 @@ static void nvmet_tcp_build_pdu_iovec(struct nvmet_tcp_cmd *cmd) while (length) { u32 iov_len = min_t(u32, length, sg->length - sg_offset); - iov->bv_page = sg_page(sg); - iov->bv_len = sg->length; - iov->bv_offset = sg->offset + sg_offset; + bvec_set_page(iov, sg_page(sg), sg->length, + sg->offset + sg_offset); length -= iov_len; sg = sg_next(sg); From patchwork Fri Feb 3 15:06:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13127846 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5673FC6FD1D for ; Fri, 3 Feb 2023 15:07:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 017AA6B007B; Fri, 3 Feb 2023 10:07:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AE5DD6B0072; Fri, 3 Feb 2023 10:07:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 629736B007D; Fri, 3 Feb 2023 10:07:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 3A0396B007E for ; Fri, 3 Feb 2023 10:07:49 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 16964803AE for ; Fri, 3 Feb 2023 15:07:49 +0000 (UTC) X-FDA: 80426310258.11.985D7B2 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf18.hostedemail.com (Postfix) with ESMTP id 4CE271C002A for ; Fri, 3 Feb 2023 15:07:47 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=BeevEGfH; spf=none (imf18.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675436867; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=hAZBDljuWATtT7MZb8+aicFX05OEHsXWwcxbzwocn/Y=; b=dV2j+NRzWEqLdB6nRAIq+YFFOnR77+vXoKmswbcJai2kkpuR5yizSacCO/+po2asb700HF f6w6tuIa47ogMFWeyuK3BBcype+t6FwmzFWC0pQreIpLBLQ/lkRP09/mTjRyYAQ6z5+eSW 1eK4+baAso2YbarUU8iZ0/bxta3oKVs= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=BeevEGfH; spf=none (imf18.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675436867; a=rsa-sha256; cv=none; b=EGNUEmYo+MUbxTPum1aQBW1BBc+Cm4CnqhDXX1G0W04M87ONURtgebM2yr3BK3C7PWWCLB dN3W8iBKaIkW+b+f3EV9jIWxOWL/hRKKDdXwvn8BolwojP8rwqSTUBSgFX2qeBxOGTEORZ xyJRd0JNaDroFC6IgbvjKED/2Xj9Wss= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=hAZBDljuWATtT7MZb8+aicFX05OEHsXWwcxbzwocn/Y=; b=BeevEGfHXEz3RQ2pm30ri/lLot 7BknWxcTJCe8bHwiFgaBXD6npSlvAv3IEIcsbkShJ3RfjiaydSSo5L6SFdm8AJ7WoHjFa/htGhWkp 4wGSwgvGKmly4xNp6v5luVv0iyrkXZnWP2/pz7K3wCYJcXHk5hRM2nDzle/Au3h9vm087+yLkb6az 7ehquK3STiJQhULDlHMJ2qG5Ug/GxsArwlHmPwoqzm3C5tnanQyZve2lPxuQhUSgjWjv2GmcjIlnY Visqz9lIqxv7q/UIrUmyPC1LhCL2btyMsdEUNkOGFE9y6nnV9zO5myX06OAAMNCoqqAdLUEkSnYKd aGyQrdEg==; Received: from [2001:4bb8:19a:272a:910:bb67:7287:f956] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNxeV-002am6-95; Fri, 03 Feb 2023 15:06:59 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Ilya Dryomov , "Michael S. Tsirkin" , Jason Wang , Minchan Kim , Sergey Senozhatsky , Keith Busch , Sagi Grimberg , Chaitanya Kulkarni , "Martin K. Petersen" , David Howells , Marc Dionne , Xiubo Li , Steve French , Trond Myklebust , Anna Schumaker , Mike Marshall , Andrew Morton , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Chuck Lever , linux-block@vger.kernel.org, ceph-devel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, kvm@vger.kernel.org, netdev@vger.kernel.org, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, devel@lists.orangefs.org, io-uring@vger.kernel.org, linux-mm@kvack.org, Johannes Thumshirn Subject: [PATCH 07/23] nvme: use bvec_set_virt to initialize special_vec Date: Fri, 3 Feb 2023 16:06:18 +0100 Message-Id: <20230203150634.3199647-8-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230203150634.3199647-1-hch@lst.de> References: <20230203150634.3199647-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Stat-Signature: ikht8t1mzpw5p8s86pdmgh5fcc1ysst8 X-Rspam-User: X-Rspamd-Queue-Id: 4CE271C002A X-Rspamd-Server: rspam06 X-HE-Tag: 1675436867-390218 X-HE-Meta: U2FsdGVkX18PmWVGg3VpJB1KaqJTiItktkwE+cPcRjJGCEyXuDTm033EnkIji+EHVjLqBJi41btzIjyPBzjjUb4kX03t5Tn2S968ry0HfgKGv7u5HbgZRx8gwYnOR2AMvIcEQOARgETVfuzCjy8zamYEkoCEmeqpcG3s3YDm8Fzm6/tQiacoSADcyHsU20ptECu4/9/kO1ehBZRDsozwkC2TnZt32pw7TPgrOt0Dj/XzbPmYwU5gRciNxHEqR6bKX0Q5UFADswrqOrmP+xrSOoSNfD/gD2R0ucgDXLHNhA1+I5nvIxlIipyKM42zh85qCV/JJx1zQUX/JiX7jvW+8yw9EhsiEaN/0qvSVZ4D43lnxldIFWYOEWs7M0Ds7ilEKtxlcNPQVokmA5f6oifAumkPMmT/y2rDGa7JLM0BghEXeR8HWmC5UVTblthGbwslthbNlQkHNN2in9w/LRuc3t2dZa7vinbmb6MkXo149ee7R+W3BZFNfwIETGFEMGYA12S1LSo/2jy2S5SHB44fdB3eQ0awVvXF12bNYrcv2iDOIfyKqJN7ee32I9WHF5rlbn4Vymtskl/13f/2k1FyrPYrxPbU3FUpGiKMpjTHiTMbngSDHvcmHlfAez1xAxMK93jJdPb6RcRJ9nBp+1UOZZkMzQHK3NKjEV0VBP/9CROCmEesZM6s11vqsBFm9qVG/XB036nkwpA0rwiIR1kh6dlyjUXUJ8Wb8pPdn5m7mrLg0BgVrOZPrmQpMZxKHr1w9LRI28ULNu67yFJw3E3eHaRg1uyJglvGkggvDmBZF5w5WauJsubsNRN7jYy3ENFVH2WsYpM7o537/3xQrPbENAd91IOit3/4jJdjVLRtZEPFz2yYrqPV1qENm1Cd1UnBOjXIaVM8PfCbg6MU0IwCFLWoISVyf+clqy1hzkXFN3at0NBlsIcZNUB4pOrJAZE+/SmFHGBndM2X31sx5AR dpgICBNj RG+v5PbMhdzXGOGsHvqBsauaE7yIa9ZmlcQk/lOeVcsJZcI0+CCprU7rBm+JJx+PJge1Vv2hzdU4ABfR2xhmBF6gIzUCBitRw80NSlKYz45UiWZ+8BDQbFE97ntlT2ycBmXJfIPjn/L9tRyRlEVtES3jw9YVbhKnij0YtnHGcslnyUzVWL3QZOYsPJxXqv7prG2W5zWhvifDGY/94oCQcFf/lX6p/PzU927D4hSFa1QNe5YeYqUA0xdh3KS+AOHLZE3sHa1o97/3lr5ij+3A4geVU6EMIcP4EAUm1ix8V+CbfZCvZVCSdUp4+/NFtguFtA/iu5O1eUZdVwbWkh/kuDPj6ESJE5ecO2zeQR/31lMnMJ2CcO6q+jyoWUtcLCsxuzMaA/fBi9h95J3m/amZWlGN993RRz1FDHbb+yA/GJ33oxlPw8DyhXFPt32ts1N3MWj36rpsj5/HBl3scvY3/oc8QYS2SLA7v4rl4HvhmzBx4+0s2ZCzzPwwYdIZddkJB7NzK0BC17uVLV7Dsc5AN6l1z9mvGFetteP9uxMBzfkkMQL9OmcQ6ndHF0Q== 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: Use the bvec_set_virt helper to initialize the special_vec. Signed-off-by: Christoph Hellwig Reviewed-by: Chaitanya Kulkarni Reviewed-by: Johannes Thumshirn --- drivers/nvme/host/core.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 505e16f20e57fa..7ba1accc3c22a4 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -806,9 +806,7 @@ static blk_status_t nvme_setup_discard(struct nvme_ns *ns, struct request *req, cmnd->dsm.nr = cpu_to_le32(segments - 1); cmnd->dsm.attributes = cpu_to_le32(NVME_DSMGMT_AD); - req->special_vec.bv_page = virt_to_page(range); - req->special_vec.bv_offset = offset_in_page(range); - req->special_vec.bv_len = alloc_size; + bvec_set_virt(&req->special_vec, range, alloc_size); req->rq_flags |= RQF_SPECIAL_PAYLOAD; return BLK_STS_OK; From patchwork Fri Feb 3 15:06:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13127847 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 283BBC6FA9D for ; Fri, 3 Feb 2023 15:08:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D592E6B0072; Fri, 3 Feb 2023 10:07:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C960C6B007D; Fri, 3 Feb 2023 10:07:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A97586B007E; Fri, 3 Feb 2023 10:07:53 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 8F1146B0072 for ; Fri, 3 Feb 2023 10:07:53 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 5DCFAA1162 for ; Fri, 3 Feb 2023 15:07:53 +0000 (UTC) X-FDA: 80426310426.10.4997EE0 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf20.hostedemail.com (Postfix) with ESMTP id 86C3E1C002A for ; Fri, 3 Feb 2023 15:07:51 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=hU1CqlCr; dmarc=none; spf=none (imf20.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675436871; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=WNOyAXyw5xLCthfoZy3e9p002HqnVw4VbBE86ULx41A=; b=K9KAiyJnDcw8tDFjpPkHPBp2Ua6H6nfL8CUJaAFCKq6NOpUccu50xzfDdnwfZSczdM1mFw U4M7aUBI37m2ZmwR3p1xBlAyiQPd5eMWfUFd6kMOe478keY3X2qxR1BF7CJEAm6FR31aS6 1WIhZqed2u8tyDXl2Yc968dfj/OjcIU= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=hU1CqlCr; dmarc=none; spf=none (imf20.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675436871; a=rsa-sha256; cv=none; b=zzsGelfetbVGWAJ2ZIoKl3AFi4vguPSNbERbU1opJ53kNkbZ7LWU1fLPLn0U6ScMhinXkY nhszDXJpqjqDdUsDaflSRmJbT0fkIT3H6r7Sli03G93UlnVKsG0a4PpBELkRvewYRut67Y Ve3F7fzu4oM52/4MPvvPTu2f8j5bBW8= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=WNOyAXyw5xLCthfoZy3e9p002HqnVw4VbBE86ULx41A=; b=hU1CqlCryou0nt23x7WKfgr9Yr Ze5pIoPK6R4xw6mzaF8Q13tT8AMdmc2pWHsPTaFT1tqAz0xMyzYUxgmuYr7ZpV+P+Fg+FuAqTYxaR o0KZ4xD9kRy/O3CUuF5ORgePKTIyprfQ/wp+cqJo9oLWqqRHk/tD6t2wSyKvk/7ne3sAsqWVXTNxc wjcc81M/GPoPtNKhO0d0cqBNfOSWqvGO/JfvXq+qWQ8QuWBiBrSBvCXZDh5P7DRYTIH5DD3oowHRu s28l5RjE8e6R6oXed9bn5RpUQB7Y+rkkaRQv759E+VNBc92z5H+MHU4P4MwaAFy/2mreTkAfweGEw Yz+nSGhQ==; Received: from [2001:4bb8:19a:272a:910:bb67:7287:f956] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNxeY-002ank-IB; Fri, 03 Feb 2023 15:07:03 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Ilya Dryomov , "Michael S. Tsirkin" , Jason Wang , Minchan Kim , Sergey Senozhatsky , Keith Busch , Sagi Grimberg , Chaitanya Kulkarni , "Martin K. Petersen" , David Howells , Marc Dionne , Xiubo Li , Steve French , Trond Myklebust , Anna Schumaker , Mike Marshall , Andrew Morton , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Chuck Lever , linux-block@vger.kernel.org, ceph-devel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, kvm@vger.kernel.org, netdev@vger.kernel.org, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, devel@lists.orangefs.org, io-uring@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 08/23] rbd: use bvec_set_page to initialize the copy up bvec Date: Fri, 3 Feb 2023 16:06:19 +0100 Message-Id: <20230203150634.3199647-9-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230203150634.3199647-1-hch@lst.de> References: <20230203150634.3199647-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspamd-Queue-Id: 86C3E1C002A X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: jcwf6ufhjm5dizgny6nxh8o3j9iynbta X-HE-Tag: 1675436871-240900 X-HE-Meta: U2FsdGVkX1/7lYrWiGBG9tLgDaZtRI+Qoq2NyB0eOrgev7O5pkq+r88PF2IkMlW1owKti4ezKZNp3hvNi20qJnkqgKA2N/6qpu8VYUi0oK36tK2kS8sb+KeL1faJgfwMT3s4+xm1qXEQGb43i1na2we4FqR6mlupMAdzovHe6ZN1l8C1UO1EPeAXTdhLBQAEOiiytv89qhbq/vayjdTks5SBtf1i+mCae6Wz6QP/FoBuYHZA+Y/3vrt5gx7o7MlaXHyM62K/5r62tzKS11yVmObfQwyMajfc/3kstlV1j9/dZvjcRh6D70IIQpWIYyYYOM07cBL7XE5s5I4BkDzPAyiULw7qi2s+x68BJWxiHZmjCq3HHNUAnhv3Wsot9n1QkotaXy4GNFp8AuoKKneer10pFMnEI2zjGmXqmzpbHqJQUVaBqLNnBxdyYoaIKauGZj6zo2YUryP8YVd9KhmwGC3dV3URr9SwYQuUsMnyseuJG+VNE4AZ6N9DGC721zW76qC6GUUdj6LLz9U9XtP0yL+88TCYGuhYX+h9dy2zshDzcswUNgq4qSiCpHTKVQFhlYB7A3KhXZL/VfiKvRgkeqwgQTtQbxlDKYtq8t0rU4YBnk/k4EGrKN9xwpxxk6kKfIIeSM7sEA0dnZx/9kGduY0eOKOEfSGAbq8ut5hmAszVEV24qxxgSigOx6DE4TqTDHaZfDgcZ4s+uTW83PjASpH0XypB0Hd2I1VKwfPOQkbH3zP056UsdXChnsxZpnzn7NC/kz0aq9PIzWBz0mmskQjpeTIFzOqGvT3VutQXLPF00KSt0sU8lNdxycFFPpwT1VOOJFk6SvyZsd6iOxtXNKQLb2bdDKICO5e75XQkqARg2PcK5Z/SzVzWxcASx/o3/WxAcQoXLdp2r/pmDKbHMwL67bdVSvLon3LqeMLFNrkfAAqx+wxbWbWCvNzLZ+0GKCu8u2NT0lD5mruc4YE FSxBiclU +N5jS5CuCN9ECVxXYRlrs9vjC2FXLLRZRUcFTb0GMxNG2WIqrwctK/jc2V1o4p4oPQ3gIDx0X4kgzhOsavNITnxcYc3Ijc/CMCj4N67xW0NSTpiWJbcMHaGVOWRW5GyncMsUyZ6yFrBdbQhY00YDz0AwN5bBhxVcgeV241CpxJCzlgRcUkqXowwpvrr0+mqFQy3q+uTYykBW217ax9tySjE4vjFp3HQrcpcBu9w6M+mdYJQpPmXsjsFw8bDDXWD9quFZYXXGNt9YyWwkuKoyFW5iArotCyZ+JE48+d24i9SmnQwmm57OAMDacFQTb7ysqKaDtS5aD7TJLbiEs2b/B+teMlCL4WIwCINJR8I2gxSenmRPcLxuX57PFcxtIm7foGt7n+gUVMfY/I9HuDq83uDEqnH/HPuOdH2T8boHNQWcagckpnrP8FnEdcslMZsLvLjPcrnmfRyNw1ipsJkmsYK4ZsiU+SDIVJD/yLOpVV9lHdtHD8IBY11IJgrlnGw3jKTS9 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: Use the bvec_set_page helper to initialize the copy up bvec. Signed-off-by: Christoph Hellwig Reviewed-by: Ilya Dryomov --- drivers/block/rbd.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 04453f4a319cb4..1faca7e07a4d52 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -3068,13 +3068,12 @@ static int setup_copyup_bvecs(struct rbd_obj_request *obj_req, u64 obj_overlap) for (i = 0; i < obj_req->copyup_bvec_count; i++) { unsigned int len = min(obj_overlap, (u64)PAGE_SIZE); + struct page *page = alloc_page(GFP_NOIO); - obj_req->copyup_bvecs[i].bv_page = alloc_page(GFP_NOIO); - if (!obj_req->copyup_bvecs[i].bv_page) + if (!page) return -ENOMEM; - obj_req->copyup_bvecs[i].bv_offset = 0; - obj_req->copyup_bvecs[i].bv_len = len; + bvec_set_page(&obj_req->copyup_bvecs[i], page, len, 0); obj_overlap -= len; } From patchwork Fri Feb 3 15:06:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13127848 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85A82C6FA9E for ; Fri, 3 Feb 2023 15:08:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 394306B007D; Fri, 3 Feb 2023 10:07:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2CD906B007E; Fri, 3 Feb 2023 10:07:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0ACC66B0083; Fri, 3 Feb 2023 10:07:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id E61DB6B007D for ; Fri, 3 Feb 2023 10:07:55 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id CF784811DF for ; Fri, 3 Feb 2023 15:07:55 +0000 (UTC) X-FDA: 80426310510.02.8866FC8 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf24.hostedemail.com (Postfix) with ESMTP id 14C6F180023 for ; Fri, 3 Feb 2023 15:07:53 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=SHYAKMQ+; spf=none (imf24.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675436874; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=81B+gzWiKP3dSyMHoEpejaF7sEqhUPFohDfKzzK3URY=; b=2usEc1opY1jKk/DQIj/BZejlmGGRwh5WutI33wXkLZ9WiCpy0pJApNQXEDlCTijHlZ0Vz6 t/2GSR+L1QEkCXaHLqgU2LQC4LXWlkthP/KnFDdR6ewO2YnLtoSa8nZtTSsqkuok02/P1P eliDc7xBv38y2lVaykot0Vb0TIB82ho= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=SHYAKMQ+; spf=none (imf24.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675436874; a=rsa-sha256; cv=none; b=tzqhnfMDikN7QELFLHjkN9YLaf3Y03wybkphDqNtLWOQRXECOO64B4nMn4LGwb9uA0h9a/ eRAaRmRvxWdgcVBFD6ZevJYXPFtrQbd0JvJhN//aSHiar0Yagpz2Grphbduw7fYEhgfsNI AanK+H7kk2hfwgNtlIHX66PRjsywruw= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=81B+gzWiKP3dSyMHoEpejaF7sEqhUPFohDfKzzK3URY=; b=SHYAKMQ+SwVUyLVeypwgrT8ITx 8OWSemfR3V1d5j1KVncg4YVuObwfg9Pbi32h+XryiQ6gJs4IZtST1Vv4iZ2hrbDVmjo3gmEVm7+ex RoPBp7jp/JuF4fa7BxH5vi1oAhRP7/Aw3jj0MJzqlpyt6AFJ90fRZah2qP7iO5Fa4hS+QXNBJM5G2 2fhU4cv9RjOoRb6A67sOeOJMRUWrq9yBLqOOwdzXIP7dYjqfyd7J8G4jWqM9LgJLyWvy41xt0Qfgo kGvvzQfyRIhnon9F7XkqbVma6W8zGAQfkAjRNuTkqVxLf+emMmW/6xjo5W4e00BEBjjlcCfn2iZAf UBeI/ApA==; Received: from [2001:4bb8:19a:272a:910:bb67:7287:f956] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNxeb-002apl-U8; Fri, 03 Feb 2023 15:07:06 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Ilya Dryomov , "Michael S. Tsirkin" , Jason Wang , Minchan Kim , Sergey Senozhatsky , Keith Busch , Sagi Grimberg , Chaitanya Kulkarni , "Martin K. Petersen" , David Howells , Marc Dionne , Xiubo Li , Steve French , Trond Myklebust , Anna Schumaker , Mike Marshall , Andrew Morton , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Chuck Lever , linux-block@vger.kernel.org, ceph-devel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, kvm@vger.kernel.org, netdev@vger.kernel.org, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, devel@lists.orangefs.org, io-uring@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 09/23] virtio_blk: use bvec_set_virt to initialize special_vec Date: Fri, 3 Feb 2023 16:06:20 +0100 Message-Id: <20230203150634.3199647-10-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230203150634.3199647-1-hch@lst.de> References: <20230203150634.3199647-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspamd-Queue-Id: 14C6F180023 X-Stat-Signature: ifanznkt38owqjpidugd1g75po8h1giz X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1675436873-511528 X-HE-Meta: U2FsdGVkX18wYB5P+tRgcQgzTVk9GNbusSUQjHJ/AUFFIY82irsBhLvTEgFzd8+nKL7gYuWGsTr8UklkY3+gpj4+zXrtMfL5ip5u2emqxZjUN26f7x0/JSXQVnUx+Gl7i+3BW4n2tXCE7vhIS2R3LgEqiXmHL6PHOq6cgrHYViQTKwqNn6QwaoB2LwjpALXqXolmKGvuzNArDWcp1HtMXgesKM/KMKvD76AYNTN6nHNsct6vlp7snA3ceZ46TtYDxloFdN513OgA+WST3CL3CaxK2DQzkaAK3FPTJoUw6nR9ci8tgPc48m+Lj3dMA8UjF+Vn9ujFi4IE4ct/zmcUMpIpHBjKIZxgSM1myxyOBSDlpKhuLKaeIRkvfPnqBIu8lX7tVauehwfSsSuqnV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ydZSrKdbp3YcfBl/CfGsaHFKM/7pRoe/YOVQQW9D9JRFoCNy1FYcIU6XKmPa4moQ== 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: Use the bvec_set_virt helper to initialize the special_vec. Signed-off-by: Christoph Hellwig Reviewed-by: Chaitanya Kulkarni Acked-by: Michael S. Tsirkin Acked-by: Jason Wang --- drivers/block/virtio_blk.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 6a77fa91742880..dc6e9b989910b0 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -170,9 +170,7 @@ static int virtblk_setup_discard_write_zeroes_erase(struct request *req, bool un WARN_ON_ONCE(n != segments); - req->special_vec.bv_page = virt_to_page(range); - req->special_vec.bv_offset = offset_in_page(range); - req->special_vec.bv_len = sizeof(*range) * segments; + bvec_set_virt(&req->special_vec, range, sizeof(*range) * segments); req->rq_flags |= RQF_SPECIAL_PAYLOAD; return 0; From patchwork Fri Feb 3 15:06:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13127849 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A672C64EC3 for ; Fri, 3 Feb 2023 15:08:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E44356B0083; Fri, 3 Feb 2023 10:07:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DA4136B0085; Fri, 3 Feb 2023 10:07:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BF9DE6B0088; Fri, 3 Feb 2023 10:07:58 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 9C7726B0083 for ; Fri, 3 Feb 2023 10:07:58 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 653BE1C60AD for ; Fri, 3 Feb 2023 15:07:58 +0000 (UTC) X-FDA: 80426310636.28.8E20410 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf08.hostedemail.com (Postfix) with ESMTP id 952F2160019 for ; Fri, 3 Feb 2023 15:07:56 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=QSfgGBAh; spf=none (imf08.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675436876; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=2ivuZdJU66fGeGNrDCSX2XtHVJq8+h1pLMvYDbA6wQ8=; b=t8aNJbw9B87LmNkp/s7v/sSoulGg/3ESpK6zJ9nqjxxmdPn2gFjqNTlogd4bdlvNBPQw33 LQ7ArAdY1cFsOaMKnPLxWfQn4vzi6pThNvgp5unXDU8sOKsIIoXemuzfGOg4XZ+i9/mNTE pb0jyFexO8vg2jRDlSd0Pi8psX0GVQ8= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=QSfgGBAh; spf=none (imf08.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675436876; a=rsa-sha256; cv=none; b=gYQyQUV5Nqe0KkXbFVaH3Mp5jgsQxrsIfr/rP+cn9dYrzQUudoQ0/n/xQH5ybx1T5G38P7 oXNi2jEfA7TNIA49b3sGgjNe51aFqJCRcW9ufRsd5oah937SXIdnTyf5ZUf4LgZVcouYoT A2H+6CFBjsxRjt5CQsvJeGxlA3LIFos= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=2ivuZdJU66fGeGNrDCSX2XtHVJq8+h1pLMvYDbA6wQ8=; b=QSfgGBAh+EXZxzz/Xx6bibyovx 8Nrgb07oWFXF7SI+3wqJ/enmvP8hFHc6hUi3sA6GWv5A6dP7fcYPg732hEG/Jv2/jgoMcNgX6QddE Klux6y3fIgLzUgx2tQwUDLRbjwR42AzjGvRy3d+zXy8gseAM9WJfDA8waCftfZvGrqDwKbb421JO+ A7KmM+t82WMvPJd60uQmgjS17we9cGNrkQfjYtCxBhWbUJkld5d206L4xTBajgBh6O8m/iXqiwdQ5 Cvd+cDQIEMDIlKCNI2qXlOITbs0hvvqOAEaly0PMreLcEnepGH9pQ2ba/Ud+fBJ4c0tY614+rY/Gv 8MQKv9iw==; Received: from [2001:4bb8:19a:272a:910:bb67:7287:f956] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNxef-002ar9-Df; Fri, 03 Feb 2023 15:07:10 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Ilya Dryomov , "Michael S. Tsirkin" , Jason Wang , Minchan Kim , Sergey Senozhatsky , Keith Busch , Sagi Grimberg , Chaitanya Kulkarni , "Martin K. Petersen" , David Howells , Marc Dionne , Xiubo Li , Steve French , Trond Myklebust , Anna Schumaker , Mike Marshall , Andrew Morton , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Chuck Lever , linux-block@vger.kernel.org, ceph-devel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, kvm@vger.kernel.org, netdev@vger.kernel.org, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, devel@lists.orangefs.org, io-uring@vger.kernel.org, linux-mm@kvack.org, Johannes Thumshirn Subject: [PATCH 10/23] zram: use bvec_set_page to initialize bvecs Date: Fri, 3 Feb 2023 16:06:21 +0100 Message-Id: <20230203150634.3199647-11-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230203150634.3199647-1-hch@lst.de> References: <20230203150634.3199647-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: bprxwbdzn4choocazq5it6jzet1fj8us X-Rspamd-Queue-Id: 952F2160019 X-HE-Tag: 1675436876-534353 X-HE-Meta: U2FsdGVkX19sRg/ipSuyt1ViwVTt3C7+jj4h8N5+WRIowP4Da9gjOjyHMdwvbyDUf4JiVUWx7wwIK+OXBh1Lm/rLlLDge1xj284w4qKBM2+cWeeuJ16utwfwImMAJ3EoKmypLdbnV5b1Mf8ZdS4jqPLHLddgX7Sb1zT8bGklrtn/UPq5qDcS77RiJAPMhzitEus5S+jcnJDAIsKs97kRQ700MN35IIt1RyrV9sH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0hxmDwv1jZCrYUUemvstqUxLHfFhdbeF1bfzwLRDnZ8i3gPItr+eT/MQyhMjqWdGpU3OiZE3tfYR5ZBtbA/lakGFX070Qu75KFGg7rhDA9YFfIUxNIyqo85vPKf5CwvOvkJgI7GHdfkU9/qJnu4VOiYHmNG4GxPHLXuGe8Fdqeejt1SCvMBFlJeEaOiJJ+4hYFBqXMUVvV/lcbLbm7tPCYvhZrqs0MHxGa8Yo6x2kHcItJCKl9I3XaUoaMX3oPsiWPVJ4lYYsLluTdxfRt0UQDpkz 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: Use the bvec_set_page helper to initialize bvecs. Signed-off-by: Christoph Hellwig Reviewed-by: Sergey Senozhatsky Reviewed-by: Johannes Thumshirn --- drivers/block/zram/zram_drv.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index e290d6d970474e..bd8ae4822dc3ef 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -703,9 +703,7 @@ static ssize_t writeback_store(struct device *dev, for (; nr_pages != 0; index++, nr_pages--) { struct bio_vec bvec; - bvec.bv_page = page; - bvec.bv_len = PAGE_SIZE; - bvec.bv_offset = 0; + bvec_set_page(&bvec, page, PAGE_SIZE, 0); spin_lock(&zram->wb_limit_lock); if (zram->wb_limit_enable && !zram->bd_wb_limit) { @@ -1380,12 +1378,9 @@ static void zram_free_page(struct zram *zram, size_t index) static int zram_bvec_read_from_bdev(struct zram *zram, struct page *page, u32 index, struct bio *bio, bool partial_io) { - struct bio_vec bvec = { - .bv_page = page, - .bv_len = PAGE_SIZE, - .bv_offset = 0, - }; + struct bio_vec bvec; + bvec_set_page(&bvec, page, PAGE_SIZE, 0); return read_from_bdev(zram, &bvec, zram_get_element(zram, index), bio, partial_io); } @@ -1652,9 +1647,7 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, memcpy_from_bvec(dst + offset, bvec); kunmap_atomic(dst); - vec.bv_page = page; - vec.bv_len = PAGE_SIZE; - vec.bv_offset = 0; + bvec_set_page(&vec, page, PAGE_SIZE, 0); } ret = __zram_bvec_write(zram, &vec, index, bio); From patchwork Fri Feb 3 15:06:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13127850 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84DDFC6FA95 for ; Fri, 3 Feb 2023 15:08:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 541BC6B0085; Fri, 3 Feb 2023 10:07:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4C9B86B0088; Fri, 3 Feb 2023 10:07:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 27FAD6B0089; Fri, 3 Feb 2023 10:07:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 1178A6B0088 for ; Fri, 3 Feb 2023 10:07:59 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id AA22616115E for ; Fri, 3 Feb 2023 15:07:58 +0000 (UTC) X-FDA: 80426310636.26.99310A5 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf10.hostedemail.com (Postfix) with ESMTP id E8A3DC002A for ; Fri, 3 Feb 2023 15:07:56 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=NsY1QrIC; spf=none (imf10.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675436877; a=rsa-sha256; cv=none; b=GKNmqhP3qHpPgDfJLrX53GruA3rKlwR/0o6g5PleH13bCYQh87XXbpB9Tzo1e4zXbYr7qk cUoALaSK0g6Xlr3YldQrzr3HkuVKkvNZ3X/UmiBmEy1jm0SvuQPMcUl/rUFcNqK/Pk86gU L+bVr09Ebz+wu689AUfyfgh0+JjvtsU= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=NsY1QrIC; spf=none (imf10.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675436877; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ozMZvF4F/akQ9A5h2X8GtqkaNdRpJcsfIZKKgUgmw0I=; b=nslx3mvWOy+yZvds9KbK6k+oI0rULgM02d79unliERuQtKyA4u4kQnm2Ek4QhY19sDH9kW 73SPS/4xthr+ZQ//c3WENidQp9pCAUclfwSSbvguz235kwhJztlTD+T5Dv1bWAamMwG60L CS19c0GYQAQXjL2SuI5I5BefnaqPnXw= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=ozMZvF4F/akQ9A5h2X8GtqkaNdRpJcsfIZKKgUgmw0I=; b=NsY1QrICJKTA+CSUtrWle0mKa2 J8/RIQxPFQRt+FyzQ5NfhJil6+wd+Vb1D0lANR0aVtsgTqodWoWyn5bYXnbq9k7gnNvwyDWOjhkeR vnNOu6CYMAtSzcM2d7xE/VJ+c/Lqtyh0gd6yJ7/d9sjsVhHj/kXrmNHvsVdBtyYWbb7W/dpLiT/IM B0pXXzhjJtTPTahY8zyMrMcj80kL3+TPUMaY5LXlHXlNwy5kPByoRdWKg2ObicNbgL+lI6oGB5aiz BDRVVq4nqS8SAUegJvU4rV6rHUE0xE+U5comPu5ldTD2+F2GUfxaZmug0p3m34pElQJqYWaNcG9FT T62fXDrw==; Received: from [2001:4bb8:19a:272a:910:bb67:7287:f956] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNxej-002at9-3V; Fri, 03 Feb 2023 15:07:13 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Ilya Dryomov , "Michael S. Tsirkin" , Jason Wang , Minchan Kim , Sergey Senozhatsky , Keith Busch , Sagi Grimberg , Chaitanya Kulkarni , "Martin K. Petersen" , David Howells , Marc Dionne , Xiubo Li , Steve French , Trond Myklebust , Anna Schumaker , Mike Marshall , Andrew Morton , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Chuck Lever , linux-block@vger.kernel.org, ceph-devel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, kvm@vger.kernel.org, netdev@vger.kernel.org, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, devel@lists.orangefs.org, io-uring@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 11/23] afs: use bvec_set_folio to initialize a bvec Date: Fri, 3 Feb 2023 16:06:22 +0100 Message-Id: <20230203150634.3199647-12-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230203150634.3199647-1-hch@lst.de> References: <20230203150634.3199647-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspam-User: X-Rspamd-Queue-Id: E8A3DC002A X-Rspamd-Server: rspam01 X-Stat-Signature: nqdt5mjt9gywmsocdxj97pm7tcxy3p47 X-HE-Tag: 1675436876-1653 X-HE-Meta: U2FsdGVkX1+XCM18P9On3H/yyiyA4PetAQJCPXRe+5oVHLNBuWWQQReWH90zAlVYjZH7grMaMBZxpxmEM54rM4oGKMffJ/D8sR4+mBjuBGc5QZWBXaud4LUSBorTuVMvW2ezxiIhKucL0Mk5dBRpqk53d5wPbehs8P9BYOVryrHHJ+eZPFy8ZN9WpNIv3DqD0s5mJ8xt3MbxE0iCPNr36Pm+p9jKo5Vp9iC1iCYseILl+KBYon0QiwNt0J8idYV3NAbalR7eeyX2UkR0Wi0VkqrvAVe8N1ZkDJolTN1OM0RSa0pVnGHnIRpN5MsXX1tx8ab2GBKYFE2IfRmcrD/4QDGdtgjC1+Cet4xRO5jzq99nnU8OtWKS/vMB5Fo9T2cUtjaX2V9NqIP7y2TWPr65EsWRtHKRwHvrUIuy1NyhYICWbBIUX7T+qIqoGmqKMFK8B8TGvFTNd3jJJjTLxPce0PCDgUfJHxC3W21aG7EYCyO4xE7ze4DdpNsyqEYsge9m6w9u0BNy8o0W/ad0Y05s6Ne2MUdDUNn41CpWnmhoVIAym+vVniNPttHcpapssufkr177TvKdB8I1lA9WN2pQZGhBKT0FEWbpdObfaO63GdTzkV3zF0UJQRNTbU9PEkb5aPJB+3nPAvPbCjkb+7u2T4FgXPwE3cMWQDkF0/4n7Eqe+e0u5cALLG/XBUb7VeCR5/+sgulw8aIuqwBe0RUWfkpqPJEZFK6yBk35eSV8jItjjjGGYBbdpkH/KkaReF0jqsRKXgmWPFuaUN+GU7LJPMV5+pRLTRoy877o7AeWnO0yiC4Mz6K/DdBUXRnRPHg3PBCfxDvgbvJ2/0fMBANihLoJ0mcQZ4pd+plCLLg+h0hyi9BmdMCRuJqI/qq2Tvb7aQFYPjHHQcfe17WkA8b1cJ61SQqAWnwJSzlKWjiUW0uY7l+2zCcj9HjflsdiYLKB8unHeHIYSBGO2V+XEPg cSri14UZ jNA168GcC8QCwlcKIJlNumHayCL4lWCmuk9AuiplRnbmkqbG/iiHyeg+jq1g72YkcSMPCEH1hNPapwfg7bmgR9eIuHeK5N7HnBZ4NWDP0HVbe5PDKdgZNUQ8cyJpYvtoIDmA453TmPK8SWL1tXjdJDBY7G5qRdL95m+CMPRJfiWaBy0CHVPqs90iNPllS8Mbtt3QMlEEaDAJO6DZBv9wTqMY4XCzz770zHMNLgqVEF3a9yFeI85Jq9xlVmMsGXxnuJE3B32MxL6wLJUnkD6NcxVVwZ+tOTn6dvy1MRw8nCXWrcX+boDPTTQap/W+/khUBCcN+BY0fmaFj431vsk86r/o8uM1WxoMgQSfD9H7iHkT2ZNkKCEEJ9B4KvXNt7iPaR/GQy/FfSy7wgCTd3QYd8z8SA1T1ldJTKhQgrWCGnhgH37NtBWeApKLim+yWwf8pBcUpRqCNmXWprwQ42J3HmWTUDoLKduTKSNylEUkREtlW1mE1vwdlyRWYkTPymzBuVhrz 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: Use the bvec_set_folio helper to initialize a bvec. Signed-off-by: Christoph Hellwig Acked-by: David Howells --- fs/afs/write.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fs/afs/write.c b/fs/afs/write.c index 19df10d63323d8..2d17891b618e6e 100644 --- a/fs/afs/write.c +++ b/fs/afs/write.c @@ -992,7 +992,7 @@ int afs_launder_folio(struct folio *folio) { struct afs_vnode *vnode = AFS_FS_I(folio_inode(folio)); struct iov_iter iter; - struct bio_vec bv[1]; + struct bio_vec bv; unsigned long priv; unsigned int f, t; int ret = 0; @@ -1008,10 +1008,8 @@ int afs_launder_folio(struct folio *folio) t = afs_folio_dirty_to(folio, priv); } - bv[0].bv_page = &folio->page; - bv[0].bv_offset = f; - bv[0].bv_len = t - f; - iov_iter_bvec(&iter, ITER_SOURCE, bv, 1, bv[0].bv_len); + bvec_set_folio(&bv, folio, t - f, f); + iov_iter_bvec(&iter, ITER_SOURCE, &bv, 1, bv.bv_len); trace_afs_folio_dirty(vnode, tracepoint_string("launder"), folio); ret = afs_store_data(vnode, &iter, folio_pos(folio) + f, true); From patchwork Fri Feb 3 15:06:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13127851 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C995C64EC7 for ; Fri, 3 Feb 2023 15:08:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CBC296B0071; Fri, 3 Feb 2023 10:08:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C440D6B0088; Fri, 3 Feb 2023 10:08:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AE4406B0089; Fri, 3 Feb 2023 10:08:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 9C0066B0071 for ; Fri, 3 Feb 2023 10:08:16 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 46B24161188 for ; Fri, 3 Feb 2023 15:08:16 +0000 (UTC) X-FDA: 80426311392.02.27B48E7 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf03.hostedemail.com (Postfix) with ESMTP id 5073820027 for ; Fri, 3 Feb 2023 15:08:14 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=Fnp2jdWY; spf=none (imf03.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675436894; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=NE7sXkVgEfW+BeR3L//yGcuDdB7IsjAlK/DMIBSqu7s=; b=UpW0fHlGGzneq+gUPq89D9BxJBsw1aY8Somo+KbFUFVAZ4klakzmNkTarpQZkYy73rYn3E u4VCEaks0s4Dx33zMyQMEnmYMCsLyC8kanja4Ex2BXDZMzDi5juL/fdivhHTArXNjvCr0m Vpr+JWmmNtHFV7ieIC4MYsbyzXZNL2s= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=Fnp2jdWY; spf=none (imf03.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675436894; a=rsa-sha256; cv=none; b=J4j46f+oDImwd6zxNqxtLRHGAIcn6bidK4pUt5W/We9yNRcfDTXPgczEEHREHlqPqTD3Gl Jz/h4RHKXJbQBPeiSjsESHHm4CNBdk12C2zlH4jOFwpgAjKd+cQGIYhJDlqNqLxFfgSny+ oRPGm9eAaMDN9ppuOrJkN95uzlzqeeo= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=NE7sXkVgEfW+BeR3L//yGcuDdB7IsjAlK/DMIBSqu7s=; b=Fnp2jdWYwTMeXbFAtIvQJYNyQa WjxRrbcqlA+uZSnkDXcvF3dawsJcLTYFwDLsZpSEdD3p0mAI5oPEH0MgdQwtTmcsdRUlT4/hPTTNv 5W2SQzUVH614kF+/yXtuNxk+euPwDwTlrNXF584VKES2RwzzWDRe4Wcm3IdLqhGjdBw+ZmCW2y32Y z/uflXsj/D+flVPW5oPqHSjieXrEKDnDtsbIZ3MG8mKAME+0M542GyP/3Zyi8JaWgTOwxUTTLPZxx x5BNmyk84X8G5phlnQhcTWFZU/CFzC5luKWY771AIOrD85rcQY7rqjLT8p2eCbdfUfCLs2UqdR/bv NhlHME6w==; Received: from [2001:4bb8:19a:272a:910:bb67:7287:f956] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNxen-002awC-7J; Fri, 03 Feb 2023 15:07:17 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Ilya Dryomov , "Michael S. Tsirkin" , Jason Wang , Minchan Kim , Sergey Senozhatsky , Keith Busch , Sagi Grimberg , Chaitanya Kulkarni , "Martin K. Petersen" , David Howells , Marc Dionne , Xiubo Li , Steve French , Trond Myklebust , Anna Schumaker , Mike Marshall , Andrew Morton , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Chuck Lever , linux-block@vger.kernel.org, ceph-devel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, kvm@vger.kernel.org, netdev@vger.kernel.org, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, devel@lists.orangefs.org, io-uring@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 12/23] ceph: use bvec_set_page to initialize a bvec Date: Fri, 3 Feb 2023 16:06:23 +0100 Message-Id: <20230203150634.3199647-13-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230203150634.3199647-1-hch@lst.de> References: <20230203150634.3199647-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 5073820027 X-Stat-Signature: fgfsr6m7n7zhits448kmc9zpebpfdmp1 X-HE-Tag: 1675436894-174278 X-HE-Meta: U2FsdGVkX18IBN2leM+htXZyMJCk9LrEhfxZC7Pi/ObPM2xq7hjUg5kPBe7YSKzvMMLOb9JieRErvJSlb6t/kV9HpNGFslV7iOnCkoqB4X37QEXyr8oopbkO/F79h6T8tXUZZovPyoTDfrqsj/YBOkmUm1c5K8JOClSgIls2a+LQ/hCBVcJvCzVLNLvYH1uyIqL35Z2I0Wodz1EInBwWPohsXOwUivtvNV/Oh7alWWPhfRBBiJG63Y33j3nO/+bHS5T+Jawslj37IK7cWNvF4Uzv55ygThfAemx9CpWQlJOCjoOozmE6Rc5LmHup6ftsnIuXswhO/btqXhOnMbM98NJwXbORp5P6k50BADLFyHATApdqW+rEw4MlMB/O9mpj2BlNRo8llBkwR7IIoNAKjx4sPrC01AGvZ4JucWJrwJGBHlnq5mcgCsag71XNwkbDZIcziM0gOCVE9kT2unHQJBujbMgr3W5C06JVCtOASWlFR2Ug91oMiQbtC9NOQYA2apG/tA50Unuqv/FOqByiPiZ56zh2Edf7701kF8a+ruAW7sKhVHxlEGzHxGspd8Cs5S9Bt3rnhS5XzqvhhA2wE9LWcdjOusCR4FuHckueZ3Bw1xTi7twYtNcb30DukoMPR3SXueMBZfGZy8thVQ3g2d9kbL5wEX1unDTn9nMWeeqKq8BMypllp8Bql7UhwJhBfAExqgjexssWXPozvSZYgPjnTreKAYWoT92iJIR6edQvPdeJ5WInPAKD6g7nMWgitNae8hwvXQ+uMHnKCvWQi0vLcu6nWRKq8Z1R2QLz1w8mV8vRIxo1Ibxm8umXF40mANu6OB+xwbe9Vi1za1cZjjRZ5ixFiecA8xYKkymA6/Uj6W7x6SgvdGE7WoerqmFcEXKbDpQIFffUzzdNZM553kap7il8KEfEhxN+HoSEp3oB0TyvcmGSCUbKlg8zWnn8j1DDPaRhVn9TPsEZkeE ftERg985 WCEMMlJxz0B+Cm7BtRXamX1LBzu0R5FccP1GXsUv6+B7NOPYOPRrbfbozNBM2S/gLqvAr6Z14gIv+DIDXV+5iGxXGemtSzVmDnWDetZ/VXktRXzrgW/axWyjfdmOguqOPNNgh3YBmaz2RT98KX3LfwFf2UhawoNgWWSXOQs8DWAyLns9p8jabEgNGJrypwSWerbXuNz/6vltxw6eVmSQbFulCwaSBx0HxlTg9Qe1SgvO7UJsXJH+hRzVvwNvXHk62NyGjv+sl/dGdCckUY9yfmFGcNZJoov3866as1HO8BTf6XcstH/48Ek934P0Xv+vSGt/KpbQKZxQrhTC4+pmzEWGi2F7hXjv9SahZtE6qDpmG+j9ZbJ3XU+nDb928W8guZcff3dsUnNpyjeE6mB0+4UnV91dinjy7zPdC6a8VSlBaZmktQokv3t5Gpkum6Q95TLati8HL7+V5VzAIlMFm9v4NIycOozcidckn 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: Use the bvec_set_page helper to initialize a bvec. Signed-off-by: Christoph Hellwig Reviewed-by: Ilya Dryomov --- fs/ceph/file.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 764598e1efd91f..90b2aa7963bf29 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -103,14 +103,10 @@ static ssize_t __iter_get_bvecs(struct iov_iter *iter, size_t maxsize, size += bytes; for ( ; bytes; idx++, bvec_idx++) { - struct bio_vec bv = { - .bv_page = pages[idx], - .bv_len = min_t(int, bytes, PAGE_SIZE - start), - .bv_offset = start, - }; - - bvecs[bvec_idx] = bv; - bytes -= bv.bv_len; + int len = min_t(int, bytes, PAGE_SIZE - start); + + bvec_set_page(&bvecs[bvec_idx], pages[idx], len, start); + bytes -= len; start = 0; } } From patchwork Fri Feb 3 15:06:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13127855 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9AAA4C6FD1B for ; Fri, 3 Feb 2023 15:08:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9D7A46B008A; Fri, 3 Feb 2023 10:08:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 762C46B008C; Fri, 3 Feb 2023 10:08:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 567E76B0092; Fri, 3 Feb 2023 10:08:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 42F1D6B008A for ; Fri, 3 Feb 2023 10:08:18 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 2575C14112C for ; Fri, 3 Feb 2023 15:08:18 +0000 (UTC) X-FDA: 80426311476.06.AB9EC86 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf04.hostedemail.com (Postfix) with ESMTP id 4C3B840026 for ; Fri, 3 Feb 2023 15:08:15 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=JNPxVdH2; dmarc=none; spf=none (imf04.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675436895; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=u+7OceYjciyVxpUOutUWaJMKfPv6hlEZIeFVlh2yS8g=; b=OyFr+21hGl7ZySjYnGPHQtemPIyY99vveJNe8sqq9bTLfJ0Qs+WIKCdeA/neg1ALRMQQyi xQoycdsGro9/64KNUYt98WKPunPU6OQQaVYJFNcO6IsJKkMjR2aHwkLtXPRGPlrSD8WLGE FGimFTCcZ9+w3Nko1FgKPdNIPp3Z1mM= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=JNPxVdH2; dmarc=none; spf=none (imf04.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675436895; a=rsa-sha256; cv=none; b=BGcvQ13dwyR+Xj44C7zVt8ePq9ibhVv7kT6MvA0O8GaiCiD/UBK+zAVf0ZESSONI6DQx8w lxFteJBMoqrb9DTph7mhXpwZquPOs7+FCxizbBr6bPvnvV84YjSXxogXW5qzs+RvhguDr2 e62ohwHfbLp0YWcmeIyM8T6fJflHNaI= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=u+7OceYjciyVxpUOutUWaJMKfPv6hlEZIeFVlh2yS8g=; b=JNPxVdH2tcwGNrPV5YwUFFuLjq QvzWtHd/iHdB7oZubhV2MCnK5KFckF9HQfUBdt8Jf9h/EhD9Bni/5TlQzZvz8lCklgNXUjJVrQxvD kBdeE1aG+yBVilJGU4q3Yoq2W3s/Bd3ZXJALBugfoKkkCRUHcrJ7zG/3PlQn1jkW9Cbo+y4n2Pomk K6wRY+IFtTxD67vsg2C4wIVX98uyYKtd1GgF2Xbw4gSjuNiEbQ3qT7I9J3Z9gCYb4iZmFSAiTYwww Ep9cYftT502Iba00ZDwnQ39cfvaR1FGZ/KYoCMVNlvBPBBNW04loIyOl9T/K3tqePCEWK/E+tU54t GWCszcTg==; Received: from [2001:4bb8:19a:272a:910:bb67:7287:f956] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNxeq-002az4-8l; Fri, 03 Feb 2023 15:07:21 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Ilya Dryomov , "Michael S. Tsirkin" , Jason Wang , Minchan Kim , Sergey Senozhatsky , Keith Busch , Sagi Grimberg , Chaitanya Kulkarni , "Martin K. Petersen" , David Howells , Marc Dionne , Xiubo Li , Steve French , Trond Myklebust , Anna Schumaker , Mike Marshall , Andrew Morton , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Chuck Lever , linux-block@vger.kernel.org, ceph-devel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, kvm@vger.kernel.org, netdev@vger.kernel.org, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, devel@lists.orangefs.org, io-uring@vger.kernel.org, linux-mm@kvack.org, Paulo Alcantara Subject: [PATCH 13/23] cifs: use bvec_set_page to initialize bvecs Date: Fri, 3 Feb 2023 16:06:24 +0100 Message-Id: <20230203150634.3199647-14-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230203150634.3199647-1-hch@lst.de> References: <20230203150634.3199647-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 4C3B840026 X-Stat-Signature: rykd391swqnerdmp5tbay38g7i99pt9m X-HE-Tag: 1675436895-648552 X-HE-Meta: U2FsdGVkX1/vH1NQgU7BOZKXGP3kkL+7HOXcr6O57cdlyHnRDrbs7R1gqYE0CYXNGvXQpzBbhFFtVg4L1EMBg9mgL4jY7aRvhjtLU++Z+WOhrXaAvp7LA2zw2oroi6BuXqoNBocpJ2xulxyrohbNSuHwmFmqcARfNRRp+Wb1rUdZXC4nBz2CJ2Txmu6g68/eTUBGajiR8cR+yMYMBNK659QosYCmzOubtsytIVpl9HLnl4IzC66lJA9HkuUUROAoVQSpHdBjXEeGIbofgWT+IAHdNFgLaSZxZj2LJbN9DvIXse7TtvJQCfjAGb4kwjNaWHkRSA3t4MFvRQ/9DjC2eXWBvqo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jNX3VEhEsZLq/RPuwwgxz/XlkXGdZZMWCwePXxepDWWqhmlSQHTilS9jKEP 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: Use the bvec_set_page helper to initialize bvecs. Signed-off-by: Christoph Hellwig Acked-by: Paulo Alcantara (SUSE) --- fs/cifs/connect.c | 5 +++-- fs/cifs/fscache.c | 16 ++++++---------- fs/cifs/misc.c | 5 ++--- fs/cifs/smb2ops.c | 6 +++--- 4 files changed, 14 insertions(+), 18 deletions(-) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index b2a04b4e89a5e7..e6088d96eb04d2 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -759,8 +759,9 @@ cifs_read_page_from_socket(struct TCP_Server_Info *server, struct page *page, unsigned int page_offset, unsigned int to_read) { struct msghdr smb_msg = {}; - struct bio_vec bv = { - .bv_page = page, .bv_len = to_read, .bv_offset = page_offset}; + struct bio_vec bv; + + bvec_set_page(&bv, page, to_read, page_offset); iov_iter_bvec(&smb_msg.msg_iter, ITER_DEST, &bv, 1, to_read); return cifs_readv_from_socket(server, &smb_msg); } diff --git a/fs/cifs/fscache.c b/fs/cifs/fscache.c index f6f3a6b75601be..0911327ebfdeb4 100644 --- a/fs/cifs/fscache.c +++ b/fs/cifs/fscache.c @@ -143,14 +143,12 @@ static int fscache_fallback_read_page(struct inode *inode, struct page *page) struct netfs_cache_resources cres; struct fscache_cookie *cookie = cifs_inode_cookie(inode); struct iov_iter iter; - struct bio_vec bvec[1]; + struct bio_vec bvec; int ret; memset(&cres, 0, sizeof(cres)); - bvec[0].bv_page = page; - bvec[0].bv_offset = 0; - bvec[0].bv_len = PAGE_SIZE; - iov_iter_bvec(&iter, ITER_DEST, bvec, ARRAY_SIZE(bvec), PAGE_SIZE); + bvec_set_page(&bvec, page, PAGE_SIZE, 0); + iov_iter_bvec(&iter, ITER_DEST, &bvec, 1, PAGE_SIZE); ret = fscache_begin_read_operation(&cres, cookie); if (ret < 0) @@ -171,16 +169,14 @@ static int fscache_fallback_write_page(struct inode *inode, struct page *page, struct netfs_cache_resources cres; struct fscache_cookie *cookie = cifs_inode_cookie(inode); struct iov_iter iter; - struct bio_vec bvec[1]; + struct bio_vec bvec; loff_t start = page_offset(page); size_t len = PAGE_SIZE; int ret; memset(&cres, 0, sizeof(cres)); - bvec[0].bv_page = page; - bvec[0].bv_offset = 0; - bvec[0].bv_len = PAGE_SIZE; - iov_iter_bvec(&iter, ITER_SOURCE, bvec, ARRAY_SIZE(bvec), PAGE_SIZE); + bvec_set_page(&bvec, page, PAGE_SIZE, 0); + iov_iter_bvec(&iter, ITER_SOURCE, &bvec, 1, PAGE_SIZE); ret = fscache_begin_write_operation(&cres, cookie); if (ret < 0) diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c index 2a19c7987c5bd8..95cc4d7dd806d7 100644 --- a/fs/cifs/misc.c +++ b/fs/cifs/misc.c @@ -1054,9 +1054,8 @@ setup_aio_ctx_iter(struct cifs_aio_ctx *ctx, struct iov_iter *iter, int rw) for (i = 0; i < cur_npages; i++) { len = rc > PAGE_SIZE ? PAGE_SIZE : rc; - bv[npages + i].bv_page = pages[i]; - bv[npages + i].bv_offset = start; - bv[npages + i].bv_len = len - start; + bvec_set_page(&bv[npages + i], pages[i], len - start, + start); rc -= len; start = 0; } diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index e6bcd2baf446a9..cb2deac6b2d70e 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -4598,9 +4598,9 @@ init_read_bvec(struct page **pages, unsigned int npages, unsigned int data_size, return -ENOMEM; for (i = 0; i < npages; i++) { - bvec[i].bv_page = pages[i]; - bvec[i].bv_offset = (i == 0) ? cur_off : 0; - bvec[i].bv_len = min_t(unsigned int, PAGE_SIZE, data_size); + bvec_set_page(&bvec[i], pages[i], + min_t(unsigned int, PAGE_SIZE, data_size), + i == 0 ? cur_off : 0); data_size -= bvec[i].bv_len; } From patchwork Fri Feb 3 15:06:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13127852 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40833C6FA95 for ; Fri, 3 Feb 2023 15:08:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 20C2A6B0088; Fri, 3 Feb 2023 10:08:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 16F076B0089; Fri, 3 Feb 2023 10:08:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EB8FD6B008C; Fri, 3 Feb 2023 10:08:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id C616D6B0089 for ; Fri, 3 Feb 2023 10:08:16 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id A45D24115F for ; Fri, 3 Feb 2023 15:08:16 +0000 (UTC) X-FDA: 80426311392.21.F303CE0 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf26.hostedemail.com (Postfix) with ESMTP id E52CA14002B for ; Fri, 3 Feb 2023 15:08:14 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=30k+iDgn; dmarc=none; spf=none (imf26.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675436895; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=iTork4lgSqwAnNzEK3lzK1UwHk37chVOVoUGPRhe1ko=; b=KsGLGG8P0njQRTI5ivStV/HD4PCoK7HqOUKYETPOUlmCN9dk525/L6ncCZy2WQvNpSey4Z hPgkFD2YsAQZUEYxU/gP327XhjCxzNFS+Pn+wZkm7PYwHSWC7muz/ohB4I77E8bI82l6D/ bS4yHv3ifv02eYo6ktdWc4mKE5g6Y9E= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=30k+iDgn; dmarc=none; spf=none (imf26.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675436895; a=rsa-sha256; cv=none; b=Zn4WIhOcSISTXXKCf9tdY6E2CwNiuvuQcEDfcs7oTUcMEJZ1+/L7wwzVc1B3dkhSMmU6Hh CahTSun1r0EV54xiKOivPxrkyIy3/uWc1BAEn42N9hZ2gUy5CqsbPh7lpYf6N20tif8/3c o1/M+zd2jjiAelPyC11j1eYxDwa65I8= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=iTork4lgSqwAnNzEK3lzK1UwHk37chVOVoUGPRhe1ko=; b=30k+iDgncAPWoIs1asbdJ9AypT pITGuCJcL7UjH77N0dHLrWCTR4iipsDLVSW1QkzBjl3E2+n1+Xe4dpJ+eb12NdzBrOfqIv3wyv73u 0B5GW0AkghrWW2KBjdcpriHbaq67fty0PDv5EFHX1PNPyTXgz54iiBjDGBvM6y6LkzWeilykH2Oee NaDGnsn4CsqXIde+48ZnjSRU7C6ug5s0+Gn27MqKY0Us8YXKsPBEPH+CPwhJFQTz+s60KM0HlDquy RajcB2tsdJjsrHGRty4MY961bDPOHyuiO74hKxUINUfu4DP1ybIQAYnV766eoXhGVLyK/brlG2Q0D dPD5YyZw==; Received: from [2001:4bb8:19a:272a:910:bb67:7287:f956] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNxeu-002b0b-M3; Fri, 03 Feb 2023 15:07:25 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Ilya Dryomov , "Michael S. Tsirkin" , Jason Wang , Minchan Kim , Sergey Senozhatsky , Keith Busch , Sagi Grimberg , Chaitanya Kulkarni , "Martin K. Petersen" , David Howells , Marc Dionne , Xiubo Li , Steve French , Trond Myklebust , Anna Schumaker , Mike Marshall , Andrew Morton , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Chuck Lever , linux-block@vger.kernel.org, ceph-devel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, kvm@vger.kernel.org, netdev@vger.kernel.org, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, devel@lists.orangefs.org, io-uring@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 14/23] coredump: use bvec_set_page to initialize a bvec Date: Fri, 3 Feb 2023 16:06:25 +0100 Message-Id: <20230203150634.3199647-15-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230203150634.3199647-1-hch@lst.de> References: <20230203150634.3199647-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: E52CA14002B X-Stat-Signature: qd1i9ymk7s5ww6qttzhgwnzi883jkes5 X-HE-Tag: 1675436894-690864 X-HE-Meta: U2FsdGVkX1/zY+ZQ2b9PWUescrIJuVls0buijU8pZT4FEbIWt97oJshM4g+1OqiLiB54bc2sJzF1Lu0nqGXVI3dKp1GF+LUyd48w+OOY4jMIt4fYmhHP8QlFAG1mhJkWw/ZxJctRhyrEbkKcRsmRs5UA+NVQADUYkt6d8WVIBjzE/HVJ8jwLboM7UGpmSWyPGYAIXb8bm59GXU6sW/+wXDliCSReWrJE6z2Bq62WhVObI6s6w+zVSw4EDOKIUqiCBhUbhQe8VhffBYp2QNQgLv/buHBTsRPnDlaM2Qq3jwRzF6TqTd5cvu2sOaZXXdSrrCQHyA8Q8H7wB8gfjajZWsWjcxEnmb8WiQ/dXKobLb2PywlyUznTb/6Fb1v8DuHMAa+dOAh1n5A5Y0YsyNr2oAr5UP42LMyr0dxrNkh59unEj8k09052jXdiJDnl7Mp89zDZXo3gFOjEsjjxkkVGdfjVSJGluAO7LVggRJg5CD8VVhx02ZWk8oK9mrzbFyQeiyNmpjl5AAyIhve+DNTGa62iWg5h1IQBX8hd4yvjMbxUGzJ0IPKJQjwYIXYywYkkKZaY/4hfS2eZ8M5TYcJpjQ375uw1WsQncb/0QwmV/870o/b/gLB7Xf0/Gy9nUsUn44QXv2+3sJAjHcHpdSCA/URTK2+2e/3+okZ76/tWnkwZM5ycuxSdD5Y2PlLaUQo49ndKfWvOGHOvV2+WP055RI7l0NmSuCILKKJa/1mQphpXv984ub/A4sewIz0hpUh6UgRDXd2ppr4uerpkAZEO4bGR1CcSF7cg4X17ncFRj1ZwdMaE5L4CvfAjCfV0Z7wfXeoOh2jJbe7iioKKlzpZ0alKB8BKImRMLoWhFeuQ7UOx81DJ4T0zPncezXOHDIdywb8ti0/cLn42rRaKDGtGyZDcubh51PiQklV/RvzbiLDMXOVmDPu6bHbbwyoLzPcJ1joQJ0Eo9hBKhJkJ/4L uxqpXOdK wIMNZhw0q15Yt97harHJCFHs8z7uXq4W7UKQ7b1VS2v0Fq1yjpYVIncK9t0dwFE1HCQg4X9cMvgyFqC9R6835Pz0PXAV6uaX2BwHDHBNimqgcbfoV0fq+55ZpBN+t06xn8MozlvU0RZzQk2OfmxmJkC+Sk6gYCsQbKMpa0rDXshLld7TNNQiCWE7JMEW2WR9gMQw7WdEtLuVp3imM0FsIWF6O+D0XMBMEe3mlRg51zIK2GYScuTTPnYeTE+/R2yX6FNtSN8ZKYaxDPf8o0KXstOJz80OF/NX7r022JQHa+RCD5+YA5bOKrjTPpTMSzTttH9VYCjIWYOXjDxwrIXwaXZFFGSwJJ6IrOiNkgk5DdPJ/tYZuE+bRhREXj3bMFeZQPT+83f8IQFSk84VqL0/5XFPkumMPg4ucBVlXGp8eTEIyhXE6NBf8GsQf2PJ6TH7ncQwMHFjDvzwKWJ64dn+0s+zlyxf0iUO7oQvJ 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: Use the bvec_set_page helper to initialize a bvec. Signed-off-by: Christoph Hellwig --- fs/coredump.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/fs/coredump.c b/fs/coredump.c index de78bde2991beb..0a6873a9c4d0cd 100644 --- a/fs/coredump.c +++ b/fs/coredump.c @@ -840,11 +840,7 @@ static int __dump_skip(struct coredump_params *cprm, size_t nr) static int dump_emit_page(struct coredump_params *cprm, struct page *page) { - struct bio_vec bvec = { - .bv_page = page, - .bv_offset = 0, - .bv_len = PAGE_SIZE, - }; + struct bio_vec bvec; struct iov_iter iter; struct file *file = cprm->file; loff_t pos; @@ -860,6 +856,7 @@ static int dump_emit_page(struct coredump_params *cprm, struct page *page) if (dump_interrupted()) return 0; pos = file->f_pos; + bvec_set_page(&bvec, page, PAGE_SIZE, 0); iov_iter_bvec(&iter, ITER_SOURCE, &bvec, 1, PAGE_SIZE); n = __kernel_write_iter(cprm->file, &iter, &pos); if (n != PAGE_SIZE) From patchwork Fri Feb 3 15:06:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13127853 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E26C1C6FD18 for ; Fri, 3 Feb 2023 15:08:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 877616B0089; Fri, 3 Feb 2023 10:08:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7B0C56B008A; Fri, 3 Feb 2023 10:08:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 53EF26B008C; Fri, 3 Feb 2023 10:08:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 3F1CF6B008A for ; Fri, 3 Feb 2023 10:08:17 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 121741C5D84 for ; Fri, 3 Feb 2023 15:08:17 +0000 (UTC) X-FDA: 80426311434.17.B6A74B7 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf30.hostedemail.com (Postfix) with ESMTP id 5026C8002E for ; Fri, 3 Feb 2023 15:08:15 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=Fr2nVID3; spf=none (imf30.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675436895; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=dnA485lnPdqu9fRBS2qkCU3tICV+bOtSo2Jj04+TH0Y=; b=AC2I5yIzErRY4Pbs5iLHcglwEf4VrJnzgTaja8+oZ7YHOPOY5e3Zt3RK89xcRLEUymZ63H yR7JMpcAS2mEBCNCeVSxL6jFIR86Z7XgBYIkqCDjk7Dh71H8NAtoY7RfRueDhIgtzqGOOw 3vjIeSLyVBNAyyvS5sM3wkk0PdpVZrw= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=Fr2nVID3; spf=none (imf30.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675436895; a=rsa-sha256; cv=none; b=gFDPnUClvgFSoMfwJQW5AA6nx4TPvvTIzktQbd4pfpiVYF5UVTIOs04nk33WdX0J9czTeY 831MuzHpo2V0dzod9+O30ekGHi+ldy8p7p1vrXO5ZicWJmvUTXeSBSjD5qLYmV0gpGOrHU N0PqwupgBLLe2QIhePyuiDMQo58LgHU= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=dnA485lnPdqu9fRBS2qkCU3tICV+bOtSo2Jj04+TH0Y=; b=Fr2nVID34QDUltwq0bImkCeDcO /+q6hVRTezRnWD5cp1Mt8wSzR/8lRaNN26QLIzpNwWbueekXAbFKEYoVgwcbDX2xmbETrpybVdFvq qckHbNtD9VLXkwDO8SNcKq8lvYBhiXJr2ALEUy5RbTaChn5QTA/Z6DCFTv4Zkq6K9v7KJu1VCB6Re CVRtkwXX337WesOCBDtZMPzjTxDB7Z/AObQg8qfemm5wGp90YF61h2quDouspw0vBMUrHG46AIt9u jHsBTrclwFPo+jFVAuFu3TRmQnJP2IFco6pruc0D1NUcJz8lug0gER+d9PHihFfSuj858y9ENZCW3 YwwUYTxg==; Received: from [2001:4bb8:19a:272a:910:bb67:7287:f956] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNxex-002b3m-Rl; Fri, 03 Feb 2023 15:07:28 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Ilya Dryomov , "Michael S. Tsirkin" , Jason Wang , Minchan Kim , Sergey Senozhatsky , Keith Busch , Sagi Grimberg , Chaitanya Kulkarni , "Martin K. Petersen" , David Howells , Marc Dionne , Xiubo Li , Steve French , Trond Myklebust , Anna Schumaker , Mike Marshall , Andrew Morton , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Chuck Lever , linux-block@vger.kernel.org, ceph-devel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, kvm@vger.kernel.org, netdev@vger.kernel.org, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, devel@lists.orangefs.org, io-uring@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 15/23] nfs: use bvec_set_page to initialize bvecs Date: Fri, 3 Feb 2023 16:06:26 +0100 Message-Id: <20230203150634.3199647-16-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230203150634.3199647-1-hch@lst.de> References: <20230203150634.3199647-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: m64daupd8y3b4bbkotd114xajm5ka4j5 X-Rspamd-Queue-Id: 5026C8002E X-HE-Tag: 1675436895-283335 X-HE-Meta: U2FsdGVkX1/gH1/zJaQdARap/0uLbo99SLWkwsew/yBB8VmXu/GUWeSM+FpbDWLKPPNh/1OWAPhi1Bo7p7wL1r9VzuiXORj9RyiKp/maRxmT/lDvtI67PQuGpVpOQo46PZtQYeKYl6QoITQyNgQRlYHvz+LYAnhEBt6OTKl7E5JdGzYn/bvsFK4aSDQwee0l2jMPOhl5RebQdMLyuWsG0cBq9E578MyKt+/C7vIRw99RIGmzSraz+kiwUGzZbsjRik+5NKBnZx68gN6nylcLyuAnltsZNcKNYFXLhjB/Xr6I9ewKQv4840FI6TYOesTZ/qylBVdRjKh9B4p8YB/AioFhJOd1eVLI+paAqTgLTmDfi7SsS0YKxA1IadKSMM1e04T+v0UaHlXp7FnCC7C181kEXrzlUaFhf+VEpWF87/9cyrZFnM53bDvHaxkbE+/O8VPc0DCouy6XIpSEfVr7ZNT/9Ci4nF7QigpwCgJe90xcSDkUmaPm4fXOKSpHsz2ETpDw6tYirw4AIKlvDu8eP4rNBG+fqm/NBwlkkShOTo5w39uYzzGgHggiBgB+MqWSjOZplXzA0tHvlFb+Ghye+H7utwR7KvhJGPFQe7mw4Fg8aHihYarW2LKYE3RGAhcZvV5Vpk1KVFrZye2+98HMlc+ccegoT/+iFxB6F4xc3Oc/HT3IvuxpVWFlr7w4Yy00zAPAdk3mLD3MxfBHYdIa8hwJn8BGWewBLQLANSw2TirPspwh0jXYH+MLjIwS+syZVud852T60gnWYPWlHApOwx1FSEojBU5+ub5eVOXBZob5Jm7bwDZOJipXC/Sfd+paOnkPsnHpXuwM2GzkvlsSUV872IO340UOBniJeOoJaZtqIb+UphrVSK1MY1+S+XPAbnNI6tQdyl9+88GKAlDDG6L2/sHFm8qrNbXGIjeQDh1oA1Pw55S3MaUn4oO7DE2NCxCReQclvNroU/XslCE jf8pDn9c 8f+LflKyDzCxozETYwlnDw5QnUyi4foyexE3wDPtfA2yBQDCu2mpfSvZUqFX5xv0mEChxUWYqhzgxTYFZkbHv1lMem3a1Q8OGS9u6jmn/b032+MUMFGQxLRXh8EDytgQr7DTdrD8/mYUWEYfpFskXeR4ANlqS2KHicwPaxwb3DwJXVx4HMlsQfJVIN10j/gERU1w7kKeUHQ46amRrH2I4ua+nrUz03mOYAKdTcYGqPzV2LOdVzK+vLsUNhWHsGcf/tapZaCS5V/rlVh3shGkfSFgCNh/ddu9+F4ADf423Gu9rmr6+tfL40GRQgX2oqm0SV/KCsE8bCugcCnk0Bc++7tNsoOMmSat/4A9OAYL2cyng3UbFDDuRAISVBj3Nd5Gvdv8z+9UPp48QgB+KtPYFWg+ORC/aukncnjuDfNfK95PGkJinfVel4utEER6j35VtSefAlCl06pPszhiEsok4nCtCkFtsnJXeVVtMRAZrmik409Lk8WCWQubg0479kje+ZJ9IO1ZeOFAfJAIHTMElhOBXAFAB4n9XTfFj 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: Use the bvec_set_page helper to initialize bvecs. Signed-off-by: Christoph Hellwig Acked-by: Trond Myklebust --- fs/nfs/fscache.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/fs/nfs/fscache.c b/fs/nfs/fscache.c index e731c00a9fcbc3..ea5f2976dfaba4 100644 --- a/fs/nfs/fscache.c +++ b/fs/nfs/fscache.c @@ -245,14 +245,12 @@ static int fscache_fallback_read_page(struct inode *inode, struct page *page) struct netfs_cache_resources cres; struct fscache_cookie *cookie = nfs_i_fscache(inode); struct iov_iter iter; - struct bio_vec bvec[1]; + struct bio_vec bvec; int ret; memset(&cres, 0, sizeof(cres)); - bvec[0].bv_page = page; - bvec[0].bv_offset = 0; - bvec[0].bv_len = PAGE_SIZE; - iov_iter_bvec(&iter, ITER_DEST, bvec, ARRAY_SIZE(bvec), PAGE_SIZE); + bvec_set_page(&bvec, page, PAGE_SIZE, 0); + iov_iter_bvec(&iter, ITER_DEST, &bvec, 1, PAGE_SIZE); ret = fscache_begin_read_operation(&cres, cookie); if (ret < 0) @@ -273,16 +271,14 @@ static int fscache_fallback_write_page(struct inode *inode, struct page *page, struct netfs_cache_resources cres; struct fscache_cookie *cookie = nfs_i_fscache(inode); struct iov_iter iter; - struct bio_vec bvec[1]; + struct bio_vec bvec; loff_t start = page_offset(page); size_t len = PAGE_SIZE; int ret; memset(&cres, 0, sizeof(cres)); - bvec[0].bv_page = page; - bvec[0].bv_offset = 0; - bvec[0].bv_len = PAGE_SIZE; - iov_iter_bvec(&iter, ITER_SOURCE, bvec, ARRAY_SIZE(bvec), PAGE_SIZE); + bvec_set_page(&bvec, page, PAGE_SIZE, 0); + iov_iter_bvec(&iter, ITER_SOURCE, &bvec, 1, PAGE_SIZE); ret = fscache_begin_write_operation(&cres, cookie); if (ret < 0) From patchwork Fri Feb 3 15:06:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13127856 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51B4EC678DB for ; Fri, 3 Feb 2023 15:08:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 47F436B0093; Fri, 3 Feb 2023 10:08:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3732F6B0099; Fri, 3 Feb 2023 10:08:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EDB1C6B0093; Fri, 3 Feb 2023 10:08:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id D85576B0095 for ; Fri, 3 Feb 2023 10:08:20 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id B44B8141118 for ; Fri, 3 Feb 2023 15:08:20 +0000 (UTC) X-FDA: 80426311560.04.0AB491A Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf27.hostedemail.com (Postfix) with ESMTP id F344340017 for ; Fri, 3 Feb 2023 15:08:18 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=41bYhxy4; spf=none (imf27.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675436899; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=kORmqO/9LhO3glrNFnQu4Hg9yMGINb4dC3Y3cN2SyCY=; b=TsGcSrqpUhG43x9n3iqc26LNyfcRyaFvl3fJoeEkwTx17+KGq/1G9PH7GT5CRhW6UtFXLs 5kXF5ryXzw51PUYiQSb9wuqmJEh0KGHEP701qkG6EM33jAUVda4med2c6BD/60WfhWexGB rhCON3Yy1kK8Wqc4qNnXUHOGKTywiLk= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=41bYhxy4; spf=none (imf27.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675436899; a=rsa-sha256; cv=none; b=HGG1GuSQm/NFRZHeKKF+XtHdJXK2zo+2s59F+Zc1QgPR46lUTje70d4w+sFH89RqY+o7jq O4QjNBO6Q9rPC9Iuve626T2kCDQE7ogLTodychJXojuPeMUQuXXfUSPgNVXnUiqsg3mrQK ikj2Aje4faXxMbgeSTehO90ogK0lBzo= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=kORmqO/9LhO3glrNFnQu4Hg9yMGINb4dC3Y3cN2SyCY=; b=41bYhxy4j/IlMzxFEoHx+Uxb/Q AoA7/uGEehM9h47lmjn1p7wMCxt9YN2chQRTwM9T0U2R33+6P5uw3dFU034X2phyy1FaKZr6D6uZm Iyou7KFZCyjd3dhhg9p+jbvkL4Nxb6yurGLVKQNvr7SNXOMsbnNpwH65HvZRyfpPA1+nugxrw2oX8 3pBDdo50wrWXKZ0GhYhG/bn2vy2Q2l9fNSxBr73HSlVDIWqwtCuv2e6F0W3sVOzyMhe3c85OjeDqi nGFDVsH+onY5nUtibJnC/vm3UzB7E89Fvv+DR2t9yt7brPMGQYvg04XXc1+uC6uVfGrrzMou4bMyC 6VNrGmvQ==; Received: from [2001:4bb8:19a:272a:910:bb67:7287:f956] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNxf1-002b5b-7k; Fri, 03 Feb 2023 15:07:31 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Ilya Dryomov , "Michael S. Tsirkin" , Jason Wang , Minchan Kim , Sergey Senozhatsky , Keith Busch , Sagi Grimberg , Chaitanya Kulkarni , "Martin K. Petersen" , David Howells , Marc Dionne , Xiubo Li , Steve French , Trond Myklebust , Anna Schumaker , Mike Marshall , Andrew Morton , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Chuck Lever , linux-block@vger.kernel.org, ceph-devel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, kvm@vger.kernel.org, netdev@vger.kernel.org, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, devel@lists.orangefs.org, io-uring@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 16/23] orangefs: use bvec_set_{page,folio} to initialize bvecs Date: Fri, 3 Feb 2023 16:06:27 +0100 Message-Id: <20230203150634.3199647-17-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230203150634.3199647-1-hch@lst.de> References: <20230203150634.3199647-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Stat-Signature: p36tej3h6uha6ciqdk6dgw1kzytm4kq1 X-Rspam-User: X-Rspamd-Queue-Id: F344340017 X-Rspamd-Server: rspam06 X-HE-Tag: 1675436898-460089 X-HE-Meta: U2FsdGVkX19LiY1QCluGz6ctyEluNzBUMvRKzfxE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2LgfVLj1oqnY4LmYKH1M5NWTHvK9/ee/x4GfeEVE9p+UE0HGMFDKN+M+bERqYKOVN1al6HDB5zeQg5y48E4eKMd+B4JdnmiX7fdvTwIQWxzjVx66jzNljt6lHr8EEeqIaXndCGLUImSly4fOKgVpn9X6GHuQtKmE518W5s6um/Dw+7DIrzGqn6czPK8rk29ECG5Sik2B82QPcDlbHhvmPNljCeHOA0/pO9xH7xDhy3wmbfr0A7KX0Is4mVeLdNPc5UJhXot0pcOsZKhtj8l3hpKghh2t6YWDiFI99qjlTqmoahKG4komOLJNrrn5AAQcomJVQ/PN4nttilwnO8pAETKWywEre 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: Use the bvec_set_page and bvec_set_folio helpers to initialize bvecs. Signed-off-by: Christoph Hellwig --- fs/orangefs/inode.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c index 4df56089438664..215f6cb3dc4129 100644 --- a/fs/orangefs/inode.c +++ b/fs/orangefs/inode.c @@ -49,10 +49,8 @@ static int orangefs_writepage_locked(struct page *page, /* Should've been handled in orangefs_invalidate_folio. */ WARN_ON(off == len || off + wlen > len); - bv.bv_page = page; - bv.bv_len = wlen; - bv.bv_offset = off % PAGE_SIZE; WARN_ON(wlen == 0); + bvec_set_page(&bv, page, wlen, off % PAGE_SIZE); iov_iter_bvec(&iter, ITER_SOURCE, &bv, 1, wlen); ret = wait_for_direct_io(ORANGEFS_IO_WRITE, inode, &off, &iter, wlen, @@ -102,15 +100,11 @@ static int orangefs_writepages_work(struct orangefs_writepages *ow, for (i = 0; i < ow->npages; i++) { set_page_writeback(ow->pages[i]); - ow->bv[i].bv_page = ow->pages[i]; - ow->bv[i].bv_len = min(page_offset(ow->pages[i]) + PAGE_SIZE, - ow->off + ow->len) - - max(ow->off, page_offset(ow->pages[i])); - if (i == 0) - ow->bv[i].bv_offset = ow->off - - page_offset(ow->pages[i]); - else - ow->bv[i].bv_offset = 0; + bvec_set_page(&ow->bv[i], ow->pages[i], + min(page_offset(ow->pages[i]) + PAGE_SIZE, + ow->off + ow->len) - + max(ow->off, page_offset(ow->pages[i])), + i == 0 ? ow->off - page_offset(ow->pages[i]) : 0); } iov_iter_bvec(&iter, ITER_SOURCE, ow->bv, ow->npages, ow->len); @@ -300,9 +294,7 @@ static int orangefs_read_folio(struct file *file, struct folio *folio) orangefs_launder_folio(folio); off = folio_pos(folio); - bv.bv_page = &folio->page; - bv.bv_len = folio_size(folio); - bv.bv_offset = 0; + bvec_set_folio(&bv, folio, folio_size(folio), 0); iov_iter_bvec(&iter, ITER_DEST, &bv, 1, folio_size(folio)); ret = wait_for_direct_io(ORANGEFS_IO_READ, inode, &off, &iter, From patchwork Fri Feb 3 15:06:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13127857 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2279C6FA9E for ; Fri, 3 Feb 2023 15:08:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8021B6B0092; Fri, 3 Feb 2023 10:08:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6CD376B0098; Fri, 3 Feb 2023 10:08:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 123CF6B0092; Fri, 3 Feb 2023 10:08:21 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id E40EF6B0096 for ; Fri, 3 Feb 2023 10:08:20 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 79C6881195 for ; Fri, 3 Feb 2023 15:08:20 +0000 (UTC) X-FDA: 80426311560.08.ACEB249 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf11.hostedemail.com (Postfix) with ESMTP id A62FF40019 for ; Fri, 3 Feb 2023 15:08:18 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=ULLWnIwz; spf=none (imf11.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675436898; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=dTKHKRVOiZxguFuEK9aGNi2iPJtbueeyhuxlyEfvmCc=; b=2VpwujVO45lBiXLYu10M0YCO4S9n+k0zuFmnHA/grqF0apHAk/Xcn3xRgtA3F8IupT0gWj wJoOjNrKd9SmLX1kNfr7iSb2NfktTFMIpqmVAFkoH+6dVhUfcwXcbDdKrgFo1/gaat4PJG E8fy5WzJZCKP1IA7aWb1xpZFcb/C2us= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=ULLWnIwz; spf=none (imf11.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675436898; a=rsa-sha256; cv=none; b=0qn/hzwmJHgeiqh1Nayj5H1WfGTc9visy08XfT2XbSmFnS42dJFnKU1YtmzWZXVhHiWZx6 ygG1heB2cyXk+ghP4wUoKPvuhv/V8JHxZXDnCp3qGCecquMiYk8yfYpLZ0X/mpc5BJgcmi F+524BxC8yYN7rFNhch/Zo47FRFbYWE= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=dTKHKRVOiZxguFuEK9aGNi2iPJtbueeyhuxlyEfvmCc=; b=ULLWnIwzUEY6/Q9qVLO7gvw8+M XsquPGePTfZjP71b/MLnNmfVIaXdCxfgge7DX2eGe+aN1hNlVP8iNAHk3pdpMmw6X6XyWKRLwXxD1 SaFjagBM0qpcLD4IijuTRJSPdNtwoh4gCxAi/L2yCyhGidBHFlB54moxrLT1CExRm7Qqk0oPRC3QF UztvULRJdPUYIYff571U59dCOzSWdY1aio0h51LL7NmLO9oUnqLBJjGB66OPdgeSs41hpd6cdOYoX /GPjwx4gaHfw2ikNfMjjpM+lD07l/GZC7P4wkmWbqemcZIiGRC8zjRr9UFx1SoNfbMlMuFli+EJdN XKD8CnIA==; Received: from [2001:4bb8:19a:272a:910:bb67:7287:f956] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNxf4-002b8L-GQ; Fri, 03 Feb 2023 15:07:34 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Ilya Dryomov , "Michael S. Tsirkin" , Jason Wang , Minchan Kim , Sergey Senozhatsky , Keith Busch , Sagi Grimberg , Chaitanya Kulkarni , "Martin K. Petersen" , David Howells , Marc Dionne , Xiubo Li , Steve French , Trond Myklebust , Anna Schumaker , Mike Marshall , Andrew Morton , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Chuck Lever , linux-block@vger.kernel.org, ceph-devel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, kvm@vger.kernel.org, netdev@vger.kernel.org, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, devel@lists.orangefs.org, io-uring@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 17/23] splice: use bvec_set_page to initialize a bvec Date: Fri, 3 Feb 2023 16:06:28 +0100 Message-Id: <20230203150634.3199647-18-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230203150634.3199647-1-hch@lst.de> References: <20230203150634.3199647-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspamd-Queue-Id: A62FF40019 X-Stat-Signature: darssu3uhqnbpat6mjr8hup4wbggoped X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1675436898-147074 X-HE-Meta: U2FsdGVkX1/aQJ69ffqxK3jaZMD8ZCFb+Gvk8xQ8E6lVIE7nvQgDkA1PFk/ASENS93/2VikiSAKLVqc83ToU0ufp7cNcqcqvPTz1AvOWxkI75P14W81ULHGFnGXw4U0DRW8CoPs8oJC+RrWUIpWw+b4QGnwtz1OzFQb7Q5cfepXcCvZ1MvI5tQMEpbm+IaEJu+hxrl50UxE86Oew0lKgmhngyc853yqibfEex3CHMc+arIuOIkNMVU6bmm0pFlMRjNm3GnS1dJfvHV8Xv+6ZQehGn+oyPOoWn3CN7HfkJ9i7oQkHaSMNtvp/3mupRvXIuhC+9sZpQDuKloRYUjcCiKuF2C/lzLymbnyiCka4SQLmEm9XSf3pSCaO7+IrdVAmDdQAqq5EhMYYN4RSD2vLyDeP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Tp 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: Use the bvec_set_page helper to initialize a bvec. Signed-off-by: Christoph Hellwig --- fs/splice.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/splice.c b/fs/splice.c index 5969b7a1d353a8..87d9b19349de63 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -675,9 +675,8 @@ iter_file_splice_write(struct pipe_inode_info *pipe, struct file *out, goto done; } - array[n].bv_page = buf->page; - array[n].bv_len = this_len; - array[n].bv_offset = buf->offset; + bvec_set_page(&array[n], buf->page, this_len, + buf->offset); left -= this_len; n++; } From patchwork Fri Feb 3 15:06:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13127854 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2041C61DA4 for ; Fri, 3 Feb 2023 15:08:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1E5AD6B0096; Fri, 3 Feb 2023 10:08:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1970C6B0095; Fri, 3 Feb 2023 10:08:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E4FF16B0098; Fri, 3 Feb 2023 10:08:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id C00606B0092 for ; Fri, 3 Feb 2023 10:08:20 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 8DEE0AAC69 for ; Fri, 3 Feb 2023 15:08:20 +0000 (UTC) X-FDA: 80426311560.07.4EE6DE8 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf03.hostedemail.com (Postfix) with ESMTP id CB14E20024 for ; Fri, 3 Feb 2023 15:08:18 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=dqg23m12; dmarc=none; spf=none (imf03.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675436898; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=uz6cImhGgWSk/8TF7+WqwepdT+RhrZkOFTZ89jD8wXQ=; b=DZz2zm7BBfXfJ8BnuQUQm3WNkLzdeBFN1kwKLJQesvfXzOuptAUi21npFuEbtlClA2Q3L+ Po76WW6Cyo1papSr1/+oso4byd7YfCjv70vtjI7m0GaZjU6U/m99zX4eDDiggSWZ2iCCIK d9C9WTCe710YVH/Lk3cmWQlrv2LBQYk= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=dqg23m12; dmarc=none; spf=none (imf03.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675436898; a=rsa-sha256; cv=none; b=zwrqZB/KFCl8d2mpCM35TE2KCibUDhl8bZDPO9Ksi68tchZhM7bq0wYIOsJ1Pt0whNSU/A aBD1Kt3WOD7S3UNRHX/sAXVyZHlriTKh97G2PnB21B/mnph+qdpY6g+2E6jhrmrGRx4PHq g16WclUXbWqBq18zLdNR98H0I4r0GCg= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=uz6cImhGgWSk/8TF7+WqwepdT+RhrZkOFTZ89jD8wXQ=; b=dqg23m12BEZIc+VFHWEdK49td8 EzPqHiaHBxtaecy8a4y8X9KmXahOdKp7jg+9tm4y17ceS5EUXi5Y0rhCFXCtwp5Y4fT6iz3WzLfXa 8PMeu0NJ+HoX4bd9cUb3vyguqPBAoG2V965H7JO5JZzulxx7QDX6LV1oL9vux38/jBcuxW/wn81F8 gblVm9QyYHoW0PQgRVWTrZyfQv2cWAnrvyZDrY5Y6XUcuq5wTO1C6nBYkE7G/Mnop4FcH7hL6puPI 5A7ewzCc4B45vJ7Vm0+43q0skGlxyWrXRnZrnfWC6wrYcc/Irn3LYyGNLzN48X/EmQ8CB1bkD2V1Q Emla/aRA==; Received: from [2001:4bb8:19a:272a:910:bb67:7287:f956] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNxf7-002bBR-Ve; Fri, 03 Feb 2023 15:07:38 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Ilya Dryomov , "Michael S. Tsirkin" , Jason Wang , Minchan Kim , Sergey Senozhatsky , Keith Busch , Sagi Grimberg , Chaitanya Kulkarni , "Martin K. Petersen" , David Howells , Marc Dionne , Xiubo Li , Steve French , Trond Myklebust , Anna Schumaker , Mike Marshall , Andrew Morton , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Chuck Lever , linux-block@vger.kernel.org, ceph-devel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, kvm@vger.kernel.org, netdev@vger.kernel.org, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, devel@lists.orangefs.org, io-uring@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 18/23] io_uring: use bvec_set_page to initialize a bvec Date: Fri, 3 Feb 2023 16:06:29 +0100 Message-Id: <20230203150634.3199647-19-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230203150634.3199647-1-hch@lst.de> References: <20230203150634.3199647-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: CB14E20024 X-Stat-Signature: cb4munsfr8khkhc5nfqug5g351k6p1n4 X-HE-Tag: 1675436898-737165 X-HE-Meta: U2FsdGVkX1+sB+1rBhtZG0/DASn+B65+5NkuoyoMVLMhkl7v0R4KY3GiGEgpCnUeQ5NZlLi6sV/BSbSAQj18wraeKmEcXKCuc/Z74BeIC9mviapjI/EFvamVFeLaZGJA+6fT26D/jrqO+A8pzwUwaJ2n+zt+3vtb9NmLxi7q9ruFUKN5v/HAcBmSzIWQcHsRRiohIDJWQZGDpj/53HTpx0AVWllJvfIJaczpgcI66wtiTOFznQugtRlK9D0Uqc0OQGNMgX+tc80aDXpVzen6c9jOYch69G570bq2xSNNw5/aL0csiVpkhrJMN0a51eQ1v8IVenpGh9kBfyAHtI+dyscjy8Y+/Bq5EUQXnlfMF1KmDDChVTfpG+XptJiKMlBPkU1CO2wHLrBITXSGmgRFvLyoOT8r8m34bK8L9uaX3YvZfZQYVDnj2YjAz4yRPloV4clKpn0sF8Z3+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, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Use the bvec_set_page helper to initialize a bvec. Signed-off-by: Christoph Hellwig Reviewed-by: Chaitanya Kulkarni --- io_uring/rsrc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c index 18de10c68a151b..a59fc02de5983c 100644 --- a/io_uring/rsrc.c +++ b/io_uring/rsrc.c @@ -1237,9 +1237,7 @@ static int io_sqe_buffer_register(struct io_ring_ctx *ctx, struct iovec *iov, size_t vec_len; vec_len = min_t(size_t, size, PAGE_SIZE - off); - imu->bvec[i].bv_page = pages[i]; - imu->bvec[i].bv_len = vec_len; - imu->bvec[i].bv_offset = off; + bvec_set_page(&imu->bvec[i], pages[i], vec_len, off); off = 0; size -= vec_len; } From patchwork Fri Feb 3 15:06:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13127862 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30801C05027 for ; Fri, 3 Feb 2023 15:09:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AE54B6B0095; Fri, 3 Feb 2023 10:09:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A94856B0096; Fri, 3 Feb 2023 10:09:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 935B16B0098; Fri, 3 Feb 2023 10:09:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 8171C6B0095 for ; Fri, 3 Feb 2023 10:09:29 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 4CE3B410BD for ; Fri, 3 Feb 2023 15:09:29 +0000 (UTC) X-FDA: 80426314458.12.1BB017F Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf29.hostedemail.com (Postfix) with ESMTP id 88CAB120004 for ; Fri, 3 Feb 2023 15:09:27 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=opeqTYIs; spf=none (imf29.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675436967; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=h+lHe/qj9+NLcJnalyqirfAInpcSjbUKRj83r5gu0OY=; b=hULplBzcMJ94viLdBG/HNvtx7Ka8ccUMgchbzO3OdKQHQRcmkIU9mKMSt6OBKlH0tLqNNd +VERY4K7XfJfied758fB/M2pJxqGgls8TCc2yJTRVMhQpmc1fdM4gWTXBURWSK9rilWWbw A2VFBFJeqcBJFf8NJLbgb0530ofeH0U= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=opeqTYIs; spf=none (imf29.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675436967; a=rsa-sha256; cv=none; b=YpDTMMZyg94nGgIf7BMOpHp9nrFp9LefMIQjpWPH0LND7LvuIkmb/WKuKnO4Ad0RWH9QNC xWwCnnrolfOuTVJtpYSr+pKpdaOHgD4r64gDgOH4uxo8/97a6zy2d3r56hYrrH9wJCyRZl c2+3KcdIEITm9VQUgZDWDrMT9ElUEB8= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=h+lHe/qj9+NLcJnalyqirfAInpcSjbUKRj83r5gu0OY=; b=opeqTYIsDd5ySHkM8/Z17yOBYI EYj/TALLVbPcdK9L0xzB5abV1zpI5xqkO2L2YF6MxMZvyva0gUzw7pgM34AaCSLiLPIiDfg6ywwlE p/uz0Hp+FcwrBScWBZ4n4X2ams8XcFdxqkklIPUnlIp6crcuB/NPS5dJIyr64dZwb44pwvjVg1Idr gjtWxsXOoyGZV1XK5Kjfjy+OQZ/3a8RJDFtiI3W/17L8wvNj+WCY1iJfsOS/RvmqrXRrNn9ZnCGQY VbPrXwoOPchaeJVVKF+sqRUov+yXi3gGw6ZN19Dh+G7on2Pg9/Hv3nMZoM1b+AA1D0a86INXiHkNn kOEksMvg==; Received: from [2001:4bb8:19a:272a:910:bb67:7287:f956] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNxfB-002bFh-IR; Fri, 03 Feb 2023 15:07:42 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Ilya Dryomov , "Michael S. Tsirkin" , Jason Wang , Minchan Kim , Sergey Senozhatsky , Keith Busch , Sagi Grimberg , Chaitanya Kulkarni , "Martin K. Petersen" , David Howells , Marc Dionne , Xiubo Li , Steve French , Trond Myklebust , Anna Schumaker , Mike Marshall , Andrew Morton , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Chuck Lever , linux-block@vger.kernel.org, ceph-devel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, kvm@vger.kernel.org, netdev@vger.kernel.org, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, devel@lists.orangefs.org, io-uring@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 19/23] swap: use bvec_set_page to initialize bvecs Date: Fri, 3 Feb 2023 16:06:30 +0100 Message-Id: <20230203150634.3199647-20-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230203150634.3199647-1-hch@lst.de> References: <20230203150634.3199647-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspamd-Queue-Id: 88CAB120004 X-Stat-Signature: a5zgjf4s7rpyorf4b5m7yy6mrjwikg8d X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1675436967-914038 X-HE-Meta: U2FsdGVkX19bptHzTxgpWiZx9Ibh5biZZ6Kf7diTPGirKChByVfsS1cv5ib3fdk99AV0xqnxZKSDBbXxKGZ1Z/pAnUveG8+4itXNPXPD51lrTh6KCQUyF0ZV+dzhzsMc6662ZCL4iO0siHT8ozvJ/TFkcopyLKl5CcYc0BMihCYcFV1GSo9+kAj923xFHlDVoGjYZrY40jFs6tTWbAz4C+oAzgwB4By8HpnMwT4Su8cfPAdXdu1Hj4zVjYh0Xgvj8msyy9Sl90AlLyfxlJKd5BaRXS/xUzn0lSx7xlreqE48MvhymrIpPrX9J6oltBjqrenDKD9cwossCeE7SlEVOuExWfb9bkqcKIJUIAKNJcT0pBXrHH/wFdG0BLFX/EK45BsVQoPrfNhV+HGrwlPqRexCDfm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8G 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: Use the bvec_set_page helper to initialize bvecs. Signed-off-by: Christoph Hellwig --- mm/page_io.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index 3a5f921b932e82..233f6e6eb1c508 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -318,9 +318,7 @@ static int swap_writepage_fs(struct page *page, struct writeback_control *wbc) sio->pages = 0; sio->len = 0; } - sio->bvec[sio->pages].bv_page = page; - sio->bvec[sio->pages].bv_len = thp_size(page); - sio->bvec[sio->pages].bv_offset = 0; + bvec_set_page(&sio->bvec[sio->pages], page, thp_size(page), 0); sio->len += thp_size(page); sio->pages += 1; if (sio->pages == ARRAY_SIZE(sio->bvec) || !wbc->swap_plug) { @@ -432,9 +430,7 @@ static void swap_readpage_fs(struct page *page, sio->pages = 0; sio->len = 0; } - sio->bvec[sio->pages].bv_page = page; - sio->bvec[sio->pages].bv_len = thp_size(page); - sio->bvec[sio->pages].bv_offset = 0; + bvec_set_page(&sio->bvec[sio->pages], page, thp_size(page), 0); sio->len += thp_size(page); sio->pages += 1; if (sio->pages == ARRAY_SIZE(sio->bvec) || !plug) { From patchwork Fri Feb 3 15:06:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13127858 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 987BAC64ED8 for ; Fri, 3 Feb 2023 15:08:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3E1276B0085; Fri, 3 Feb 2023 10:08:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 391CD6B0095; Fri, 3 Feb 2023 10:08:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 20ADC6B0098; Fri, 3 Feb 2023 10:08:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 0E1FC6B0085 for ; Fri, 3 Feb 2023 10:08:25 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id BEDFB41148 for ; Fri, 3 Feb 2023 15:08:24 +0000 (UTC) X-FDA: 80426311728.06.3942E52 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf16.hostedemail.com (Postfix) with ESMTP id 176BA180021 for ; Fri, 3 Feb 2023 15:08:22 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=ToEbOtDN; dmarc=none; spf=none (imf16.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675436903; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=2wTw7HkUjs1o6mx8pDSLEqzVcH91B6qVA7sAnj3S4Po=; b=fIyk3qj251SrpDg6h2tlFb1y+JME9JhZ58M8n4xNb6UfxAJyorpQzs0kGiB5KR88flFJiL j8DshidS7ParHfNOAwBhKhXXX1EUOgT0sUa4wm+jlCW1NUPU87cLXxBAVaIJegWkPnE+ih nDTZU0dpT+pZQ2wlPk+KTtutNKg33wk= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=ToEbOtDN; dmarc=none; spf=none (imf16.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675436903; a=rsa-sha256; cv=none; b=3zkkbUXFAQ6qNuDxbi1wxDjXMg7qVW21MP62xCtCEkMW42yfKIruSK7MEgLhFv344Dm3IY aapY/WBQNtHWxAWO3ZbdYn8Ptuw6yTvU0Pxre110la2pvyrc6PsryX+k9rYHCOh7VkIElN oGZ+71GTq5KEwbZzODUynOzxH79mcu8= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=2wTw7HkUjs1o6mx8pDSLEqzVcH91B6qVA7sAnj3S4Po=; b=ToEbOtDNdTBGoUgoMd3dVYIAK+ Vo+zqcrz8IVsOHzD2xIZFEL2t9Bn/hNiVbmh+YIKKRcvOn1ubj24IihBgJh2kM5KFu6iVtqtwpzxX oRD7Xo02sO7/WXeEh1Bq2VQyw4arZl+NOMyoR/R0jybBJwCkPEAv1fus8+GKr8vOV+/6nctIvAXQX v/8IR4b2+Vt8YkIC6hmjY723lH+FryD2Ya2pjiiKi55AuYTSdyGrkSc/nPY8GqU2dWmMb8VNRdmeA e6icfVpC02OEMu+KnxJRix9jzSPIf3CAvspcMVIb2QGK3zEHEfl6L8YRmlO1OSvmS6PInQuuEdJv8 BjFgLaZQ==; Received: from [2001:4bb8:19a:272a:910:bb67:7287:f956] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNxfH-002bLQ-H0; Fri, 03 Feb 2023 15:07:48 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Ilya Dryomov , "Michael S. Tsirkin" , Jason Wang , Minchan Kim , Sergey Senozhatsky , Keith Busch , Sagi Grimberg , Chaitanya Kulkarni , "Martin K. Petersen" , David Howells , Marc Dionne , Xiubo Li , Steve French , Trond Myklebust , Anna Schumaker , Mike Marshall , Andrew Morton , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Chuck Lever , linux-block@vger.kernel.org, ceph-devel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, kvm@vger.kernel.org, netdev@vger.kernel.org, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, devel@lists.orangefs.org, io-uring@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 20/23] rxrpc: use bvec_set_page to initialize a bvec Date: Fri, 3 Feb 2023 16:06:31 +0100 Message-Id: <20230203150634.3199647-21-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230203150634.3199647-1-hch@lst.de> References: <20230203150634.3199647-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspamd-Queue-Id: 176BA180021 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: p3xwda7x737kcyradw68aexwnb4twfjn X-HE-Tag: 1675436902-665592 X-HE-Meta: U2FsdGVkX1/InOc59nYhPYwtwtprOFOR99Lkd0YPgkrieebhfG64Kk09kKYAgP+mbo8rVIK7TrNUHH0s0u7p7kXvRYSIC/yk2z9F1nFikOlOm5s/EjKIfkzdZC2q849Zy2Enq32lfN7heLujW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b1kAxE4J1UCZiaOCk/yXEbdem7iZaNTvu5pa4m5xDonpqoenK+y4Qu5VG1p+0vGt+RWFC4mhM7mj+6PLa3GGLvI0YY+4oms3AvJ42p9P80PBM/cJhPLWmiAfeWaTG0qRCVpao55u7s8rez/plOvqvfKve8j2m/+n3Mpc1mTI9h8K4FYD0sMJggfaCJuJumC9dtgdTFyJ/iaL8cWb+gDNWRAA8usKJQMcL7d2UTZgUTZOQ4eH/F+/U1IpiSqWARhBe6ZwtRq04fJsEU5sIUkVA2C69ctP 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: Use the bvec_set_page helper to initialize a bvec. Signed-off-by: Christoph Hellwig Acked-by: David Howells --- net/rxrpc/rxperf.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/net/rxrpc/rxperf.c b/net/rxrpc/rxperf.c index 16dcabb71ebe16..4a2e90015ca72c 100644 --- a/net/rxrpc/rxperf.c +++ b/net/rxrpc/rxperf.c @@ -493,7 +493,7 @@ static int rxperf_deliver_request(struct rxperf_call *call) static int rxperf_process_call(struct rxperf_call *call) { struct msghdr msg = {}; - struct bio_vec bv[1]; + struct bio_vec bv; struct kvec iov[1]; ssize_t n; size_t reply_len = call->reply_len, len; @@ -503,10 +503,8 @@ static int rxperf_process_call(struct rxperf_call *call) while (reply_len > 0) { len = min_t(size_t, reply_len, PAGE_SIZE); - bv[0].bv_page = ZERO_PAGE(0); - bv[0].bv_offset = 0; - bv[0].bv_len = len; - iov_iter_bvec(&msg.msg_iter, WRITE, bv, 1, len); + bvec_set_page(&bv, ZERO_PAGE(0), len, 0); + iov_iter_bvec(&msg.msg_iter, WRITE, &bv, 1, len); msg.msg_flags = MSG_MORE; n = rxrpc_kernel_send_data(rxperf_socket, call->rxcall, &msg, len, rxperf_notify_end_reply_tx); From patchwork Fri Feb 3 15:06:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13127860 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73070C636D7 for ; Fri, 3 Feb 2023 15:08:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4A01F6B0078; Fri, 3 Feb 2023 10:08:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 36A776B0095; Fri, 3 Feb 2023 10:08:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0D1F36B0096; Fri, 3 Feb 2023 10:08:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id E84C86B007D for ; Fri, 3 Feb 2023 10:08:48 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id B938EA117F for ; Fri, 3 Feb 2023 15:08:48 +0000 (UTC) X-FDA: 80426312736.13.8665CD6 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf03.hostedemail.com (Postfix) with ESMTP id 9FCF220010 for ; Fri, 3 Feb 2023 15:08:46 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=t9FEQ5rj; dmarc=none; spf=none (imf03.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675436926; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=WVeCTAFZrkMT1bjw8l1TFDAlVxNms+8mA7ykabtaeDg=; b=y+aYkznOJ74rJRByBrVwNiaeI7lCNLTem/UOFXO72EOhOAgzIaZOqvajiwzEQH5kGAANb7 M63FmZFK+DJqpDdMdAbup9jYoI0NhAuPvjOq1IoNWySIVcfNyfsoQpM0pa5t4H733tAzcV 96NW+lIVgF1SVKNx+4VfSA6btlOS90M= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=t9FEQ5rj; dmarc=none; spf=none (imf03.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675436926; a=rsa-sha256; cv=none; b=7ODlT0btij6w8cnEeV76jpYev7wT8sr8HKbsbmkATQrf21TR8BP1ZhE6CGzzJC78zheIry 1ESBhzlWOvVj0SGa0hemS5invzNzagmqv36jFBE1FZliA8jnECkrlpTomLh66eqE4GFtTI Z0kVZNw22scovsugYzfRWhzwvcVodEo= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=WVeCTAFZrkMT1bjw8l1TFDAlVxNms+8mA7ykabtaeDg=; b=t9FEQ5rjC3OIn2nzgYy1gJw8Mr n53fGXsQMf+ehav4QQE5ZTAG8tGsjUiGEBVQYh2SDvUkP9IT5HI/OvK6+Vuq11BsHPccCsYlaVya8 pSFtm+XG2ShLMfy3vd1SSr6c38wjVS0dXGNtGikvtcXOlAn4vjpa1DRXkf999sCWxsy5/DVR36uk5 iqpwoO7N70bhXaz2L3OKdTWPG2CIMdaT/I9joJapJfQKQxfPZTsr5I5s2fspc63TJDqQDH58BYjKO tC7gYnap2gM8uy5sbPN/U8EX8p/ffgsOL0XlluLwFPxZAKLKhDgrpaYcRf0sLoH554FDB8S4FjEB0 l9W1hitg==; Received: from [2001:4bb8:19a:272a:910:bb67:7287:f956] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNxfM-002bR0-0P; Fri, 03 Feb 2023 15:07:52 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Ilya Dryomov , "Michael S. Tsirkin" , Jason Wang , Minchan Kim , Sergey Senozhatsky , Keith Busch , Sagi Grimberg , Chaitanya Kulkarni , "Martin K. Petersen" , David Howells , Marc Dionne , Xiubo Li , Steve French , Trond Myklebust , Anna Schumaker , Mike Marshall , Andrew Morton , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Chuck Lever , linux-block@vger.kernel.org, ceph-devel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, kvm@vger.kernel.org, netdev@vger.kernel.org, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, devel@lists.orangefs.org, io-uring@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 21/23] sunrpc: use bvec_set_page to initialize bvecs Date: Fri, 3 Feb 2023 16:06:32 +0100 Message-Id: <20230203150634.3199647-22-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230203150634.3199647-1-hch@lst.de> References: <20230203150634.3199647-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 9FCF220010 X-Stat-Signature: xnxzc31ibs7czj5d7f69okojiggpq7ip X-HE-Tag: 1675436926-88790 X-HE-Meta: U2FsdGVkX19RpyRucyOgicZ1ADY+gcmirgiXVegsvxYGl7cg+otX8RDr6jMp3Hil0O4/EkFAaygTMaWWWP5DAau1BwI0QOFd6wD+zJQR+3sqBRyyu5N+FzNpyzKsqhLSJPDGo6gSl80zGbi4W/CVHIxFMNhlBc7rx755bScHS1cc+8lcVdI8TRFZ5Vx9mF8OWt95ZaIZ8XKky5BtmCtFWTP8QhHSIs8x3MTh053YLigxZGuvzdYD/4U5GC+2+jAVt6/OPMZlaQSD/9Tz2pLaDzQVi+F8Kbynqur+MCLThtQWMb6pmlNv9hUKA4SfdLrVXNgci7DmuaePqIXk2NiLggqTsHDEjK3/waS+paTLI4AEo/Kr1fb9JlM3uyuYp6j/HgEPkPYR6Wra9BGc/+TDaXIut2NvEoOfeecBmQ1hQGlfZVxnOS+sJUBb2WhCWOT4roBYvQu4JpTWg0ZWRVXdXJ4hQfDXiFiNUJwYsrJhWVeYR6/ya8jmf06GmrYqtRekZCUYf3tvODeTOqluul5ye+kBXJNPWfIFTcICBkAomeNZq/2i7eWCFS3qRtCDFbYNu9EZgrja4vD7RC4qHL8+PrRrOHjVAP4o5Ip9ZascZCQuBLY2sxu9L/ngl9RQRf6c2quo36E015Ygmm3RHVjETGuf42ci+GUUBYCZRrJSXpyx8sopO7xsTgLX7a1sfz0EB6NOapA2CI69skTgVEHfJjgvncizyUAbTWgCzAfWmYkC1bo+TvcGvm5nEkVu7lEauqyiSSenqr93sXH9aqxubw98+DkDF6650ZnRldBBjhvJfksoiW6kSDwj/699fITFLv1PYd0tjh1+M8irO6HVMb55dfdJLX6DXEiEUrIvOlk0Yp6SAAXHlwcppgBFuPxV1+iksYcGmex7gpI13w4db1wao0v3U1bMrNMiXhuOklJVTSvx9AsyRySMDlKW2HYuZhk2BxTeNwqnLrEWFNp qpiUwqGp 0+iTirQayQJiBNBI2zPfwinM2lVteE4epMlr7vc2bZtGRIy3iaEg1PdCnGXoSMpDh5va098IDtql6FD1GU5pDWNJlxwnx1gSewRw9uRG7ns8ojyYxlnVXLzndBvWKRUga6bZf0G6wKSDsoAXIRcSZUVmlCxG7HsWBKoBfOHTLL7XVxtukMYPuQGK7qn6fCVQjeTuSFaA35DICCiONIP5Bsc847YOQOuWb/XuMqUq81YRHbJoxM0ZqBbZO3CGVVqRqkagVxoUtWJVhKjN3SqsZbP/V50hdP5amdgpQSxTFX/p7FbozV4U4/43NsG3vgLHjyg3DbQkyl+irjRZy+4k7FviGHkthi5dsY5w+DNjdBRHcV9o91gO1mWG4Kq1gNx12kvJ6628yDLMGd0/2k5BmHQnK6VNiLmyQlJP5umVyjeFGkve68yqJx3InwnYA95Ra5vuKOBmvb0M7yNhnpbzz+pOvC0tivmWcWYqSWuDLMMoGazbn8RPsQfhrp9ITTSfvkUTJBXtEr9RI8Pk= 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: Use the bvec_set_page helper to initialize bvecs. Signed-off-by: Christoph Hellwig Acked-by: Chuck Lever Acked-by: Trond Myklebust --- net/sunrpc/svcsock.c | 7 ++----- net/sunrpc/xdr.c | 5 ++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index 815baf308236a9..91252adcae4696 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c @@ -252,11 +252,8 @@ static ssize_t svc_tcp_read_msg(struct svc_rqst *rqstp, size_t buflen, clear_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags); - for (i = 0, t = 0; t < buflen; i++, t += PAGE_SIZE) { - bvec[i].bv_page = rqstp->rq_pages[i]; - bvec[i].bv_len = PAGE_SIZE; - bvec[i].bv_offset = 0; - } + for (i = 0, t = 0; t < buflen; i++, t += PAGE_SIZE) + bvec_set_page(&bvec[i], rqstp->rq_pages[i], PAGE_SIZE, 0); rqstp->rq_respages = &rqstp->rq_pages[i]; rqstp->rq_next_page = rqstp->rq_respages + 1; diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c index f7767bf224069f..afe7ec02d23229 100644 --- a/net/sunrpc/xdr.c +++ b/net/sunrpc/xdr.c @@ -150,9 +150,8 @@ xdr_alloc_bvec(struct xdr_buf *buf, gfp_t gfp) if (!buf->bvec) return -ENOMEM; for (i = 0; i < n; i++) { - buf->bvec[i].bv_page = buf->pages[i]; - buf->bvec[i].bv_len = PAGE_SIZE; - buf->bvec[i].bv_offset = 0; + bvec_set_page(&buf->bvec[i], buf->pages[i], PAGE_SIZE, + 0); } } return 0; From patchwork Fri Feb 3 15:06:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13127861 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1438CC636D4 for ; Fri, 3 Feb 2023 15:08:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 725396B0095; Fri, 3 Feb 2023 10:08:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 58EC76B0099; Fri, 3 Feb 2023 10:08:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2A86E6B0098; Fri, 3 Feb 2023 10:08:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id EC1236B0071 for ; Fri, 3 Feb 2023 10:08:48 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id ACA1916119E for ; Fri, 3 Feb 2023 15:08:48 +0000 (UTC) X-FDA: 80426312736.07.3CAE1C5 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf08.hostedemail.com (Postfix) with ESMTP id 90CC316002F for ; Fri, 3 Feb 2023 15:08:46 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=OrVHU0jo; spf=none (imf08.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675436926; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=68cg5sT+53fHc5ofdY3atwSg1h/zl/AMIkCUias8WPw=; b=tF6uk/Z7snrIXEVqv3FkukieFse29yD5Xu3wfheaQG5Mbhv1u2ZVhbdblUvvo+5iKwCwnJ xGPRWS9ZRCRYPwaG2yAL7rnCaSfcz/XBC22wZCMbQahp2Mr+cXKNF+ptvdOfgkWzSeXDRL Waf+px5+mJZyiYwef5njNVwD/PJfzos= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=OrVHU0jo; spf=none (imf08.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675436926; a=rsa-sha256; cv=none; b=l8XpZrQlsdmIeatNQ1Hsw4fQ5sYHEVJryaocSQxGkK8mJibKkGFj+2UtNjjQy571oNJIjC fDmMamZdMRJvhPybIRGiAn3CGfaIsLGdmc62rC5G0yRfIegpGsoo4TdPn/fWIG23VekBeS bCc9RNv/eFr/a60zeAToJiKbJE0L1Vo= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=68cg5sT+53fHc5ofdY3atwSg1h/zl/AMIkCUias8WPw=; b=OrVHU0josMG1tm0/qll5D//KkE sHB2FVfpIhpYTK7rLXJfQyDklsJwU4X0/58LWBOWDUlFRpxm5OX8LZ38On6gVe2XpIOPkeA+P8xoD TZ2DO8jwimsWHueBdTjTCX0C3zVEQX2st4MqlC1sZLeSZATk763qhW5Dd6aQJXWNFMvnnXAy/95Z8 TIBdyMza3fTMTZS9466lhnbRr1s77/RsbXXj8E6Xw/boPxxUBFIiwZCUCRBpZKvgXDUam/JKncbGw EiV8Ifcm45+2EeKCpIOEezYaOc4hDJV6kCVQL6LXD/9gGTXnlkyGLx8cGYuQpVJ8Hzh85F9kOLrSa NJbG5t2A==; Received: from [2001:4bb8:19a:272a:910:bb67:7287:f956] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNxfP-002bWg-QF; Fri, 03 Feb 2023 15:07:56 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Ilya Dryomov , "Michael S. Tsirkin" , Jason Wang , Minchan Kim , Sergey Senozhatsky , Keith Busch , Sagi Grimberg , Chaitanya Kulkarni , "Martin K. Petersen" , David Howells , Marc Dionne , Xiubo Li , Steve French , Trond Myklebust , Anna Schumaker , Mike Marshall , Andrew Morton , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Chuck Lever , linux-block@vger.kernel.org, ceph-devel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, kvm@vger.kernel.org, netdev@vger.kernel.org, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, devel@lists.orangefs.org, io-uring@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 22/23] vringh: use bvec_set_page to initialize a bvec Date: Fri, 3 Feb 2023 16:06:33 +0100 Message-Id: <20230203150634.3199647-23-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230203150634.3199647-1-hch@lst.de> References: <20230203150634.3199647-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: cj9rhz5tkbz5bcetwopqcs8eqrpdh7f5 X-Rspamd-Queue-Id: 90CC316002F X-HE-Tag: 1675436926-221626 X-HE-Meta: U2FsdGVkX18Mm2ZTz5+VnK4G9kFPj5HqTfNa6Cl1rWS7xKrCkYwXZBxzXG/7ZGKjO/rIxmJsRJaS/sXO+DoHi+hgKGEgoab17tL1F/ZQ2EOBq28vCmjeiBnGIMGcaYa3911m/9hcoCHDrjCT677p4XZ42d66aMNxWRUtDCjW1K/ag5Fa0OpiNccu5Zi3vUyGNPAlE0OaY7jYG0C7rMG5UBP69vAgz8c5bYG2U9/gRzcaRS/kI6SOovWEl/tP8dyPVB+Yb8TET66pYkRM+1dn+HZNdOv7jnil3e/g75ceQKv7YvFSkpJNxgs7WpmFucV+GLIFEU8rzVvL3rWLwK3nVur46O2ZP+pBrwFgqCxNp51BE4OPx7SEgtkQ2HJaVo3/h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wxQHKEA9lsCGupNnu8bMzUc1xHHpJRFJYRFRICwqX 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: Use the bvec_set_page helper to initialize a bvec. Signed-off-by: Christoph Hellwig Acked-by: Jason Wang --- drivers/vhost/vringh.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/vhost/vringh.c b/drivers/vhost/vringh.c index 33eb941fcf1546..a1e27da544814a 100644 --- a/drivers/vhost/vringh.c +++ b/drivers/vhost/vringh.c @@ -1126,9 +1126,8 @@ static int iotlb_translate(const struct vringh *vrh, size = map->size - addr + map->start; pa = map->addr + addr - map->start; pfn = pa >> PAGE_SHIFT; - iov[ret].bv_page = pfn_to_page(pfn); - iov[ret].bv_len = min(len - s, size); - iov[ret].bv_offset = pa & (PAGE_SIZE - 1); + bvec_set_page(&iov[ret], pfn_to_page(pfn), min(len - s, size), + pa & (PAGE_SIZE - 1)); s += size; addr += size; ++ret; From patchwork Fri Feb 3 15:06:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13127859 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83A1EC05027 for ; Fri, 3 Feb 2023 15:08:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1983C6B007D; Fri, 3 Feb 2023 10:08:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 123036B0078; Fri, 3 Feb 2023 10:08:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EB5AC6B0095; Fri, 3 Feb 2023 10:08:48 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id D91306B0071 for ; Fri, 3 Feb 2023 10:08:48 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 809BD410BD for ; Fri, 3 Feb 2023 15:08:48 +0000 (UTC) X-FDA: 80426312736.12.75AA121 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf30.hostedemail.com (Postfix) with ESMTP id B6C058001E for ; Fri, 3 Feb 2023 15:08:46 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=BFKATpqt; spf=none (imf30.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675436926; a=rsa-sha256; cv=none; b=ZHy+xh8SfhxjgyHX1iaC4NujW60A+iBvdfVUhRXSoAzPLfDnnElHuU5uQQtVmdZ5pSQNW+ vuGUBd2YSPLKE8sq9/xKA9P1FIjoNRd/4vE8HQANcZIp1GGGDq5737N23956uqmgZSb5Vo +Ayu4jOf80MQwqtpLgO+xNPYk0Au8Qk= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=BFKATpqt; spf=none (imf30.hostedemail.com: domain of BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+416129e804eec9e75a33+7103+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675436926; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=hrqLS9VRJdwWgQKPMrZrcg15ZPJuMvt1hsLhaUGAnIc=; b=aLkdr6VFLmKa7NKtir6PlSaCdhS4fojTNMs6q7Ro6MI07lwLHansIKh+sQKf1KFO0yrb+b jxPNQiX90CdP436SKfpnyUotgP7AUDxP73aUMKNMTERybzbCwymCvxE95cQUQrkdg8cm6D nN4qu+dcSTdgKJNMr+xXR2Hx9KCfKnE= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=hrqLS9VRJdwWgQKPMrZrcg15ZPJuMvt1hsLhaUGAnIc=; b=BFKATpqtVunXubdNNkJ5PWdGdR w5eGqcr1X3knNS9rr6k9oWENyIENlbi6OonNovYL8ZHpJJjUDwpcHhHTonjJY90oiMj+zCg0GCLCT ZgNdYtwQXm0LQxe0W+f7iZTRogn9U/K+/3e+BH4ejOUB6/fIsWrQ9/00S1gnU4+Kd1mny+mtvIcKf JBQbwIHCn96cgHxD69nkGyasiOfbHuKn0hnE8rzKpZB3qBEEW9iNbSwkEF+umPMiYEN99kqyv25Ra OyRlO6fWHiMfP1LpyRoEaKpRG1PL6hAcJNC4/vgMJdlJJBo2kCaI7cWoF5XwWHzsLSZZ3Jn/itg0Q 3+X6SEYg==; Received: from [2001:4bb8:19a:272a:910:bb67:7287:f956] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNxfT-002bcT-3j; Fri, 03 Feb 2023 15:07:59 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Ilya Dryomov , "Michael S. Tsirkin" , Jason Wang , Minchan Kim , Sergey Senozhatsky , Keith Busch , Sagi Grimberg , Chaitanya Kulkarni , "Martin K. Petersen" , David Howells , Marc Dionne , Xiubo Li , Steve French , Trond Myklebust , Anna Schumaker , Mike Marshall , Andrew Morton , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Chuck Lever , linux-block@vger.kernel.org, ceph-devel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, kvm@vger.kernel.org, netdev@vger.kernel.org, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, devel@lists.orangefs.org, io-uring@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 23/23] libceph: use bvec_set_page to initialize bvecs Date: Fri, 3 Feb 2023 16:06:34 +0100 Message-Id: <20230203150634.3199647-24-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230203150634.3199647-1-hch@lst.de> References: <20230203150634.3199647-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspam-User: X-Rspamd-Queue-Id: B6C058001E X-Rspamd-Server: rspam01 X-Stat-Signature: 3mb7nmeh6998fno554cu63h1s8aspk94 X-HE-Tag: 1675436926-752480 X-HE-Meta: U2FsdGVkX1+3tNbVegRw3TWNsRDL66kixdq3A0c2jVNNBJn6zZtFSymz2rKTJZECEm4CqgsD3vU+HbzRPLNhrwu6PyGappCxlnoQDUloUvJp6870xmvHTRmMpN7U7PQzhmQfos7b9pIe5m1Cz8yTBaXkAVTQfTbGNMC+JsGwNoc+ol5kUogmv2Uv8hREKQO9ipONnZoMdY7jzrAP7vnR4Q1KT0ZAYT62PQrBkGqbDTVxkBJ4w1knKGfYQ5uuT2Y540Fvr6NIEdz/T9EcC+e/INlxTf3K2p34dEZ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qx7U35bL1icmnzVk3AEWI41t+3RWdx6kX9NSM77yoaZDZa7MRki7q6NFzFLVDsjDeshouzDk+pzrLzYMHBbLUadRCy65GZdhHHK18cT9gfc/1BKB 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: Use the bvec_set_page helper to initialize bvecs. Signed-off-by: Christoph Hellwig Reviewed-by: Ilya Dryomov --- net/ceph/messenger_v1.c | 7 ++----- net/ceph/messenger_v2.c | 28 +++++++++++----------------- 2 files changed, 13 insertions(+), 22 deletions(-) diff --git a/net/ceph/messenger_v1.c b/net/ceph/messenger_v1.c index d1787d7d33ef9a..d664cb1593a777 100644 --- a/net/ceph/messenger_v1.c +++ b/net/ceph/messenger_v1.c @@ -40,15 +40,12 @@ static int ceph_tcp_recvmsg(struct socket *sock, void *buf, size_t len) static int ceph_tcp_recvpage(struct socket *sock, struct page *page, int page_offset, size_t length) { - struct bio_vec bvec = { - .bv_page = page, - .bv_offset = page_offset, - .bv_len = length - }; + struct bio_vec bvec; struct msghdr msg = { .msg_flags = MSG_DONTWAIT | MSG_NOSIGNAL }; int r; BUG_ON(page_offset + length > PAGE_SIZE); + bvec_set_page(&bvec, page, length, page_offset); iov_iter_bvec(&msg.msg_iter, ITER_DEST, &bvec, 1, length); r = sock_recvmsg(sock, &msg, msg.msg_flags); if (r == -EAGAIN) diff --git a/net/ceph/messenger_v2.c b/net/ceph/messenger_v2.c index 3009028c4fa28f..301a991dc6a68e 100644 --- a/net/ceph/messenger_v2.c +++ b/net/ceph/messenger_v2.c @@ -149,10 +149,10 @@ static int do_try_sendpage(struct socket *sock, struct iov_iter *it) while (iov_iter_count(it)) { /* iov_iter_iovec() for ITER_BVEC */ - bv.bv_page = it->bvec->bv_page; - bv.bv_offset = it->bvec->bv_offset + it->iov_offset; - bv.bv_len = min(iov_iter_count(it), - it->bvec->bv_len - it->iov_offset); + bvec_set_page(&bv, it->bvec->bv_page, + min(iov_iter_count(it), + it->bvec->bv_len - it->iov_offset), + it->bvec->bv_offset + it->iov_offset); /* * sendpage cannot properly handle pages with @@ -286,9 +286,8 @@ static void set_out_bvec_zero(struct ceph_connection *con) WARN_ON(iov_iter_count(&con->v2.out_iter)); WARN_ON(!con->v2.out_zero); - con->v2.out_bvec.bv_page = ceph_zero_page; - con->v2.out_bvec.bv_offset = 0; - con->v2.out_bvec.bv_len = min(con->v2.out_zero, (int)PAGE_SIZE); + bvec_set_page(&con->v2.out_bvec, ceph_zero_page, + min(con->v2.out_zero, (int)PAGE_SIZE), 0); con->v2.out_iter_sendpage = true; iov_iter_bvec(&con->v2.out_iter, ITER_SOURCE, &con->v2.out_bvec, 1, con->v2.out_bvec.bv_len); @@ -863,10 +862,7 @@ static void get_bvec_at(struct ceph_msg_data_cursor *cursor, /* get a piece of data, cursor isn't advanced */ page = ceph_msg_data_next(cursor, &off, &len); - - bv->bv_page = page; - bv->bv_offset = off; - bv->bv_len = len; + bvec_set_page(bv, page, len, off); } static int calc_sg_cnt(void *buf, int buf_len) @@ -1855,9 +1851,8 @@ static void prepare_read_enc_page(struct ceph_connection *con) con->v2.in_enc_resid); WARN_ON(!con->v2.in_enc_resid); - bv.bv_page = con->v2.in_enc_pages[con->v2.in_enc_i]; - bv.bv_offset = 0; - bv.bv_len = min(con->v2.in_enc_resid, (int)PAGE_SIZE); + bvec_set_page(&bv, con->v2.in_enc_pages[con->v2.in_enc_i], + min(con->v2.in_enc_resid, (int)PAGE_SIZE), 0); set_in_bvec(con, &bv); con->v2.in_enc_i++; @@ -2998,9 +2993,8 @@ static void queue_enc_page(struct ceph_connection *con) con->v2.out_enc_resid); WARN_ON(!con->v2.out_enc_resid); - bv.bv_page = con->v2.out_enc_pages[con->v2.out_enc_i]; - bv.bv_offset = 0; - bv.bv_len = min(con->v2.out_enc_resid, (int)PAGE_SIZE); + bvec_set_page(&bv, con->v2.out_enc_pages[con->v2.out_enc_i], + min(con->v2.out_enc_resid, (int)PAGE_SIZE), 0); set_out_bvec(con, &bv, false); con->v2.out_enc_i++;