Skip to content

Commit

Permalink
Btrfs: fix __MAX_CSUM_ITEMS
Browse files Browse the repository at this point in the history
Jeff Mahoney's cleanup commit (14a1e06) wasn't correct for csums on
machines where the pagesize >= metadata blocksize.

This just reverts the relevant hunks to bring the old math back.

Signed-off-by: Chris Mason <[email protected]>
  • Loading branch information
masoncl committed Aug 3, 2016
1 parent 023a824 commit 42049bf
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fs/btrfs/file-item.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@
#include "print-tree.h"
#include "compression.h"

#define __MAX_CSUM_ITEMS(r, size) \
((unsigned long)(((BTRFS_MAX_ITEM_SIZE(r) * 2) / size) - 1))
#define __MAX_CSUM_ITEMS(r, size) ((unsigned long)(((BTRFS_LEAF_DATA_SIZE(r) - \
sizeof(struct btrfs_item) * 2) / \
size) - 1))

#define MAX_CSUM_ITEMS(r, size) (min_t(u32, __MAX_CSUM_ITEMS(r, size), \
PAGE_SIZE))
Expand Down

0 comments on commit 42049bf

Please sign in to comment.