@@ -1520,11 +1520,13 @@ static struct page *shmem_swapin(swp_entry_t swap, gfp_t gfp,
{
struct vm_area_struct pvma;
struct page *page;
- struct vm_fault vmf;
+ struct vm_fault vmf = {
+ .info = {
+ .vma = &pvma,
+ },
+ };
shmem_pseudo_vma_init(&pvma, info, index);
- vmf.info.vma = &pvma;
- vmf.info.address = 0;
page = swap_cluster_readahead(swap, gfp, &vmf);
shmem_pseudo_vma_destroy(&pvma);
@@ -1951,8 +1951,6 @@ static int unuse_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
si = swap_info[type];
pte = pte_offset_map(pmd, addr);
do {
- struct vm_fault vmf;
-
if (!is_swap_pte(*pte))
continue;
@@ -1968,9 +1966,14 @@ static int unuse_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
swap_map = &si->swap_map[offset];
page = lookup_swap_cache(entry, vma, addr);
if (!page) {
- vmf.info.vma = vma;
- vmf.info.address = addr;
- vmf.pmd = pmd;
+ struct vm_fault vmf = {
+ .info = {
+ .vma = vma,
+ .address = addr,
+ },
+ .pmd = pmd,
+ };
+
page = swapin_readahead(entry, GFP_HIGHUSER_MOVABLE,
&vmf);
}
In preparation for const-ifying the 'info' field of 'struct vm_fault', ensure that it is initialised using static initialisers. Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Will Deacon <will@kernel.org> --- mm/shmem.c | 8 +++++--- mm/swapfile.c | 13 ++++++++----- 2 files changed, 13 insertions(+), 8 deletions(-)