]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/vm/vm_swapfile_pager.c
xnu-7195.50.7.100.1.tar.gz
[apple/xnu.git] / osfmk / vm / vm_swapfile_pager.c
index 8ebc2d3e1e1dc24d4b34ad677a86c7beaedada98..39526d9b6d2a68eb25fe315d4161c7c4cb38de07 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Apple Inc. All rights reserved.
+ * Copyright (c) 2008-2020 Apple Inc. All rights reserved.
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  *
@@ -152,20 +152,15 @@ typedef struct swapfile_pager {
  * The list is protected by the "swapfile_pager_lock" lock.
  */
 int swapfile_pager_count = 0;           /* number of pagers */
-queue_head_t swapfile_pager_queue;
-decl_lck_mtx_data(, swapfile_pager_lock);
+queue_head_t swapfile_pager_queue = QUEUE_HEAD_INITIALIZER(swapfile_pager_queue);
+LCK_GRP_DECLARE(swapfile_pager_lck_grp, "swapfile pager");
+LCK_MTX_DECLARE(swapfile_pager_lock, &swapfile_pager_lck_grp);
 
 /*
  * Statistics & counters.
  */
 int swapfile_pager_count_max = 0;
 
-
-lck_grp_t               swapfile_pager_lck_grp;
-lck_grp_attr_t          swapfile_pager_lck_grp_attr;
-lck_attr_t              swapfile_pager_lck_attr;
-
-
 /* internal prototypes */
 swapfile_pager_t swapfile_pager_create(struct vnode *vp);
 swapfile_pager_t swapfile_pager_lookup(memory_object_t mem_obj);
@@ -192,16 +187,6 @@ int swapfile_pagerdebug = 0;
 #endif
 
 
-void
-swapfile_pager_bootstrap(void)
-{
-       lck_grp_attr_setdefault(&swapfile_pager_lck_grp_attr);
-       lck_grp_init(&swapfile_pager_lck_grp, "swapfile pager", &swapfile_pager_lck_grp_attr);
-       lck_attr_setdefault(&swapfile_pager_lck_attr);
-       lck_mtx_init(&swapfile_pager_lock, &swapfile_pager_lck_grp, &swapfile_pager_lck_attr);
-       queue_init(&swapfile_pager_queue);
-}
-
 /*
  * swapfile_pager_init()
  *
@@ -454,7 +439,10 @@ done:
                        upl_abort(upl, 0);
                } else {
                        boolean_t empty;
-                       upl_commit_range(upl, 0, upl->size,
+                       assertf(page_aligned(upl->u_offset) && page_aligned(upl->u_size),
+                           "upl %p offset 0x%llx size 0x%x",
+                           upl, upl->u_offset, upl->u_size);
+                       upl_commit_range(upl, 0, upl->u_size,
                            UPL_COMMIT_CS_VALIDATED,
                            upl_pl, pl_count, &empty);
                }