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
1de037a4
Commit
1de037a4
authored
May 29, 2007
by
Chris Mason
Committed by
David Woodhouse
May 29, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Btrfs: fixup various fsx failures
Signed-off-by:
Chris Mason
<
chris.mason@oracle.com
>
parent
3a686375
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
214 additions
and
32 deletions
+214
-32
fs/btrfs/ctree.h
fs/btrfs/ctree.h
+3
-0
fs/btrfs/file-item.c
fs/btrfs/file-item.c
+30
-0
fs/btrfs/super.c
fs/btrfs/super.c
+181
-32
No files found.
fs/btrfs/ctree.h
View file @
1de037a4
...
...
@@ -1198,5 +1198,8 @@ struct btrfs_csum_item *btrfs_lookup_csum(struct btrfs_trans_handle *trans,
struct
btrfs_path
*
path
,
u64
objectid
,
u64
offset
,
int
cow
);
int
btrfs_csum_truncate
(
struct
btrfs_trans_handle
*
trans
,
struct
btrfs_root
*
root
,
struct
btrfs_path
*
path
,
u64
isize
);
/* super.c */
#endif
fs/btrfs/file-item.c
View file @
1de037a4
...
...
@@ -2,6 +2,7 @@
#include "ctree.h"
#include "disk-io.h"
#include "transaction.h"
#include "print-tree.h"
#define MAX_CSUM_ITEMS(r) ((((BTRFS_LEAF_DATA_SIZE(r) - \
sizeof(struct btrfs_item) * 2) / \
...
...
@@ -27,6 +28,10 @@ int btrfs_insert_file_extent(struct btrfs_trans_handle *trans,
ret
=
btrfs_insert_empty_item
(
trans
,
root
,
path
,
&
file_key
,
sizeof
(
*
item
));
if
(
ret
)
{
printk
(
"failed to insert %Lu %Lu ret %d
\n
"
,
objectid
,
pos
,
ret
);
btrfs_print_leaf
(
root
,
btrfs_buffer_leaf
(
path
->
nodes
[
0
]));
}
BUG_ON
(
ret
);
item
=
btrfs_item_ptr
(
btrfs_buffer_leaf
(
path
->
nodes
[
0
]),
path
->
slots
[
0
],
struct
btrfs_file_extent_item
);
...
...
@@ -218,6 +223,31 @@ fail:
return
ret
;
}
int
btrfs_csum_truncate
(
struct
btrfs_trans_handle
*
trans
,
struct
btrfs_root
*
root
,
struct
btrfs_path
*
path
,
u64
isize
)
{
struct
btrfs_key
key
;
struct
btrfs_leaf
*
leaf
=
btrfs_buffer_leaf
(
path
->
nodes
[
0
]);
int
slot
=
path
->
slots
[
0
];
int
ret
;
u32
new_item_size
;
u64
new_item_span
;
u64
blocks
;
btrfs_disk_key_to_cpu
(
&
key
,
&
leaf
->
items
[
slot
].
key
);
if
(
isize
<=
key
.
offset
)
return
0
;
new_item_span
=
isize
-
key
.
offset
;
blocks
=
(
new_item_span
+
root
->
blocksize
-
1
)
/
root
->
blocksize
;
new_item_size
=
blocks
*
BTRFS_CRC32_SIZE
;
if
(
new_item_size
>=
btrfs_item_size
(
leaf
->
items
+
slot
))
return
0
;
ret
=
btrfs_truncate_item
(
trans
,
root
,
path
,
new_item_size
);
BUG_ON
(
ret
);
return
ret
;
}
int
btrfs_csum_verify_file_block
(
struct
btrfs_root
*
root
,
u64
objectid
,
u64
offset
,
char
*
data
,
size_t
len
)
...
...
fs/btrfs/super.c
View file @
1de037a4
This diff is collapsed.
Click to expand it.
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