]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
coredump: Convert to vma iterator
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Wed, 9 Nov 2022 19:29:59 +0000 (14:29 -0500)
committerLiam Howlett <Liam.Howlett@oracle.com>
Mon, 14 Nov 2022 19:57:06 +0000 (14:57 -0500)
Use the vma iterator so that the iterator can be invalidated or updated
to avoid each caller doing so.

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
fs/coredump.c

index 7bad7785e8e675ac92d5ba6f55bec90658e4ca51..bb1afce78f45312400feb880c6bca5fcefce5a51 100644 (file)
@@ -1104,14 +1104,14 @@ whole:
  * Helper function for iterating across a vma list.  It ensures that the caller
  * will visit `gate_vma' prior to terminating the search.
  */
-static struct vm_area_struct *coredump_next_vma(struct ma_state *mas,
+static struct vm_area_struct *coredump_next_vma(struct vma_iterator *vmi,
                                       struct vm_area_struct *vma,
                                       struct vm_area_struct *gate_vma)
 {
        if (gate_vma && (vma == gate_vma))
                return NULL;
 
-       vma = mas_next(mas, ULONG_MAX);
+       vma = vma_next(vmi);
        if (vma)
                return vma;
        return gate_vma;
@@ -1139,7 +1139,7 @@ static bool dump_vma_snapshot(struct coredump_params *cprm)
 {
        struct vm_area_struct *gate_vma, *vma = NULL;
        struct mm_struct *mm = current->mm;
-       MA_STATE(mas, &mm->mm_mt, 0, 0);
+       VMA_ITERATOR(vmi, mm, 0);
        int i = 0;
 
        /*
@@ -1160,7 +1160,7 @@ static bool dump_vma_snapshot(struct coredump_params *cprm)
                return false;
        }
 
-       while ((vma = coredump_next_vma(&mas, vma, gate_vma)) != NULL) {
+       while ((vma = coredump_next_vma(&vmi, vma, gate_vma)) != NULL) {
                struct core_vma_metadata *m = cprm->vma_meta + i;
 
                m->start = vma->vm_start;