[PATCH] shmem: use list_for_each_entry_safe in shmem_unuse

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Simplify the code with list_for_each_entry_safe().

Signed-off-by: Geliang Tang <geliangtang@xxxxxxx>
---
 mm/shmem.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/mm/shmem.c b/mm/shmem.c
index 9b05111..816685f 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -793,8 +793,7 @@ static int shmem_unuse_inode(struct shmem_inode_info *info,
  */
 int shmem_unuse(swp_entry_t swap, struct page *page)
 {
-	struct list_head *this, *next;
-	struct shmem_inode_info *info;
+	struct shmem_inode_info *info, *next;
 	struct mem_cgroup *memcg;
 	int error = 0;
 
@@ -818,8 +817,7 @@ int shmem_unuse(swp_entry_t swap, struct page *page)
 	error = -EAGAIN;
 
 	mutex_lock(&shmem_swaplist_mutex);
-	list_for_each_safe(this, next, &shmem_swaplist) {
-		info = list_entry(this, struct shmem_inode_info, swaplist);
+	list_for_each_entry_safe(info, next, &shmem_swaplist, swaplist) {
 		if (info->swapped)
 			error = shmem_unuse_inode(info, swap, &page);
 		else
-- 
2.5.0


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]