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
48ddc6f4
Commit
48ddc6f4
authored
Apr 10, 2007
by
Chris Mason
Committed by
David Woodhouse
Apr 10, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Btrfs: cow file extents before writing
Signed-off-by:
Chris Mason
<
chris.mason@oracle.com
>
parent
d0dbc624
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
2 deletions
+18
-2
fs/btrfs/super.c
fs/btrfs/super.c
+18
-2
No files found.
fs/btrfs/super.c
View file @
48ddc6f4
...
...
@@ -1020,7 +1020,7 @@ static int btrfs_get_block_lock(struct inode *inode, sector_t iblock,
ret
=
btrfs_lookup_file_extent
(
trans
,
root
,
path
,
inode
->
i_ino
,
iblock
<<
inode
->
i_blkbits
,
0
);
iblock
<<
inode
->
i_blkbits
,
1
);
if
(
ret
<
0
)
{
err
=
ret
;
goto
out
;
...
...
@@ -1040,9 +1040,25 @@ static int btrfs_get_block_lock(struct inode *inode, sector_t iblock,
blocknr
=
btrfs_file_extent_disk_blocknr
(
item
);
blocknr
+=
btrfs_file_extent_offset
(
item
);
/* exact match found, use it */
/* exact match found, use it, FIXME, deal with extents
* other than the page size
*/
if
(
ret
==
0
)
{
err
=
0
;
BUG_ON
(
btrfs_file_extent_disk_num_blocks
(
item
)
!=
1
);
if
(
btrfs_file_extent_generation
(
item
)
!=
trans
->
transid
)
{
struct
btrfs_key
ins
;
ret
=
btrfs_alloc_extent
(
trans
,
root
,
1
,
blocknr
,
(
u64
)
-
1
,
&
ins
);
BUG_ON
(
ret
);
btrfs_set_file_extent_disk_blocknr
(
item
,
ins
.
objectid
);
mark_buffer_dirty
(
path
->
nodes
[
0
]);
ret
=
btrfs_free_extent
(
trans
,
root
,
blocknr
,
1
,
0
);
BUG_ON
(
ret
);
blocknr
=
ins
.
objectid
;
}
map_bh
(
result
,
inode
->
i_sb
,
blocknr
);
goto
out
;
}
...
...
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