From patchwork Fri Dec 1 22:11:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 13476475 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=toxicpanda-com.20230601.gappssmtp.com header.i=@toxicpanda-com.20230601.gappssmtp.com header.b="dawyIGX+" Received: from mail-yw1-x1143.google.com (mail-yw1-x1143.google.com [IPv6:2607:f8b0:4864:20::1143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68F7B10D for ; Fri, 1 Dec 2023 14:12:42 -0800 (PST) Received: by mail-yw1-x1143.google.com with SMTP id 00721157ae682-5cd81e76164so29420457b3.1 for ; Fri, 01 Dec 2023 14:12:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20230601.gappssmtp.com; s=20230601; t=1701468761; x=1702073561; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=L4BaCdes/ph+FBDRPrYEBu7SdLjcMrWxDC5DvBg0S2c=; b=dawyIGX+/j59Fp3QrYmEvDcVaU+x2kXvhW57+7o2teFoRRIUe5UUg4PP1GMybleo8h bdTOZJ560HzLFn4sjfMrSTYQZojfoTzgRjcodOdyWIVaK/wApesL8uHs6Ed8LC3XNGfO TSnyNBzT38z7BhtFCG9S0+3B2l+oIl3EjO8XvCeDwCCIdBRar/j9akjTgEbsGLfZv7OE xlHBi/Ble4+ZQLacQc57d0hqUhw1x6Wz2x1wxWJsNGHPazp1ywwXOx0igi47gootvv2h QgkTOcOwjlYtpqbsOBgwLxhEq/N6JOAwBaIemaqnBw3Mil6Fd4ZHWPljw/Vh3RXR30LI mApQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701468761; x=1702073561; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=L4BaCdes/ph+FBDRPrYEBu7SdLjcMrWxDC5DvBg0S2c=; b=lB0Xfj+G7Rd3bbFB3M6WqXtCgQcFg00kLqLt+5fxPP4wmh/9LbJ1+Fqc2psrJAELSN cMJhHNT+FC8OtX1HZjQRBzPOMkaluxj0Hw+tAz2vYrjQAwIF5Tx4OyrnOW3n2/kxsFAn ulN2Z2sHyOHaDvlJ9bp0RXGtUqseUMFTUVM/UZpYjBSocaqAu6c7ZGuHKl5ysM/8KeNg egTU3s/ZV4nlMfHFbtya86QE7o27T40u/WJnMUGvdkLJqU82z20TEx3llU+WINKafrca ekByEkVtzSNV0LBjCk+ZiM4lQTxLS8A3sM3XMbyxLTEFCkzrgermCAEZJZaAvmhsPLtS 621A== X-Gm-Message-State: AOJu0YwZTLqgvMc1MIeB9DT4CCiw3lG8SS2ztd0RTQZ+rv14KPUvaYH0 1SoniTZZwMSNz/0oVIes8ALqCA== X-Google-Smtp-Source: AGHT+IHv1vmVGzBHq4wlGFfWaZrQW10oFqCawez4SOwK+6gJ8tnHa9ANJDCH21YK3W74zvVznRBvSQ== X-Received: by 2002:a05:690c:3607:b0:5d0:edf:9bc4 with SMTP id ft7-20020a05690c360700b005d00edf9bc4mr339063ywb.18.1701468761646; Fri, 01 Dec 2023 14:12:41 -0800 (PST) Received: from localhost (076-182-020-124.res.spectrum.com. [76.182.20.124]) by smtp.gmail.com with ESMTPSA id y16-20020a81a110000000b005cf1ce8b96dsm1040981ywg.5.2023.12.01.14.12.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 14:12:41 -0800 (PST) From: Josef Bacik To: linux-btrfs@vger.kernel.org, kernel-team@fb.com, linux-fsdevel@vger.kernel.org Subject: [PATCH v4 35/46] btrfs: add a bio argument to btrfs_csum_one_bio Date: Fri, 1 Dec 2023 17:11:32 -0500 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 We only ever needed the bbio in btrfs_csum_one_bio, since that has the bio embedded in it. However with encryption we'll have a different bio with the encrypted data in it, and the original bbio. Update btrfs_csum_one_bio to take the bio we're going to csum as an argument, which will allow us to csum the encrypted bio and stuff the csums into the corresponding bbio to be used later when the IO completes. Signed-off-by: Josef Bacik --- fs/btrfs/bio.c | 2 +- fs/btrfs/file-item.c | 3 +-- fs/btrfs/file-item.h | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c index 4f3b693a16b1..90e4d4709fa3 100644 --- a/fs/btrfs/bio.c +++ b/fs/btrfs/bio.c @@ -533,7 +533,7 @@ static blk_status_t btrfs_bio_csum(struct btrfs_bio *bbio) { if (bbio->bio.bi_opf & REQ_META) return btree_csum_one_bio(bbio); - return btrfs_csum_one_bio(bbio); + return btrfs_csum_one_bio(bbio, &bbio->bio); } /* diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c index 35036fab58c4..d925d6d98bf4 100644 --- a/fs/btrfs/file-item.c +++ b/fs/btrfs/file-item.c @@ -730,13 +730,12 @@ int btrfs_lookup_csums_bitmap(struct btrfs_root *root, struct btrfs_path *path, /* * Calculate checksums of the data contained inside a bio. */ -blk_status_t btrfs_csum_one_bio(struct btrfs_bio *bbio) +blk_status_t btrfs_csum_one_bio(struct btrfs_bio *bbio, struct bio *bio) { struct btrfs_ordered_extent *ordered = bbio->ordered; struct btrfs_inode *inode = bbio->inode; struct btrfs_fs_info *fs_info = inode->root->fs_info; SHASH_DESC_ON_STACK(shash, fs_info->csum_shash); - struct bio *bio = &bbio->bio; struct btrfs_ordered_sum *sums; char *data; struct bvec_iter iter; diff --git a/fs/btrfs/file-item.h b/fs/btrfs/file-item.h index bb79014024bd..e52d5d71d533 100644 --- a/fs/btrfs/file-item.h +++ b/fs/btrfs/file-item.h @@ -51,7 +51,7 @@ int btrfs_lookup_file_extent(struct btrfs_trans_handle *trans, int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans, struct btrfs_root *root, struct btrfs_ordered_sum *sums); -blk_status_t btrfs_csum_one_bio(struct btrfs_bio *bbio); +blk_status_t btrfs_csum_one_bio(struct btrfs_bio *bbio, struct bio *bio); blk_status_t btrfs_alloc_dummy_sum(struct btrfs_bio *bbio); int btrfs_lookup_csums_range(struct btrfs_root *root, u64 start, u64 end, struct list_head *list, int search_commit,