Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
9773a788
Commit
9773a788
authored
Mar 27, 2007
by
Chris Mason
Committed by
David Woodhouse
Mar 27, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Btrfs: byte offsets for file keys
Signed-off-by:
Chris Mason
<
chris.mason@oracle.com
>
parent
f4b9aa8d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
5 deletions
+9
-5
fs/btrfs/ctree.h
fs/btrfs/ctree.h
+1
-1
fs/btrfs/file-item.c
fs/btrfs/file-item.c
+3
-2
fs/btrfs/super.c
fs/btrfs/super.c
+5
-2
No files found.
fs/btrfs/ctree.h
View file @
9773a788
...
@@ -899,5 +899,5 @@ int btrfs_alloc_file_extent(struct btrfs_trans_handle *trans,
...
@@ -899,5 +899,5 @@ int btrfs_alloc_file_extent(struct btrfs_trans_handle *trans,
int
btrfs_lookup_file_extent
(
struct
btrfs_trans_handle
*
trans
,
int
btrfs_lookup_file_extent
(
struct
btrfs_trans_handle
*
trans
,
struct
btrfs_root
*
root
,
struct
btrfs_root
*
root
,
struct
btrfs_path
*
path
,
u64
objectid
,
struct
btrfs_path
*
path
,
u64
objectid
,
u64
blocknr
,
u64
num_blocks
,
int
mod
);
u64
blocknr
,
int
mod
);
#endif
#endif
fs/btrfs/file-item.c
View file @
9773a788
...
@@ -26,6 +26,7 @@ int btrfs_alloc_file_extent(struct btrfs_trans_handle *trans,
...
@@ -26,6 +26,7 @@ int btrfs_alloc_file_extent(struct btrfs_trans_handle *trans,
ret
=
btrfs_insert_empty_item
(
trans
,
root
,
&
path
,
&
file_key
,
ret
=
btrfs_insert_empty_item
(
trans
,
root
,
&
path
,
&
file_key
,
sizeof
(
*
item
));
sizeof
(
*
item
));
BUG_ON
(
ret
);
item
=
btrfs_item_ptr
(
btrfs_buffer_leaf
(
path
.
nodes
[
0
]),
path
.
slots
[
0
],
item
=
btrfs_item_ptr
(
btrfs_buffer_leaf
(
path
.
nodes
[
0
]),
path
.
slots
[
0
],
struct
btrfs_file_extent_item
);
struct
btrfs_file_extent_item
);
btrfs_set_file_extent_disk_blocknr
(
item
,
ins
.
objectid
);
btrfs_set_file_extent_disk_blocknr
(
item
,
ins
.
objectid
);
...
@@ -42,7 +43,7 @@ int btrfs_alloc_file_extent(struct btrfs_trans_handle *trans,
...
@@ -42,7 +43,7 @@ int btrfs_alloc_file_extent(struct btrfs_trans_handle *trans,
int
btrfs_lookup_file_extent
(
struct
btrfs_trans_handle
*
trans
,
int
btrfs_lookup_file_extent
(
struct
btrfs_trans_handle
*
trans
,
struct
btrfs_root
*
root
,
struct
btrfs_root
*
root
,
struct
btrfs_path
*
path
,
u64
objectid
,
struct
btrfs_path
*
path
,
u64
objectid
,
u64
blocknr
,
u64
num_blocks
,
int
mod
)
u64
offset
,
int
mod
)
{
{
int
ret
;
int
ret
;
struct
btrfs_key
file_key
;
struct
btrfs_key
file_key
;
...
@@ -50,7 +51,7 @@ int btrfs_lookup_file_extent(struct btrfs_trans_handle *trans,
...
@@ -50,7 +51,7 @@ int btrfs_lookup_file_extent(struct btrfs_trans_handle *trans,
int
cow
=
mod
!=
0
;
int
cow
=
mod
!=
0
;
file_key
.
objectid
=
objectid
;
file_key
.
objectid
=
objectid
;
file_key
.
offset
=
blocknr
;
file_key
.
offset
=
offset
;
file_key
.
flags
=
0
;
file_key
.
flags
=
0
;
btrfs_set_key_type
(
&
file_key
,
BTRFS_EXTENT_DATA_KEY
);
btrfs_set_key_type
(
&
file_key
,
BTRFS_EXTENT_DATA_KEY
);
ret
=
btrfs_search_slot
(
trans
,
root
,
&
file_key
,
path
,
ins_len
,
cow
);
ret
=
btrfs_search_slot
(
trans
,
root
,
&
file_key
,
path
,
ins_len
,
cow
);
...
...
fs/btrfs/super.c
View file @
9773a788
...
@@ -697,7 +697,8 @@ static int btrfs_get_block(struct inode *inode, sector_t iblock,
...
@@ -697,7 +697,8 @@ static int btrfs_get_block(struct inode *inode, sector_t iblock,
ret
=
btrfs_lookup_file_extent
(
trans
,
root
,
&
path
,
ret
=
btrfs_lookup_file_extent
(
trans
,
root
,
&
path
,
inode
->
i_ino
,
iblock
,
1
,
0
);
inode
->
i_ino
,
iblock
<<
inode
->
i_blkbits
,
0
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
btrfs_release_path
(
root
,
&
path
);
btrfs_release_path
(
root
,
&
path
);
err
=
ret
;
err
=
ret
;
...
@@ -737,6 +738,7 @@ static int btrfs_get_block(struct inode *inode, sector_t iblock,
...
@@ -737,6 +738,7 @@ static int btrfs_get_block(struct inode *inode, sector_t iblock,
}
}
extent_start
=
btrfs_disk_key_offset
(
&
leaf
->
items
[
path
.
slots
[
0
]].
key
);
extent_start
=
btrfs_disk_key_offset
(
&
leaf
->
items
[
path
.
slots
[
0
]].
key
);
extent_start
=
extent_start
>>
inode
->
i_blkbits
;
extent_start
+=
btrfs_file_extent_offset
(
item
);
extent_start
+=
btrfs_file_extent_offset
(
item
);
extent_end
=
extent_start
+
btrfs_file_extent_num_blocks
(
item
);
extent_end
=
extent_start
+
btrfs_file_extent_num_blocks
(
item
);
btrfs_release_path
(
root
,
&
path
);
btrfs_release_path
(
root
,
&
path
);
...
@@ -751,7 +753,8 @@ static int btrfs_get_block(struct inode *inode, sector_t iblock,
...
@@ -751,7 +753,8 @@ static int btrfs_get_block(struct inode *inode, sector_t iblock,
err
=
0
;
err
=
0
;
goto
out
;
goto
out
;
}
}
ret
=
btrfs_alloc_file_extent
(
trans
,
root
,
objectid
,
iblock
,
ret
=
btrfs_alloc_file_extent
(
trans
,
root
,
objectid
,
iblock
<<
inode
->
i_blkbits
,
1
,
extent_end
,
&
blocknr
);
1
,
extent_end
,
&
blocknr
);
if
(
ret
)
{
if
(
ret
)
{
err
=
ret
;
err
=
ret
;
...
...
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