瀏覽代碼

Btrfs: fix __MAX_CSUM_ITEMS

Jeff Mahoney's cleanup commit (14a1e067b4) 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 <clm@fb.com>
Chris Mason 9 年之前
父節點
當前提交
42049bf60d
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      fs/btrfs/file-item.c

+ 3 - 2
fs/btrfs/file-item.c

@@ -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))