[Cluster-devel] [PATCH v3 20/20] gfs2: Per-revoke accounting in transactions

2021-01-27 Thread Andreas Gruenbacher
In the log, revokes are stored as a revoke descriptor (struct gfs2_log_descriptor), followed by zero or more additional revoke blocks (struct gfs2_meta_header). On filesystems with a blocksize of 4k, the revoke descriptor contains up to 503 revokes, and the metadata blocks contain up to 509

[Cluster-devel] [PATCH v3 19/20] gfs2: Rework the log space allocation logic

2021-01-27 Thread Andreas Gruenbacher
The current log space allocation logic is hard to understand or extend. The principle it that when the log is flushed, we may or may not have a transaction active that has space allocated in the log. To deal with that, we set aside a magical number of blocks to be used in case we don't have an

[Cluster-devel] [PATCH v3 11/20] gfs2: Don't wait for journal flush in clean_journal

2021-01-27 Thread Andreas Gruenbacher
Commit 588bff95c94e added gfs2_write_log_header() and started using it in clean_journal(), with an additional call to log_flush_wait() at the end of gfs2_write_log_header() which is unnecessary for clean_journal(). Move that call out of gfs2_write_log_header() to restore the previous behavior.

[Cluster-devel] [PATCH v3 18/20] gfs2: Remove sd_log_blks_reserved

2021-01-27 Thread Andreas Gruenbacher
Now that sdp->sd_log_tr is defined even when the transaction only indicates revokes, tr_reserved is equivalent to sd_log_blks_reserved, so we can remove it. Signed-off-by: Andreas Gruenbacher --- fs/gfs2/incore.h | 1 - fs/gfs2/log.c| 21 ++--- fs/gfs2/log.h| 2 +-

[Cluster-devel] [PATCH v3 14/20] gfs2: Get rid of current_tail()

2021-01-27 Thread Andreas Gruenbacher
Keep the current value of the updated log tail in the super block as sb_log_flush_tail instead of computing it on the fly. This avoids unnecessary sd_ail_lock taking and cleans up the code. Signed-off-by: Andreas Gruenbacher --- fs/gfs2/incore.h | 5 ++-- fs/gfs2/log.c| 72

[Cluster-devel] [PATCH v3 17/20] gfs2: Remove sd_log_committed_revoke

2021-01-27 Thread Andreas Gruenbacher
In gfs2_trans_end -> gfs2_log_commit -> gfs2_log_refund, if we don't have a system transaction, always attach the new transaction even if it only accounts for revokes. That way, tr_num_revoke - tr_num_revoke_rm in the system transaction (sdp->sd_log_tr) will be the number of revokes committed so

[Cluster-devel] [PATCH v3 12/20] gfs2: Clean up gfs2_log_reserve

2021-01-27 Thread Andreas Gruenbacher
Wake up log waiters in gfs2_log_release when log space has actually become available. This is a much better place for the wakeup than gfs2_logd. Check if enough log space is immeditely available before anything else. If there isn't, use io_wait_event to wait instead of open-coding it.

[Cluster-devel] [PATCH v3 15/20] gfs2: Move function gfs2_ail_empty_tr

2021-01-27 Thread Andreas Gruenbacher
Move this function further up in log.c so that we can use it in the next patch. Signed-off-by: Andreas Gruenbacher --- fs/gfs2/log.c | 34 +- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c index

[Cluster-devel] [PATCH v3 13/20] gfs2: Use a tighter bound in gfs2_trans_begin

2021-01-27 Thread Andreas Gruenbacher
Use a tighter bound for the number of blocks required by transactions in gfs2_trans_begin: in the worst case, we'll have mixed data and metadata, so we'll need a log desciptor for each type. Signed-off-by: Andreas Gruenbacher --- fs/gfs2/trans.c | 10 -- 1 file changed, 8 insertions(+),

[Cluster-devel] [PATCH v3 09/20] gfs2: Get rid of sd_reserving_log

2021-01-27 Thread Andreas Gruenbacher
This counter and the associated wait queue are only used so that gfs2_make_fs_ro can efficiently wait for all pending log space allocations to fail after setting the filesystem to read-only. This comes at the cost of waking up that wait queue very frequently. Instead, when gfs2_log_reserve fails

[Cluster-devel] [PATCH v3 05/20] gfs2: Minor debugging improvement

2021-01-27 Thread Andreas Gruenbacher
Split the assert in gfs2_trans_end into two parts. Signed-off-by: Andreas Gruenbacher --- fs/gfs2/trans.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c index 6d4bf7ea7b3b..7705f04621f4 100644 --- a/fs/gfs2/trans.c +++ b/fs/gfs2/trans.c

[Cluster-devel] [PATCH v3 07/20] gfs2: Clean up ail2_empty

2021-01-27 Thread Andreas Gruenbacher
Clean up the logic in ail2_empty (no functional change). Signed-off-by: Andreas Gruenbacher --- fs/gfs2/log.c | 38 +- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c index 7375c007bde5..e4dc23a24569 100644 ---

[Cluster-devel] [PATCH v3 04/20] gfs2: Some documentation updates

2021-01-27 Thread Andreas Gruenbacher
The calc_reserved description claims that buf_limit is 502 (on 4k filesystems), but it is actually 503. Fix / clarify the entire description. Signed-off-by: Andreas Gruenbacher --- fs/gfs2/log.c | 24 +++- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git

[Cluster-devel] [PATCH v3 01/20] gfs2: Un-obfuscate function jdesc_find_i

2021-01-27 Thread Andreas Gruenbacher
Clean up this function to show that it is trivial. Signed-off-by: Andreas Gruenbacher --- fs/gfs2/super.c | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c index 2f56acc41c04..ed7a829e9ffe 100644 --- a/fs/gfs2/super.c +++

[Cluster-devel] [PATCH v3 16/20] gfs2: No revokes for transactions at the tail of the log

2021-01-27 Thread Andreas Gruenbacher
In gfs2_log_flush, we're going through all active transactions. For each of the buffers in those transactions that has completed, we either add a revoke to the active transaction immediately, or we move the buffer to the transaction's ail2 list, which may result in a revoke later. However,

[Cluster-devel] [PATCH v3 02/20] gfs2: Simplify the buf_limit and databuf_limit definitions

2021-01-27 Thread Andreas Gruenbacher
The BUF_OFFSET and DATABUF_OFFSET definitions are only used in buf_limit and databuf_limit, respectively, and the rounding done in those definitions is immediately wiped out by dividing by the element size. Signed-off-by: Andreas Gruenbacher --- fs/gfs2/lops.h | 17 ++--- 1 file

[Cluster-devel] [PATCH v3 08/20] gfs2: Get rid of on-stack transactions

2021-01-27 Thread Andreas Gruenbacher
On-stack transactions were introduced to work around a transaction glock deadlock in gfs2_trans_begin in commit d8348de06f70 ("GFS2: Fix deadlock on journal flush"). Subsequently, transaction glocks were eliminated in favor of the more efficient freeze glocks in commit 24972557b12c ("GFS2: remove

[Cluster-devel] [PATCH v3 00/20] Some log space management cleanups

2021-01-27 Thread Andreas Gruenbacher
Hello, here's another update on the log log space management cleanup. The changes are mostly in the topmost patch ("gfs2: Per-revoke accounting in transactions"), which still had several bugs in v2. Please review. Thanks, Andreas Andreas Gruenbacher (20): gfs2: Un-obfuscate function

[Cluster-devel] [PATCH v3 10/20] gfs2: Move lock flush locking to gfs2_trans_{begin, end}

2021-01-27 Thread Andreas Gruenbacher
Move the read locking of sd_log_flush_lock from gfs2_log_reserve to gfs2_trans_begin, and its unlocking from gfs2_log_release to gfs2_trans_end. Use gfs2_log_release in two places in which it was open coded before. Signed-off-by: Andreas Gruenbacher --- fs/gfs2/log.c | 28

[Cluster-devel] [PATCH v3 06/20] gfs2: Rename gfs2_{write => flush}_revokes

2021-01-27 Thread Andreas Gruenbacher
Function gfs2_write_revokes doesn't actually write any revokes; instead, it adds revokes to the system transaction during a flush. Signed-off-by: Andreas Gruenbacher --- fs/gfs2/log.c | 4 ++-- fs/gfs2/log.h | 2 +- fs/gfs2/lops.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff

[Cluster-devel] [PATCH v3 03/20] gfs2: Minor gfs2_write_revokes cleanups

2021-01-27 Thread Andreas Gruenbacher
Clean up the computations in gfs2_write_revokes (no change in functionality). Signed-off-by: Andreas Gruenbacher --- fs/gfs2/log.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c index 2e9314091c81..ccce17fe605f 100644 ---