// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2018 Oracle. All Rights Reserved. * Author: Darrick J. Wong <[email protected]> */ #include <linux/module.h> #include <linux/compiler.h> #include <linux/fs.h> #include <linux/iomap.h> #include <linux/swap.h> /* Swapfile activation */ struct iomap_swapfile_info { … }; /* * Collect physical extents for this swap file. Physical extents reported to * the swap code must be trimmed to align to a page boundary. The logical * offset within the file is irrelevant since the swapfile code maps logical * page numbers of the swap device to the physical page-aligned extents. */ static int iomap_swapfile_add_extent(struct iomap_swapfile_info *isi) { … } static int iomap_swapfile_fail(struct iomap_swapfile_info *isi, const char *str) { … } /* * Accumulate iomaps for this swap file. We have to accumulate iomaps because * swap only cares about contiguous page-aligned physical extents and makes no * distinction between written and unwritten extents. */ static loff_t iomap_swapfile_iter(const struct iomap_iter *iter, struct iomap *iomap, struct iomap_swapfile_info *isi) { … } /* * Iterate a swap file's iomaps to construct physical extents that can be * passed to the swapfile subsystem. */ int iomap_swapfile_activate(struct swap_info_struct *sis, struct file *swap_file, sector_t *pagespan, const struct iomap_ops *ops) { … } EXPORT_SYMBOL_GPL(…);