public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: remove btrfs_csum_ptr
@ 2023-02-10 10:50 Johannes Thumshirn
  2023-02-10 15:45 ` Anand Jain
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Johannes Thumshirn @ 2023-02-10 10:50 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Johannes Thumshirn, Christoph Hellwig

Remove btrfs_csum_ptr() and fold it into it's only caller.

Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
 fs/btrfs/inode.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 44e9acc77a74..d3e1f2712aa5 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3367,13 +3367,6 @@ int btrfs_check_sector_csum(struct btrfs_fs_info *fs_info, struct page *page,
 	return 0;
 }
 
-static u8 *btrfs_csum_ptr(const struct btrfs_fs_info *fs_info, u8 *csums, u64 offset)
-{
-	u64 offset_in_sectors = offset >> fs_info->sectorsize_bits;
-
-	return csums + offset_in_sectors * fs_info->csum_size;
-}
-
 /*
  * Verify the checksum of a single data sector.
  *
@@ -3411,7 +3404,8 @@ bool btrfs_data_csum_ok(struct btrfs_bio *bbio, struct btrfs_device *dev,
 		return true;
 	}
 
-	csum_expected = btrfs_csum_ptr(fs_info, bbio->csum, bio_offset);
+	csum_expected = bbio->csum + (bio_offset >> fs_info->sectorsize_bits) *
+				fs_info->csum_size;
 	if (btrfs_check_sector_csum(fs_info, bv->bv_page, bv->bv_offset, csum,
 				    csum_expected))
 		goto zeroit;
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] btrfs: remove btrfs_csum_ptr
  2023-02-10 10:50 [PATCH] btrfs: remove btrfs_csum_ptr Johannes Thumshirn
@ 2023-02-10 15:45 ` Anand Jain
  2023-02-13  6:32 ` Christoph Hellwig
  2023-02-20 19:31 ` David Sterba
  2 siblings, 0 replies; 4+ messages in thread
From: Anand Jain @ 2023-02-10 15:45 UTC (permalink / raw)
  To: Johannes Thumshirn, linux-btrfs; +Cc: Christoph Hellwig

LGTM

Reviewed-by: Anand Jain <anand.jain@oracle.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] btrfs: remove btrfs_csum_ptr
  2023-02-10 10:50 [PATCH] btrfs: remove btrfs_csum_ptr Johannes Thumshirn
  2023-02-10 15:45 ` Anand Jain
@ 2023-02-13  6:32 ` Christoph Hellwig
  2023-02-20 19:31 ` David Sterba
  2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2023-02-13  6:32 UTC (permalink / raw)
  To: Johannes Thumshirn; +Cc: linux-btrfs, Christoph Hellwig

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] btrfs: remove btrfs_csum_ptr
  2023-02-10 10:50 [PATCH] btrfs: remove btrfs_csum_ptr Johannes Thumshirn
  2023-02-10 15:45 ` Anand Jain
  2023-02-13  6:32 ` Christoph Hellwig
@ 2023-02-20 19:31 ` David Sterba
  2 siblings, 0 replies; 4+ messages in thread
From: David Sterba @ 2023-02-20 19:31 UTC (permalink / raw)
  To: Johannes Thumshirn; +Cc: linux-btrfs, Christoph Hellwig

On Fri, Feb 10, 2023 at 02:50:08AM -0800, Johannes Thumshirn wrote:
> Remove btrfs_csum_ptr() and fold it into it's only caller.
> 
> Cc: Christoph Hellwig <hch@lst.de>
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

Added to misc-next, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-02-20 19:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-10 10:50 [PATCH] btrfs: remove btrfs_csum_ptr Johannes Thumshirn
2023-02-10 15:45 ` Anand Jain
2023-02-13  6:32 ` Christoph Hellwig
2023-02-20 19:31 ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox