[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 12/19] mm: truncate: Expose preparation steps for truncate_in
From: |
Ackerley Tng |
Subject: |
[RFC PATCH 12/19] mm: truncate: Expose preparation steps for truncate_inode_pages_final |
Date: |
Tue, 6 Jun 2023 19:03:57 +0000 |
This will allow preparation steps to be shared
Signed-off-by: Ackerley Tng <ackerleytng@google.com>
---
include/linux/mm.h | 1 +
mm/truncate.c | 24 ++++++++++++++----------
2 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 1f79667824eb..7a8f6b810de0 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -3053,6 +3053,7 @@ extern unsigned long vm_unmapped_area(struct
vm_unmapped_area_info *info);
extern void truncate_inode_pages(struct address_space *, loff_t);
extern void truncate_inode_pages_range(struct address_space *,
loff_t lstart, loff_t lend);
+extern void truncate_inode_pages_final_prepare(struct address_space *mapping);
extern void truncate_inode_pages_final(struct address_space *);
/* generic vm_area_ops exported for stackable file systems */
diff --git a/mm/truncate.c b/mm/truncate.c
index 7b4ea4c4a46b..4a7ae87e03b5 100644
--- a/mm/truncate.c
+++ b/mm/truncate.c
@@ -449,16 +449,7 @@ void truncate_inode_pages(struct address_space *mapping,
loff_t lstart)
}
EXPORT_SYMBOL(truncate_inode_pages);
-/**
- * truncate_inode_pages_final - truncate *all* pages before inode dies
- * @mapping: mapping to truncate
- *
- * Called under (and serialized by) inode->i_rwsem.
- *
- * Filesystems have to use this in the .evict_inode path to inform the
- * VM that this is the final truncate and the inode is going away.
- */
-void truncate_inode_pages_final(struct address_space *mapping)
+void truncate_inode_pages_final_prepare(struct address_space *mapping)
{
/*
* Page reclaim can not participate in regular inode lifetime
@@ -479,7 +470,20 @@ void truncate_inode_pages_final(struct address_space
*mapping)
xa_lock_irq(&mapping->i_pages);
xa_unlock_irq(&mapping->i_pages);
}
+}
+/**
+ * truncate_inode_pages_final - truncate *all* pages before inode dies
+ * @mapping: mapping to truncate
+ *
+ * Called under (and serialized by) inode->i_rwsem.
+ *
+ * Filesystems have to use this in the .evict_inode path to inform the
+ * VM that this is the final truncate and the inode is going away.
+ */
+void truncate_inode_pages_final(struct address_space *mapping)
+{
+ truncate_inode_pages_final_prepare(mapping);
truncate_inode_pages(mapping, 0);
}
EXPORT_SYMBOL(truncate_inode_pages_final);
--
2.41.0.rc0.172.g3f132b7071-goog
- [RFC PATCH 03/19] mm: hugetlb: Expose remove_inode_hugepages, (continued)
- [RFC PATCH 03/19] mm: hugetlb: Expose remove_inode_hugepages, Ackerley Tng, 2023/06/06
- [RFC PATCH 02/19] mm: hugetlb: Move and expose hugetlbfs_zero_partial_page, Ackerley Tng, 2023/06/06
- [RFC PATCH 04/19] mm: hugetlb: Decouple hstate, subpool from inode, Ackerley Tng, 2023/06/06
- [RFC PATCH 05/19] mm: hugetlb: Allow alloc_hugetlb_folio() to be parametrized by subpool and hstate, Ackerley Tng, 2023/06/06
- [RFC PATCH 06/19] mm: hugetlb: Provide hugetlb_filemap_add_folio(), Ackerley Tng, 2023/06/06
- [RFC PATCH 08/19] mm: hugetlb: Refactor restore_reserve_on_error, Ackerley Tng, 2023/06/06
- [RFC PATCH 07/19] mm: hugetlb: Refactor vma_*_reservation functions, Ackerley Tng, 2023/06/06
- [RFC PATCH 09/19] mm: hugetlb: Use restore_reserve_on_error directly in filesystems, Ackerley Tng, 2023/06/06
- [RFC PATCH 10/19] mm: hugetlb: Parametrize alloc_hugetlb_folio_from_subpool() by resv_map, Ackerley Tng, 2023/06/06
- [RFC PATCH 11/19] mm: hugetlb: Parametrize hugetlb functions by resv_map, Ackerley Tng, 2023/06/06
- [RFC PATCH 12/19] mm: truncate: Expose preparation steps for truncate_inode_pages_final,
Ackerley Tng <=
- [RFC PATCH 13/19] KVM: guest_mem: Refactor kvm_gmem fd creation to be in layers, Ackerley Tng, 2023/06/06
- [RFC PATCH 14/19] KVM: guest_mem: Refactor cleanup to separate inode and file cleanup, Ackerley Tng, 2023/06/06
- [RFC PATCH 15/19] KVM: guest_mem: hugetlb: initialization and cleanup, Ackerley Tng, 2023/06/06
- [RFC PATCH 16/19] KVM: guest_mem: hugetlb: allocate and truncate from hugetlb, Ackerley Tng, 2023/06/06
- [RFC PATCH 17/19] KVM: selftests: Add basic selftests for hugetlbfs-backed guest_mem, Ackerley Tng, 2023/06/06
- [RFC PATCH 18/19] KVM: selftests: Support various types of backing sources for private memory, Ackerley Tng, 2023/06/06
- [RFC PATCH 19/19] KVM: selftests: Update test for various private memory backing source types, Ackerley Tng, 2023/06/06
- Re: [RFC PATCH 00/19] hugetlb support for KVM guest_mem, Isaku Yamahata, 2023/06/08
- Re: [RFC PATCH 00/19] hugetlb support for KVM guest_mem, Mike Kravetz, 2023/06/16