mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-28 21:33:52 +00:00
mm/swapfile.c: use list_{next,first}_entry
To make the intention clearer, use list_{next,first}_entry instead of list_entry(). Signed-off-by: Geliang Tang <geliangtang@163.com> Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> Cc: Jerome Marchand <jmarchan@redhat.com> Cc: Vlastimil Babka <vbabka@suse.cz> Cc: Hugh Dickins <hughd@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
8c9c1701c7
commit
a8ae499170
1 changed files with 4 additions and 10 deletions
|
@ -165,8 +165,6 @@ static void discard_swap_cluster(struct swap_info_struct *si,
|
||||||
int found_extent = 0;
|
int found_extent = 0;
|
||||||
|
|
||||||
while (nr_pages) {
|
while (nr_pages) {
|
||||||
struct list_head *lh;
|
|
||||||
|
|
||||||
if (se->start_page <= start_page &&
|
if (se->start_page <= start_page &&
|
||||||
start_page < se->start_page + se->nr_pages) {
|
start_page < se->start_page + se->nr_pages) {
|
||||||
pgoff_t offset = start_page - se->start_page;
|
pgoff_t offset = start_page - se->start_page;
|
||||||
|
@ -188,8 +186,7 @@ static void discard_swap_cluster(struct swap_info_struct *si,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
lh = se->list.next;
|
se = list_next_entry(se, list);
|
||||||
se = list_entry(lh, struct swap_extent, list);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -903,7 +900,7 @@ int swp_swapcount(swp_entry_t entry)
|
||||||
VM_BUG_ON(page_private(page) != SWP_CONTINUED);
|
VM_BUG_ON(page_private(page) != SWP_CONTINUED);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
page = list_entry(page->lru.next, struct page, lru);
|
page = list_next_entry(page, lru);
|
||||||
map = kmap_atomic(page);
|
map = kmap_atomic(page);
|
||||||
tmp_count = map[offset];
|
tmp_count = map[offset];
|
||||||
kunmap_atomic(map);
|
kunmap_atomic(map);
|
||||||
|
@ -1633,14 +1630,11 @@ static sector_t map_swap_entry(swp_entry_t entry, struct block_device **bdev)
|
||||||
se = start_se;
|
se = start_se;
|
||||||
|
|
||||||
for ( ; ; ) {
|
for ( ; ; ) {
|
||||||
struct list_head *lh;
|
|
||||||
|
|
||||||
if (se->start_page <= offset &&
|
if (se->start_page <= offset &&
|
||||||
offset < (se->start_page + se->nr_pages)) {
|
offset < (se->start_page + se->nr_pages)) {
|
||||||
return se->start_block + (offset - se->start_page);
|
return se->start_block + (offset - se->start_page);
|
||||||
}
|
}
|
||||||
lh = se->list.next;
|
se = list_next_entry(se, list);
|
||||||
se = list_entry(lh, struct swap_extent, list);
|
|
||||||
sis->curr_swap_extent = se;
|
sis->curr_swap_extent = se;
|
||||||
BUG_ON(se == start_se); /* It *must* be present */
|
BUG_ON(se == start_se); /* It *must* be present */
|
||||||
}
|
}
|
||||||
|
@ -1664,7 +1658,7 @@ static void destroy_swap_extents(struct swap_info_struct *sis)
|
||||||
while (!list_empty(&sis->first_swap_extent.list)) {
|
while (!list_empty(&sis->first_swap_extent.list)) {
|
||||||
struct swap_extent *se;
|
struct swap_extent *se;
|
||||||
|
|
||||||
se = list_entry(sis->first_swap_extent.list.next,
|
se = list_first_entry(&sis->first_swap_extent.list,
|
||||||
struct swap_extent, list);
|
struct swap_extent, list);
|
||||||
list_del(&se->list);
|
list_del(&se->list);
|
||||||
kfree(se);
|
kfree(se);
|
||||||
|
|
Loading…
Reference in a new issue