git: ee4211bca600 - main - vm_pager: style some wrappers

Konstantin Belousov kib at FreeBSD.org
Fri May 7 14:08:19 UTC 2021


The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=ee4211bca600af48aab95000f39b4797a74eeb85

commit ee4211bca600af48aab95000f39b4797a74eeb85
Author:     Konstantin Belousov <kib at FreeBSD.org>
AuthorDate: 2021-05-01 00:28:39 +0000
Commit:     Konstantin Belousov <kib at FreeBSD.org>
CommitDate: 2021-05-07 14:08:02 +0000

    vm_pager: style some wrappers
    
    Fill lines with the function definitions.
    Use local var to shorten repeated extra-long expressions.
    
    Reviewed by:    markj
    Tested by:      pho
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D30070
---
 sys/vm/vm_pager.h | 39 ++++++++++++++++++---------------------
 1 file changed, 18 insertions(+), 21 deletions(-)

diff --git a/sys/vm/vm_pager.h b/sys/vm/vm_pager.h
index 45a5a5654806..2dfe374b9d4a 100644
--- a/sys/vm/vm_pager.h
+++ b/sys/vm/vm_pager.h
@@ -129,13 +129,9 @@ void vm_pager_init(void);
 vm_object_t vm_pager_object_lookup(struct pagerlst *, void *);
 
 static __inline void
-vm_pager_put_pages(
-	vm_object_t object,
-	vm_page_t *m,
-	int count,
-	int flags,
-	int *rtvals
-) {
+vm_pager_put_pages(vm_object_t object, vm_page_t *m, int count, int flags,
+    int *rtvals)
+{
 	VM_OBJECT_ASSERT_WLOCKED(object);
 	(*pagertab[object->type]->pgo_putpages)
 	    (object, m, count, flags, rtvals);
@@ -152,12 +148,9 @@ vm_pager_put_pages(
  *	The object must be locked.
  */
 static __inline boolean_t
-vm_pager_has_page(
-	vm_object_t object,
-	vm_pindex_t offset, 
-	int *before,
-	int *after
-) {
+vm_pager_has_page(vm_object_t object, vm_pindex_t offset, int *before,
+    int *after)
+{
 	boolean_t ret;
 
 	VM_OBJECT_ASSERT_LOCKED(object);
@@ -191,29 +184,33 @@ vm_pager_populate(vm_object_t object, vm_pindex_t pidx, int fault_type,
 static __inline void
 vm_pager_page_unswapped(vm_page_t m)
 {
+	pgo_pageunswapped_t *method;
 
-	if (pagertab[m->object->type]->pgo_pageunswapped)
-		(*pagertab[m->object->type]->pgo_pageunswapped)(m);
+	method = pagertab[m->object->type]->pgo_pageunswapped;
+	if (method != NULL)
+		method(m);
 }
 
 static __inline void
 vm_pager_update_writecount(vm_object_t object, vm_offset_t start,
     vm_offset_t end)
 {
+	pgo_writecount_t *method;
 
-	if (pagertab[object->type]->pgo_update_writecount)
-		pagertab[object->type]->pgo_update_writecount(object, start,
-		    end);
+	method = pagertab[object->type]->pgo_update_writecount;
+	if (method != NULL)
+		method(object, start, end);
 }
 
 static __inline void
 vm_pager_release_writecount(vm_object_t object, vm_offset_t start,
     vm_offset_t end)
 {
+	pgo_writecount_t *method;
 
-	if (pagertab[object->type]->pgo_release_writecount)
-		pagertab[object->type]->pgo_release_writecount(object, start,
-		    end);
+	method = pagertab[object->type]->pgo_release_writecount;
+	if (method != NULL)
+		method(object, start, end);
 }
 
 struct cdev_pager_ops {


More information about the dev-commits-src-main mailing list