From patchwork Wed Jul 12 21:11:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Overstreet X-Patchwork-Id: 119337 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1418784vqm; Wed, 12 Jul 2023 14:13:39 -0700 (PDT) X-Google-Smtp-Source: APBJJlFLnz7pB2e+agA14nLEdCchQMR9urd+L268gPgPPUMIAOpwqeuxJd5k1YbfluJ8RxtQuYsI X-Received: by 2002:a05:6a20:8f03:b0:12e:64e3:8e65 with SMTP id b3-20020a056a208f0300b0012e64e38e65mr19793986pzk.21.1689196419260; Wed, 12 Jul 2023 14:13:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689196419; cv=none; d=google.com; s=arc-20160816; b=j3ZmA8UQlTlYozgOhp9E6xKOamN5J46aDpxzQUcdP19xzVGDMQk2I4NtA6u3YEBrv5 inlVOeZtFNWL6ivfPb3d3wntLth4ia8bUavT9RB9nOdM23Nue0as5niCP0LS5OFuXo/D yzy7qnF69Cu8YSI3MBF/r0goUk69JRZVu5H9sAPCEqdy+JZ8haC8fjaftlFWnUhkEHI6 OI2RhSse2UcXUtWh6BLpVg+5xvx3A/kbI95i2hr7QJh9xvuN+HUdqFRa66bMrhtV1/XL b/8u0bjNOVjkRRAPxL8L94Qc3JeXLcFktjErAV8VPGkuEKqIa/DRH1E+t0tK1Of1WUne kJ5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0hovXn5ip36DS/VfaxiJk0ApcnzjAAiHK50gEPXD0AU=; fh=Ej6fbvPOzWqd0bLtxhbY7g77cUGKgBTw5FTszBHv0PA=; b=v7KJJ8zZ/+66EOkSgmWRi4SXE9J8wes9839Dx1zqzhRpjVSjh4h4V476m1vLdf5E+l 3A8HuKcPizReDQ8iu7opDABF+L4be32hy3NusiKxLrYjDTZkycyKZGDdjVqSirgo5l4P GGTVPRazC+uhrSg1TBISNiy7BkFYfpjG0Aizbbv084RbhUozRFhQFrd7SSn3YS15r1sX LPLPNTRDPq+kxW1xh3aLTDUORa4Vk69dTHM5drlqslp5WD/WG5Zm9ygWsD6yhkY/YXgV 3j+8iLlj7ucauuFaEqBhxtcZfsYNNeFRtFDcyA08dj9DugCyBFPb+fm7aox22BZb+qIE jXuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=WcemNL3t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d13-20020a170902e14d00b001b000b3f132si3822320pla.298.2023.07.12.14.13.26; Wed, 12 Jul 2023 14:13:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=WcemNL3t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232648AbjGLVMP (ORCPT + 99 others); Wed, 12 Jul 2023 17:12:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229506AbjGLVLv (ORCPT ); Wed, 12 Jul 2023 17:11:51 -0400 Received: from out-47.mta1.migadu.com (out-47.mta1.migadu.com [IPv6:2001:41d0:203:375::2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F08E2130 for ; Wed, 12 Jul 2023 14:11:36 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1689196295; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0hovXn5ip36DS/VfaxiJk0ApcnzjAAiHK50gEPXD0AU=; b=WcemNL3t7opXlf9AhNpewUVTMjWvJl+V8SwttlLTiaj6COPlMXyPbeCKoU9XJvFnhhNOa9 roGp+n2upHMzzwVHvO+a6XfY+n/LuQyLHaxs/1510WsHWDp3rxHTHr7XUAw4xTJ6tWIquM F6FxDnRwkEQJVObpHKdZtYvQYn4pPD0= From: Kent Overstreet To: linux-bcachefs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Kent Overstreet , Kent Overstreet , Jens Axboe , linux-block@vger.kernel.org Subject: [PATCH 06/20] block: Bring back zero_fill_bio_iter Date: Wed, 12 Jul 2023 17:11:01 -0400 Message-Id: <20230712211115.2174650-7-kent.overstreet@linux.dev> In-Reply-To: <20230712211115.2174650-1-kent.overstreet@linux.dev> References: <20230712211115.2174650-1-kent.overstreet@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771250824327320293 X-GMAIL-MSGID: 1771250824327320293 From: Kent Overstreet This reverts 6f822e1b5d9dda3d20e87365de138046e3baa03a - this helper is used by bcachefs. Signed-off-by: Kent Overstreet Cc: Jens Axboe Cc: linux-block@vger.kernel.org --- block/bio.c | 6 +++--- include/linux/bio.h | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/block/bio.c b/block/bio.c index e74a04ea14..70b5c987bc 100644 --- a/block/bio.c +++ b/block/bio.c @@ -606,15 +606,15 @@ struct bio *bio_kmalloc(unsigned short nr_vecs, gfp_t gfp_mask) } EXPORT_SYMBOL(bio_kmalloc); -void zero_fill_bio(struct bio *bio) +void zero_fill_bio_iter(struct bio *bio, struct bvec_iter start) { struct bio_vec bv; struct bvec_iter iter; - bio_for_each_segment(bv, bio, iter) + __bio_for_each_segment(bv, bio, iter, start) memzero_bvec(&bv); } -EXPORT_SYMBOL(zero_fill_bio); +EXPORT_SYMBOL(zero_fill_bio_iter); /** * bio_truncate - truncate the bio to small size of @new_size diff --git a/include/linux/bio.h b/include/linux/bio.h index b3e7529ff5..f2620f8d18 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -484,7 +484,12 @@ extern void bio_copy_data_iter(struct bio *dst, struct bvec_iter *dst_iter, extern void bio_copy_data(struct bio *dst, struct bio *src); extern void bio_free_pages(struct bio *bio); void guard_bio_eod(struct bio *bio); -void zero_fill_bio(struct bio *bio); +void zero_fill_bio_iter(struct bio *bio, struct bvec_iter iter); + +static inline void zero_fill_bio(struct bio *bio) +{ + zero_fill_bio_iter(bio, bio->bi_iter); +} static inline void bio_release_pages(struct bio *bio, bool mark_dirty) {