Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
6e92f5e6
Commit
6e92f5e6
authored
Feb 20, 2008
by
Chris Mason
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Btrfs: While doing checksums on bios, cache the extent_buffer mapping
Signed-off-by:
Chris Mason
<
chris.mason@oracle.com
>
parent
065631f6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
3 deletions
+33
-3
fs/btrfs/file-item.c
fs/btrfs/file-item.c
+33
-3
No files found.
fs/btrfs/file-item.c
View file @
6e92f5e6
...
@@ -156,6 +156,11 @@ int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans,
...
@@ -156,6 +156,11 @@ int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans,
int
bio_index
=
0
;
int
bio_index
=
0
;
struct
bio_vec
*
bvec
=
bio
->
bi_io_vec
;
struct
bio_vec
*
bvec
=
bio
->
bi_io_vec
;
char
*
data
;
char
*
data
;
char
*
eb_map
;
char
*
eb_token
;
unsigned
long
map_len
;
unsigned
long
map_start
;
path
=
btrfs_alloc_path
();
path
=
btrfs_alloc_path
();
BUG_ON
(
!
path
);
BUG_ON
(
!
path
);
...
@@ -272,6 +277,7 @@ found:
...
@@ -272,6 +277,7 @@ found:
item_end
=
btrfs_item_ptr
(
leaf
,
path
->
slots
[
0
],
struct
btrfs_csum_item
);
item_end
=
btrfs_item_ptr
(
leaf
,
path
->
slots
[
0
],
struct
btrfs_csum_item
);
item_end
=
(
struct
btrfs_csum_item
*
)((
unsigned
char
*
)
item_end
+
item_end
=
(
struct
btrfs_csum_item
*
)((
unsigned
char
*
)
item_end
+
btrfs_item_size_nr
(
leaf
,
path
->
slots
[
0
]));
btrfs_item_size_nr
(
leaf
,
path
->
slots
[
0
]));
eb_token
=
NULL
;
next_bvec:
next_bvec:
data
=
kmap_atomic
(
bvec
->
bv_page
,
KM_IRQ0
);
data
=
kmap_atomic
(
bvec
->
bv_page
,
KM_IRQ0
);
csum_result
=
~
(
u32
)
0
;
csum_result
=
~
(
u32
)
0
;
...
@@ -283,15 +289,39 @@ next_bvec:
...
@@ -283,15 +289,39 @@ next_bvec:
printk
(
"csum result is 0 for inode %lu offset %Lu
\n
"
,
inode
->
i_ino
,
offset
);
printk
(
"csum result is 0 for inode %lu offset %Lu
\n
"
,
inode
->
i_ino
,
offset
);
}
}
if
(
!
eb_token
||
(
unsigned
long
)
item
+
BTRFS_CRC32_SIZE
>=
map_start
+
map_len
)
{
int
err
;
if
(
eb_token
)
unmap_extent_buffer
(
leaf
,
eb_token
,
KM_IRQ1
);
eb_token
=
NULL
;
err
=
map_private_extent_buffer
(
leaf
,
(
unsigned
long
)
item
,
BTRFS_CRC32_SIZE
,
&
eb_token
,
&
eb_map
,
&
map_start
,
&
map_len
,
KM_IRQ1
);
if
(
err
)
eb_token
=
NULL
;
}
if
(
eb_token
)
{
memcpy
(
eb_token
+
((
unsigned
long
)
item
&
(
PAGE_CACHE_SIZE
-
1
)),
&
csum_result
,
BTRFS_CRC32_SIZE
);
}
else
{
write_extent_buffer
(
leaf
,
&
csum_result
,
(
unsigned
long
)
item
,
write_extent_buffer
(
leaf
,
&
csum_result
,
(
unsigned
long
)
item
,
BTRFS_CRC32_SIZE
);
BTRFS_CRC32_SIZE
);
}
bio_index
++
;
bio_index
++
;
bvec
++
;
bvec
++
;
if
(
bio_index
<
bio
->
bi_vcnt
)
{
if
(
bio_index
<
bio
->
bi_vcnt
)
{
item
=
(
struct
btrfs_csum_item
*
)((
char
*
)
item
+
BTRFS_CRC32_SIZE
);
item
=
(
struct
btrfs_csum_item
*
)((
char
*
)
item
+
BTRFS_CRC32_SIZE
);
if
(
item
<
item_end
)
if
(
item
<
item_end
)
goto
next_bvec
;
goto
next_bvec
;
}
}
if
(
eb_token
)
{
unmap_extent_buffer
(
leaf
,
eb_token
,
KM_IRQ1
);
eb_token
=
NULL
;
}
btrfs_mark_buffer_dirty
(
path
->
nodes
[
0
]);
btrfs_mark_buffer_dirty
(
path
->
nodes
[
0
]);
if
(
bio_index
<
bio
->
bi_vcnt
)
{
if
(
bio_index
<
bio
->
bi_vcnt
)
{
btrfs_release_path
(
root
,
path
);
btrfs_release_path
(
root
,
path
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment