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
069eac78
Commit
069eac78
authored
Feb 14, 2017
by
David Sterba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
btrfs: use predefined limits for calculating maximum number of pages for compression
Signed-off-by:
David Sterba
<
dsterba@suse.com
>
parent
ff763866
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
fs/btrfs/inode.c
fs/btrfs/inode.c
+6
-5
No files found.
fs/btrfs/inode.c
View file @
069eac78
...
@@ -432,8 +432,6 @@ static noinline void compress_file_range(struct inode *inode,
...
@@ -432,8 +432,6 @@ static noinline void compress_file_range(struct inode *inode,
unsigned
long
nr_pages
;
unsigned
long
nr_pages
;
unsigned
long
total_compressed
=
0
;
unsigned
long
total_compressed
=
0
;
unsigned
long
total_in
=
0
;
unsigned
long
total_in
=
0
;
unsigned
long
max_compressed
=
SZ_128K
;
unsigned
long
max_uncompressed
=
SZ_128K
;
int
i
;
int
i
;
int
will_compress
;
int
will_compress
;
int
compress_type
=
fs_info
->
compress_type
;
int
compress_type
=
fs_info
->
compress_type
;
...
@@ -446,7 +444,9 @@ static noinline void compress_file_range(struct inode *inode,
...
@@ -446,7 +444,9 @@ static noinline void compress_file_range(struct inode *inode,
again:
again:
will_compress
=
0
;
will_compress
=
0
;
nr_pages
=
(
end
>>
PAGE_SHIFT
)
-
(
start
>>
PAGE_SHIFT
)
+
1
;
nr_pages
=
(
end
>>
PAGE_SHIFT
)
-
(
start
>>
PAGE_SHIFT
)
+
1
;
nr_pages
=
min_t
(
unsigned
long
,
nr_pages
,
SZ_128K
/
PAGE_SIZE
);
BUILD_BUG_ON
((
BTRFS_MAX_COMPRESSED
%
PAGE_SIZE
)
!=
0
);
nr_pages
=
min_t
(
unsigned
long
,
nr_pages
,
BTRFS_MAX_COMPRESSED
/
PAGE_SIZE
);
/*
/*
* we don't want to send crud past the end of i_size through
* we don't want to send crud past the end of i_size through
...
@@ -471,7 +471,8 @@ static noinline void compress_file_range(struct inode *inode,
...
@@ -471,7 +471,8 @@ static noinline void compress_file_range(struct inode *inode,
(
start
>
0
||
end
+
1
<
BTRFS_I
(
inode
)
->
disk_i_size
))
(
start
>
0
||
end
+
1
<
BTRFS_I
(
inode
)
->
disk_i_size
))
goto
cleanup_and_bail_uncompressed
;
goto
cleanup_and_bail_uncompressed
;
total_compressed
=
min
(
total_compressed
,
max_uncompressed
);
total_compressed
=
min_t
(
unsigned
long
,
total_compressed
,
BTRFS_MAX_UNCOMPRESSED
);
num_bytes
=
ALIGN
(
end
-
start
+
1
,
blocksize
);
num_bytes
=
ALIGN
(
end
-
start
+
1
,
blocksize
);
num_bytes
=
max
(
blocksize
,
num_bytes
);
num_bytes
=
max
(
blocksize
,
num_bytes
);
total_in
=
0
;
total_in
=
0
;
...
@@ -510,7 +511,7 @@ static noinline void compress_file_range(struct inode *inode,
...
@@ -510,7 +511,7 @@ static noinline void compress_file_range(struct inode *inode,
&
nr_pages
,
&
nr_pages
,
&
total_in
,
&
total_in
,
&
total_compressed
,
&
total_compressed
,
max_compressed
);
BTRFS_MAX_COMPRESSED
);
if
(
!
ret
)
{
if
(
!
ret
)
{
unsigned
long
offset
=
total_compressed
&
unsigned
long
offset
=
total_compressed
&
...
...
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