Skip to content

Instantly share code, notes, and snippets.

@coypoop
Last active May 6, 2016 17:05
Show Gist options
  • Save coypoop/b59d967f6edc04cfbe658c01ffa78047 to your computer and use it in GitHub Desktop.
Save coypoop/b59d967f6edc04cfbe658c01ffa78047 to your computer and use it in GitHub Desktop.
From d86d504a5b1eb6c1443f6161ba44d0fbd8bc90a1 Mon Sep 17 00:00:00 2001
From: coypu <coypu@sdf.org>
Date: Fri, 6 May 2016 19:06:43 +0300
Subject: [PATCH 1/2] Rename out2 to abort, more legible.
---
sys/kern/vfs_wapbl.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/sys/kern/vfs_wapbl.c b/sys/kern/vfs_wapbl.c
index 2c9707f..11fb76c 100644
--- a/sys/kern/vfs_wapbl.c
+++ b/sys/kern/vfs_wapbl.c
@@ -1504,20 +1504,20 @@ wapbl_flush(struct wapbl *wl, int waitfor)
error = wapbl_truncate(wl, flushsize, 0);
if (error)
- goto out2;
+ goto abort;
off = wl->wl_head;
KASSERT((off == 0) || ((off >= wl->wl_circ_off) &&
(off < wl->wl_circ_off + wl->wl_circ_size)));
error = wapbl_write_blocks(wl, &off);
if (error)
- goto out2;
+ goto abort;
error = wapbl_write_revocations(wl, &off);
if (error)
- goto out2;
+ goto abort;
error = wapbl_write_inodes(wl, &off);
if (error)
- goto out2;
+ goto abort;
reserved = 0;
if (wl->wl_inohashcnt)
@@ -1550,7 +1550,7 @@ wapbl_flush(struct wapbl *wl, int waitfor)
error = wapbl_write_commit(wl, head, tail);
if (error)
- goto out2;
+ goto abort;
we = pool_get(&wapbl_entry_pool, PR_WAITOK);
@@ -1639,7 +1639,7 @@ wapbl_flush(struct wapbl *wl, int waitfor)
wl->wl_reserved_bytes, wapbl_lazy_truncate);
}
- out2:
+ abort:
if (error) {
wl->wl_flush_abort(wl->wl_mount, wl->wl_deallocblks,
wl->wl_dealloclens, wl->wl_dealloccnt);
--
2.8.1
From 04df6e7c5b2328c318e4e8703c2fd96d8a87ece9 Mon Sep 17 00:00:00 2001
From: coypu <coypu@sdf.org>
Date: Fri, 6 May 2016 19:07:17 +0300
Subject: [PATCH 2/2] No need to test if error is true, it already always is.
---
sys/kern/vfs_wapbl.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/sys/kern/vfs_wapbl.c b/sys/kern/vfs_wapbl.c
index 11fb76c..4fe2616 100644
--- a/sys/kern/vfs_wapbl.c
+++ b/sys/kern/vfs_wapbl.c
@@ -1640,10 +1640,8 @@ wapbl_flush(struct wapbl *wl, int waitfor)
}
abort:
- if (error) {
- wl->wl_flush_abort(wl->wl_mount, wl->wl_deallocblks,
- wl->wl_dealloclens, wl->wl_dealloccnt);
- }
+ wl->wl_flush_abort(wl->wl_mount, wl->wl_deallocblks,
+ wl->wl_dealloclens, wl->wl_dealloccnt);
#ifdef WAPBL_DEBUG_PRINT
if (error) {
--
2.8.1
From c23ed9f6b1bbe0d7be4d78eb050c92d864a90b04 Mon Sep 17 00:00:00 2001
From: coypu <coypu@sdf.org>
Date: Fri, 6 May 2016 19:30:01 +0300
Subject: [PATCH 1/1] Explain what is happening better
---
sys/kern/vfs_wapbl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sys/kern/vfs_wapbl.c b/sys/kern/vfs_wapbl.c
index 4fe2616..1981f8a 100644
--- a/sys/kern/vfs_wapbl.c
+++ b/sys/kern/vfs_wapbl.c
@@ -1469,7 +1469,7 @@ wapbl_flush(struct wapbl *wl, int waitfor)
/*
* Now that we are fully locked and flushed,
- * do another check for nothing to do.
+ * do another check for nothing to flush,
+ * and truncate everything.
*/
if (wl->wl_bufcount == 0) {
goto out;
--
2.8.1
@coypoop
Copy link
Author

coypoop commented May 6, 2016

So far yes on first patch, no on second (it can be reached without goto abort!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment