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
793955bc
Commit
793955bc
authored
Nov 26, 2007
by
Chris Mason
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Btrfs: Limit btree writeback to prevent seeks
Signed-off-by:
Chris Mason
<
chris.mason@oracle.com
>
parent
015a739c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
0 deletions
+51
-0
fs/btrfs/disk-io.c
fs/btrfs/disk-io.c
+9
-0
fs/btrfs/extent_map.c
fs/btrfs/extent_map.c
+39
-0
fs/btrfs/extent_map.h
fs/btrfs/extent_map.h
+3
-0
No files found.
fs/btrfs/disk-io.c
View file @
793955bc
...
...
@@ -210,6 +210,15 @@ static int btree_writepages(struct address_space *mapping,
{
struct
extent_map_tree
*
tree
;
tree
=
&
BTRFS_I
(
mapping
->
host
)
->
extent_tree
;
if
(
wbc
->
sync_mode
==
WB_SYNC_NONE
)
{
u64
num_dirty
;
u64
start
=
0
;
unsigned
long
thresh
=
96
*
1024
*
1024
;
num_dirty
=
count_range_bits
(
tree
,
&
start
,
thresh
,
EXTENT_DIRTY
);
if
(
num_dirty
<
thresh
)
{
return
0
;
}
}
return
extent_writepages
(
tree
,
mapping
,
btree_get_extent
,
wbc
);
}
...
...
fs/btrfs/extent_map.c
View file @
793955bc
...
...
@@ -1106,6 +1106,45 @@ out:
return
found
;
}
u64
count_range_bits
(
struct
extent_map_tree
*
tree
,
u64
*
start
,
u64
max_bytes
,
unsigned
long
bits
)
{
struct
rb_node
*
node
;
struct
extent_state
*
state
;
u64
cur_start
=
*
start
;
u64
total_bytes
=
0
;
int
found
=
0
;
write_lock_irq
(
&
tree
->
lock
);
/*
* this search will find all the extents that end after
* our range starts.
*/
node
=
tree_search
(
&
tree
->
state
,
cur_start
);
if
(
!
node
||
IS_ERR
(
node
))
{
goto
out
;
}
while
(
1
)
{
state
=
rb_entry
(
node
,
struct
extent_state
,
rb_node
);
if
((
state
->
state
&
bits
))
{
total_bytes
+=
state
->
end
-
state
->
start
+
1
;
if
(
total_bytes
>=
max_bytes
)
break
;
if
(
!
found
)
{
*
start
=
state
->
start
;
found
=
1
;
}
}
node
=
rb_next
(
node
);
if
(
!
node
)
break
;
}
out:
write_unlock_irq
(
&
tree
->
lock
);
return
total_bytes
;
}
/*
* helper function to lock both pages and extents in the tree.
* pages must be locked first.
...
...
fs/btrfs/extent_map.h
View file @
793955bc
...
...
@@ -113,6 +113,9 @@ int extent_read_full_page(struct extent_map_tree *tree, struct page *page,
int
__init
extent_map_init
(
void
);
void
__exit
extent_map_exit
(
void
);
u64
count_range_bits
(
struct
extent_map_tree
*
tree
,
u64
*
start
,
u64
max_bytes
,
unsigned
long
bits
);
int
test_range_bit
(
struct
extent_map_tree
*
tree
,
u64
start
,
u64
end
,
int
bits
,
int
filled
);
int
clear_extent_bits
(
struct
extent_map_tree
*
tree
,
u64
start
,
u64
end
,
...
...
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