Commit cd0f3715 authored by Guoqing Jiang's avatar Guoqing Jiang Committed by Linus Torvalds

mm/migrate.c: call detach_page_private to cleanup code

We can cleanup code a little by call detach_page_private here.

[akpm@linux-foundation.org: use attach_page_private(), per Dave]
  http://lkml.kernel.org/r/20200521225220.GV2005@dread.disaster.area
[akpm@linux-foundation.org: clear PagePrivate]
Signed-off-by: default avatarGuoqing Jiang <guoqing.jiang@cloud.ionos.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Cc: Chao Yu <yuchao0@huawei.com>
Cc: Cong Wang <xiyou.wangcong@gmail.com>
Cc: Dave Chinner <dchinner@redhat.com>
Cc: Eric Biggers <ebiggers@google.com>
Cc: Gao Xiang <gaoxiang25@huawei.com>
Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Zi Yan <ziy@nvidia.com>
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Cc: Miklos Szeredi <mszeredi@redhat.com>
Link: http://lkml.kernel.org/r/20200519214049.15179-1-guoqing.jiang@cloud.ionos.comSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 7b59435a
...@@ -797,10 +797,7 @@ static int __buffer_migrate_page(struct address_space *mapping, ...@@ -797,10 +797,7 @@ static int __buffer_migrate_page(struct address_space *mapping,
if (rc != MIGRATEPAGE_SUCCESS) if (rc != MIGRATEPAGE_SUCCESS)
goto unlock_buffers; goto unlock_buffers;
ClearPagePrivate(page); attach_page_private(newpage, detach_page_private(page));
set_page_private(newpage, page_private(page));
set_page_private(page, 0);
put_page(page);
get_page(newpage); get_page(newpage);
bh = head; bh = head;
...@@ -810,8 +807,6 @@ static int __buffer_migrate_page(struct address_space *mapping, ...@@ -810,8 +807,6 @@ static int __buffer_migrate_page(struct address_space *mapping,
} while (bh != head); } while (bh != head);
SetPagePrivate(newpage);
if (mode != MIGRATE_SYNC_NO_COPY) if (mode != MIGRATE_SYNC_NO_COPY)
migrate_page_copy(newpage, page); migrate_page_copy(newpage, page);
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment