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
7379e302
Commit
7379e302
authored
May 22, 2004
by
Andrew Morton
Committed by
Linus Torvalds
May 22, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] __add_to_swap_cache and add_to_pagecache() simplification
Simplify the logic in there a bit.
parent
b6c418dc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
6 deletions
+3
-6
mm/filemap.c
mm/filemap.c
+1
-3
mm/swap_state.c
mm/swap_state.c
+2
-3
No files found.
mm/filemap.c
View file @
7379e302
...
...
@@ -252,17 +252,15 @@ int add_to_page_cache(struct page *page, struct address_space *mapping,
int
error
=
radix_tree_preload
(
gfp_mask
&
~
__GFP_HIGHMEM
);
if
(
error
==
0
)
{
page_cache_get
(
page
);
spin_lock_irq
(
&
mapping
->
tree_lock
);
error
=
radix_tree_insert
(
&
mapping
->
page_tree
,
offset
,
page
);
if
(
!
error
)
{
page_cache_get
(
page
);
SetPageLocked
(
page
);
page
->
mapping
=
mapping
;
page
->
index
=
offset
;
mapping
->
nrpages
++
;
pagecache_acct
(
1
);
}
else
{
page_cache_release
(
page
);
}
spin_unlock_irq
(
&
mapping
->
tree_lock
);
radix_tree_preload_end
();
...
...
mm/swap_state.c
View file @
7379e302
...
...
@@ -68,18 +68,17 @@ static int __add_to_swap_cache(struct page *page,
BUG_ON
(
PagePrivate
(
page
));
error
=
radix_tree_preload
(
gfp_mask
);
if
(
!
error
)
{
page_cache_get
(
page
);
spin_lock_irq
(
&
swapper_space
.
tree_lock
);
error
=
radix_tree_insert
(
&
swapper_space
.
page_tree
,
entry
.
val
,
page
);
if
(
!
error
)
{
page_cache_get
(
page
);
SetPageLocked
(
page
);
SetPageSwapCache
(
page
);
page
->
private
=
entry
.
val
;
total_swapcache_pages
++
;
pagecache_acct
(
1
);
}
else
page_cache_release
(
page
);
}
spin_unlock_irq
(
&
swapper_space
.
tree_lock
);
radix_tree_preload_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