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
bcbfce8a
Commit
bcbfce8a
authored
Apr 22, 2008
by
Chris Mason
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Btrfs: Fix the unplug_io_fn to grab a consistent copy of page->mapping
Signed-off-by:
Chris Mason
<
chris.mason@oracle.com
>
parent
e1c4b745
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
7 deletions
+22
-7
fs/btrfs/disk-io.c
fs/btrfs/disk-io.c
+12
-1
fs/btrfs/inode.c
fs/btrfs/inode.c
+10
-6
No files found.
fs/btrfs/disk-io.c
View file @
bcbfce8a
...
...
@@ -936,14 +936,25 @@ void btrfs_unplug_io_fn(struct backing_dev_info *bdi, struct page *page)
struct
inode
*
inode
;
struct
extent_map_tree
*
em_tree
;
struct
extent_map
*
em
;
struct
address_space
*
mapping
;
u64
offset
;
/* the generic O_DIRECT read code does this */
if
(
!
page
)
{
__unplug_io_fn
(
bdi
,
page
);
return
;
}
inode
=
page
->
mapping
->
host
;
/*
* page->mapping may change at any time. Get a consistent copy
* and use that for everything below
*/
smp_mb
();
mapping
=
page
->
mapping
;
if
(
!
mapping
)
return
;
inode
=
mapping
->
host
;
offset
=
page_offset
(
page
);
em_tree
=
&
BTRFS_I
(
inode
)
->
extent_tree
;
...
...
fs/btrfs/inode.c
View file @
bcbfce8a
...
...
@@ -80,6 +80,7 @@ int btrfs_check_free_space(struct btrfs_root *root, u64 num_required,
u64
total
=
btrfs_super_total_bytes
(
&
root
->
fs_info
->
super_copy
);
u64
used
=
btrfs_super_bytes_used
(
&
root
->
fs_info
->
super_copy
);
u64
thresh
;
unsigned
long
flags
;
int
ret
=
0
;
if
(
for_del
)
...
...
@@ -89,10 +90,10 @@ int btrfs_check_free_space(struct btrfs_root *root, u64 num_required,
do_div
(
thresh
,
100
);
spin_lock
(
&
root
->
fs_info
->
delalloc_lock
);
spin_lock
_irqsave
(
&
root
->
fs_info
->
delalloc_lock
,
flags
);
if
(
used
+
root
->
fs_info
->
delalloc_bytes
+
num_required
>
thresh
)
ret
=
-
ENOSPC
;
spin_unlock
(
&
root
->
fs_info
->
delalloc_lock
);
spin_unlock
_irqrestore
(
&
root
->
fs_info
->
delalloc_lock
,
flags
);
return
ret
;
}
...
...
@@ -275,12 +276,13 @@ static int run_delalloc_range(struct inode *inode, u64 start, u64 end)
int
btrfs_set_bit_hook
(
struct
inode
*
inode
,
u64
start
,
u64
end
,
unsigned
long
old
,
unsigned
long
bits
)
{
unsigned
long
flags
;
if
(
!
(
old
&
EXTENT_DELALLOC
)
&&
(
bits
&
EXTENT_DELALLOC
))
{
struct
btrfs_root
*
root
=
BTRFS_I
(
inode
)
->
root
;
spin_lock
(
&
root
->
fs_info
->
delalloc_lock
);
spin_lock
_irqsave
(
&
root
->
fs_info
->
delalloc_lock
,
flags
);
BTRFS_I
(
inode
)
->
delalloc_bytes
+=
end
-
start
+
1
;
root
->
fs_info
->
delalloc_bytes
+=
end
-
start
+
1
;
spin_unlock
(
&
root
->
fs_info
->
delalloc_lock
);
spin_unlock
_irqrestore
(
&
root
->
fs_info
->
delalloc_lock
,
flags
);
}
return
0
;
}
...
...
@@ -290,7 +292,9 @@ int btrfs_clear_bit_hook(struct inode *inode, u64 start, u64 end,
{
if
((
old
&
EXTENT_DELALLOC
)
&&
(
bits
&
EXTENT_DELALLOC
))
{
struct
btrfs_root
*
root
=
BTRFS_I
(
inode
)
->
root
;
spin_lock
(
&
root
->
fs_info
->
delalloc_lock
);
unsigned
long
flags
;
spin_lock_irqsave
(
&
root
->
fs_info
->
delalloc_lock
,
flags
);
if
(
end
-
start
+
1
>
root
->
fs_info
->
delalloc_bytes
)
{
printk
(
"warning: delalloc account %Lu %Lu
\n
"
,
end
-
start
+
1
,
root
->
fs_info
->
delalloc_bytes
);
...
...
@@ -300,7 +304,7 @@ int btrfs_clear_bit_hook(struct inode *inode, u64 start, u64 end,
root
->
fs_info
->
delalloc_bytes
-=
end
-
start
+
1
;
BTRFS_I
(
inode
)
->
delalloc_bytes
-=
end
-
start
+
1
;
}
spin_unlock
(
&
root
->
fs_info
->
delalloc_lock
);
spin_unlock
_irqrestore
(
&
root
->
fs_info
->
delalloc_lock
,
flags
);
}
return
0
;
}
...
...
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