diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-12-14 15:30:32 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:03:58 -0400 |
commit | b6cda9bcb4df7544c67fc3548a53bc1607d59f46 (patch) | |
tree | 2bae71b1c9eca52bf1e37ca1b3bdd4525e0a43fd /fs/btrfs/inode.c | |
parent | e9906a98497c26a3c1a7532b51b81cc1fbdf9e1d (diff) |
Btrfs: Add mount -o nodatasum to turn of file data checksumming
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r-- | fs/btrfs/inode.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index e535c50e669b..11885cb114e2 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -116,10 +116,13 @@ int btrfs_writepage_io_hook(struct page *page, u64 start, u64 end) | |||
116 | struct btrfs_root *root = BTRFS_I(inode)->root; | 116 | struct btrfs_root *root = BTRFS_I(inode)->root; |
117 | struct btrfs_trans_handle *trans; | 117 | struct btrfs_trans_handle *trans; |
118 | char *kaddr; | 118 | char *kaddr; |
119 | int ret; | 119 | int ret = 0; |
120 | u64 page_start = (u64)page->index << PAGE_CACHE_SHIFT; | 120 | u64 page_start = (u64)page->index << PAGE_CACHE_SHIFT; |
121 | size_t offset = start - page_start; | 121 | size_t offset = start - page_start; |
122 | 122 | ||
123 | if (btrfs_test_opt(root, NODATASUM)) | ||
124 | return 0; | ||
125 | |||
123 | mutex_lock(&root->fs_info->fs_mutex); | 126 | mutex_lock(&root->fs_info->fs_mutex); |
124 | trans = btrfs_start_transaction(root, 1); | 127 | trans = btrfs_start_transaction(root, 1); |
125 | btrfs_set_trans_block_group(trans, inode); | 128 | btrfs_set_trans_block_group(trans, inode); |
@@ -143,6 +146,9 @@ int btrfs_readpage_io_hook(struct page *page, u64 start, u64 end) | |||
143 | struct btrfs_path *path = NULL; | 146 | struct btrfs_path *path = NULL; |
144 | u32 csum; | 147 | u32 csum; |
145 | 148 | ||
149 | if (btrfs_test_opt(root, NODATASUM)) | ||
150 | return 0; | ||
151 | |||
146 | mutex_lock(&root->fs_info->fs_mutex); | 152 | mutex_lock(&root->fs_info->fs_mutex); |
147 | path = btrfs_alloc_path(); | 153 | path = btrfs_alloc_path(); |
148 | item = btrfs_lookup_csum(NULL, root, path, inode->i_ino, start, 0); | 154 | 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) | |||
176 | u32 csum = ~(u32)0; | 182 | u32 csum = ~(u32)0; |
177 | unsigned long flags; | 183 | unsigned long flags; |
178 | 184 | ||
185 | if (btrfs_test_opt(root, NODATASUM)) | ||
186 | return 0; | ||
187 | |||
179 | ret = get_state_private(em_tree, start, &private); | 188 | ret = get_state_private(em_tree, start, &private); |
180 | local_irq_save(flags); | 189 | local_irq_save(flags); |
181 | kaddr = kmap_atomic(page, KM_IRQ0); | 190 | kaddr = kmap_atomic(page, KM_IRQ0); |