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
1e2ef46d
Commit
1e2ef46d
authored
Jul 17, 2017
by
David Sterba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
btrfs: defrag: cleanup checking for compression status
Signed-off-by:
David Sterba
<
dsterba@suse.com
>
parent
eec63c65
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
fs/btrfs/ioctl.c
fs/btrfs/ioctl.c
+6
-6
No files found.
fs/btrfs/ioctl.c
View file @
1e2ef46d
...
@@ -1255,6 +1255,7 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
...
@@ -1255,6 +1255,7 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
unsigned
long
cluster
=
max_cluster
;
unsigned
long
cluster
=
max_cluster
;
u64
new_align
=
~
((
u64
)
SZ_128K
-
1
);
u64
new_align
=
~
((
u64
)
SZ_128K
-
1
);
struct
page
**
pages
=
NULL
;
struct
page
**
pages
=
NULL
;
bool
do_compress
=
range
->
flags
&
BTRFS_DEFRAG_RANGE_COMPRESS
;
if
(
isize
==
0
)
if
(
isize
==
0
)
return
0
;
return
0
;
...
@@ -1262,7 +1263,7 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
...
@@ -1262,7 +1263,7 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
if
(
range
->
start
>=
isize
)
if
(
range
->
start
>=
isize
)
return
-
EINVAL
;
return
-
EINVAL
;
if
(
range
->
flags
&
BTRFS_DEFRAG_RANGE_COMPRESS
)
{
if
(
do_compress
)
{
if
(
range
->
compress_type
>
BTRFS_COMPRESS_TYPES
)
if
(
range
->
compress_type
>
BTRFS_COMPRESS_TYPES
)
return
-
EINVAL
;
return
-
EINVAL
;
if
(
range
->
compress_type
)
if
(
range
->
compress_type
)
...
@@ -1341,8 +1342,7 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
...
@@ -1341,8 +1342,7 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
if
(
!
should_defrag_range
(
inode
,
(
u64
)
i
<<
PAGE_SHIFT
,
if
(
!
should_defrag_range
(
inode
,
(
u64
)
i
<<
PAGE_SHIFT
,
extent_thresh
,
&
last_len
,
&
skip
,
extent_thresh
,
&
last_len
,
&
skip
,
&
defrag_end
,
range
->
flags
&
&
defrag_end
,
do_compress
)){
BTRFS_DEFRAG_RANGE_COMPRESS
))
{
unsigned
long
next
;
unsigned
long
next
;
/*
/*
* the should_defrag function tells us how much to skip
* the should_defrag function tells us how much to skip
...
@@ -1370,7 +1370,7 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
...
@@ -1370,7 +1370,7 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
}
}
inode_lock
(
inode
);
inode_lock
(
inode
);
if
(
range
->
flags
&
BTRFS_DEFRAG_RANGE_COMPRESS
)
if
(
do_compress
)
BTRFS_I
(
inode
)
->
defrag_compress
=
compress_type
;
BTRFS_I
(
inode
)
->
defrag_compress
=
compress_type
;
ret
=
cluster_pages_for_defrag
(
inode
,
pages
,
i
,
cluster
);
ret
=
cluster_pages_for_defrag
(
inode
,
pages
,
i
,
cluster
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
...
@@ -1418,7 +1418,7 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
...
@@ -1418,7 +1418,7 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
filemap_flush
(
inode
->
i_mapping
);
filemap_flush
(
inode
->
i_mapping
);
}
}
if
(
(
range
->
flags
&
BTRFS_DEFRAG_RANGE_COMPRESS
)
)
{
if
(
do_compress
)
{
/* the filemap_flush will queue IO into the worker threads, but
/* the filemap_flush will queue IO into the worker threads, but
* we have to make sure the IO is actually started and that
* we have to make sure the IO is actually started and that
* ordered extents get created before we return
* ordered extents get created before we return
...
@@ -1440,7 +1440,7 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
...
@@ -1440,7 +1440,7 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
ret
=
defrag_count
;
ret
=
defrag_count
;
out_ra:
out_ra:
if
(
range
->
flags
&
BTRFS_DEFRAG_RANGE_COMPRESS
)
{
if
(
do_compress
)
{
inode_lock
(
inode
);
inode_lock
(
inode
);
BTRFS_I
(
inode
)
->
defrag_compress
=
BTRFS_COMPRESS_NONE
;
BTRFS_I
(
inode
)
->
defrag_compress
=
BTRFS_COMPRESS_NONE
;
inode_unlock
(
inode
);
inode_unlock
(
inode
);
...
...
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