|
@@ -1003,7 +1003,7 @@ start_over:
|
|
goto nextsi;
|
|
goto nextsi;
|
|
}
|
|
}
|
|
if (size == SWAPFILE_CLUSTER) {
|
|
if (size == SWAPFILE_CLUSTER) {
|
|
- if (!(si->flags & SWP_FILE))
|
|
|
|
|
|
+ if (!(si->flags & SWP_FS))
|
|
n_ret = swap_alloc_cluster(si, swp_entries);
|
|
n_ret = swap_alloc_cluster(si, swp_entries);
|
|
} else
|
|
} else
|
|
n_ret = scan_swap_map_slots(si, SWAP_HAS_CACHE,
|
|
n_ret = scan_swap_map_slots(si, SWAP_HAS_CACHE,
|
|
@@ -2299,12 +2299,13 @@ static void destroy_swap_extents(struct swap_info_struct *sis)
|
|
kfree(se);
|
|
kfree(se);
|
|
}
|
|
}
|
|
|
|
|
|
- if (sis->flags & SWP_FILE) {
|
|
|
|
|
|
+ if (sis->flags & SWP_ACTIVATED) {
|
|
struct file *swap_file = sis->swap_file;
|
|
struct file *swap_file = sis->swap_file;
|
|
struct address_space *mapping = swap_file->f_mapping;
|
|
struct address_space *mapping = swap_file->f_mapping;
|
|
|
|
|
|
- sis->flags &= ~SWP_FILE;
|
|
|
|
- mapping->a_ops->swap_deactivate(swap_file);
|
|
|
|
|
|
+ sis->flags &= ~SWP_ACTIVATED;
|
|
|
|
+ if (mapping->a_ops->swap_deactivate)
|
|
|
|
+ mapping->a_ops->swap_deactivate(swap_file);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2400,8 +2401,10 @@ static int setup_swap_extents(struct swap_info_struct *sis, sector_t *span)
|
|
|
|
|
|
if (mapping->a_ops->swap_activate) {
|
|
if (mapping->a_ops->swap_activate) {
|
|
ret = mapping->a_ops->swap_activate(sis, swap_file, span);
|
|
ret = mapping->a_ops->swap_activate(sis, swap_file, span);
|
|
|
|
+ if (ret >= 0)
|
|
|
|
+ sis->flags |= SWP_ACTIVATED;
|
|
if (!ret) {
|
|
if (!ret) {
|
|
- sis->flags |= SWP_FILE;
|
|
|
|
|
|
+ sis->flags |= SWP_FS;
|
|
ret = add_swap_extent(sis, 0, sis->max, 0);
|
|
ret = add_swap_extent(sis, 0, sis->max, 0);
|
|
*span = sis->pages;
|
|
*span = sis->pages;
|
|
}
|
|
}
|