Btrfs: Add mount -o nodatasum to turn of file data checksumming

Signed-off-by: Chris Mason <chris.mason@oracle.com>
This commit is contained in:
Chris Mason
2007-12-14 15:30:32 -05:00
parent e9906a9849
commit b6cda9bcb4
4 changed files with 34 additions and 9 deletions

View File

@@ -116,10 +116,13 @@ int btrfs_writepage_io_hook(struct page *page, u64 start, u64 end)
struct btrfs_root *root = BTRFS_I(inode)->root;
struct btrfs_trans_handle *trans;
char *kaddr;
int ret;
int ret = 0;
u64 page_start = (u64)page->index << PAGE_CACHE_SHIFT;
size_t offset = start - page_start;
if (btrfs_test_opt(root, NODATASUM))
return 0;
mutex_lock(&root->fs_info->fs_mutex);
trans = btrfs_start_transaction(root, 1);
btrfs_set_trans_block_group(trans, inode);
@@ -143,6 +146,9 @@ int btrfs_readpage_io_hook(struct page *page, u64 start, u64 end)
struct btrfs_path *path = NULL;
u32 csum;
if (btrfs_test_opt(root, NODATASUM))
return 0;
mutex_lock(&root->fs_info->fs_mutex);
path = btrfs_alloc_path();
item = btrfs_lookup_csum(NULL, root, path, inode->i_ino, start, 0);
@@ -176,6 +182,9 @@ int btrfs_readpage_end_io_hook(struct page *page, u64 start, u64 end)
u32 csum = ~(u32)0;
unsigned long flags;
if (btrfs_test_opt(root, NODATASUM))
return 0;
ret = get_state_private(em_tree, start, &private);
local_irq_save(flags);
kaddr = kmap_atomic(page, KM_IRQ0);