]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
exfat: add swap_activate support
authorJan Polensky <japo@linux.ibm.com>
Tue, 9 Jun 2026 09:21:49 +0000 (18:21 +0900)
committerNamjae Jeon <linkinjeon@kernel.org>
Mon, 15 Jun 2026 11:01:00 +0000 (20:01 +0900)
Commit 07d67f3e9083 ("exfat: add iomap buffered I/O support")
converted exfat buffered I/O to iomap, but did not add a
.swap_activate handler to the address_space_operations.

swapon(2) on an exfat swapfile then fails with EINVAL, which causes
LTP swap tests to fail.

Add exfat_iomap_swap_activate() and hook it into exfat_aops so exfat
uses iomap_swapfile_activate() for swapfile activation.

Fixes: 614f71ca1bdf ("exfat: add iomap buffered I/O support")
Closes: https://lore.kernel.org/all/20260603110212.3020276-1-japo@linux.ibm.com/
Signed-off-by: Jan Polensky <japo@linux.ibm.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
fs/exfat/inode.c
fs/exfat/iomap.c
fs/exfat/iomap.h

index 8e8d94319c3c2a0bb68514c0d0a311233e6df6ea..89826aea5e1e391ea99699a55bbbfdea9bd63cd9 100644 (file)
@@ -309,6 +309,7 @@ static const struct address_space_operations exfat_aops = {
        .error_remove_folio     = generic_error_remove_folio,
        .release_folio          = iomap_release_folio,
        .invalidate_folio       = iomap_invalidate_folio,
+       .swap_activate          = exfat_iomap_swap_activate,
 };
 
 static inline unsigned long exfat_hash(loff_t i_pos)
index 3ac1eebe997f531ec952616946c0768b8c1cf8c7..1aac38e63fe6f0b4b45e9f681eba5a16d6ee1365 100644 (file)
@@ -263,3 +263,9 @@ const struct iomap_read_ops exfat_iomap_bio_read_ops = {
        .read_folio_range       = iomap_bio_read_folio_range,
        .submit_read            = exfat_iomap_bio_submit_read,
 };
+
+int exfat_iomap_swap_activate(struct swap_info_struct *sis,
+                              struct file *file, sector_t *span)
+{
+       return iomap_swapfile_activate(sis, file, span, &exfat_iomap_ops);
+}
index 830388f386f4efdf591956c10a55b0c4ed83319f..fd8a913f779460b14c50c53db9029f17b324a748 100644 (file)
@@ -12,4 +12,7 @@ extern const struct iomap_ops exfat_write_iomap_ops;
 extern const struct iomap_writeback_ops exfat_writeback_ops;
 extern const struct iomap_read_ops exfat_iomap_bio_read_ops;
 
+int exfat_iomap_swap_activate(struct swap_info_struct *sis,
+                              struct file *file, sector_t *span);
+
 #endif /* _LINUX_EXFAT_IOMAP_H */