[Cluster-devel] [PATCH] gfs2: simplify gdlm_put_lock with out_free label
No change in function. This patch introduces a new label out_free and consolidates the three places function gdlm_put_lock freed the glock. Signed-off-by: Bob Peterson --- fs/gfs2/lock_dlm.c | 23 ++- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c index 71911bf9ab34..54911294687c 100644 --- a/fs/gfs2/lock_dlm.c +++ b/fs/gfs2/lock_dlm.c @@ -296,10 +296,8 @@ static void gdlm_put_lock(struct gfs2_glock *gl) struct lm_lockstruct *ls = >sd_lockstruct; int error; - if (gl->gl_lksb.sb_lkid == 0) { - gfs2_glock_free(gl); - return; - } + if (gl->gl_lksb.sb_lkid == 0) + goto out_free; clear_bit(GLF_BLOCKING, >gl_flags); gfs2_glstats_inc(gl, GFS2_LKS_DCOUNT); @@ -307,17 +305,13 @@ static void gdlm_put_lock(struct gfs2_glock *gl) gfs2_update_request_times(gl); /* don't want to call dlm if we've unmounted the lock protocol */ - if (test_bit(DFL_UNMOUNT, >ls_recover_flags)) { - gfs2_glock_free(gl); - return; - } + if (test_bit(DFL_UNMOUNT, >ls_recover_flags)) + goto out_free; /* don't want to skip dlm_unlock writing the lvb when lock has one */ if (test_bit(SDF_SKIP_DLM_UNLOCK, >sd_flags) && - !gl->gl_lksb.sb_lvbptr) { - gfs2_glock_free(gl); - return; - } + !gl->gl_lksb.sb_lvbptr) + goto out_free; again: error = dlm_unlock(ls->ls_dlm, gl->gl_lksb.sb_lkid, DLM_LKF_VALBLK, @@ -331,8 +325,11 @@ static void gdlm_put_lock(struct gfs2_glock *gl) fs_err(sdp, "gdlm_unlock %x,%llx err=%d\n", gl->gl_name.ln_type, (unsigned long long)gl->gl_name.ln_number, error); - return; } + return; + +out_free: + gfs2_glock_free(gl); } static void gdlm_cancel(struct gfs2_glock *gl) -- 2.40.0
[Cluster-devel] [PATCH] gfs2: Don't free rgrp clone bitmaps until go_inval
Before this patch, every time an rgrp was synced (go_sync) the clone bitmaps were freed. We do not need to free the bitmaps in many common cases. For example when demoting the glock from EXCLUSIVE to SHARED. This is especially wasteful in cases where we unlink lots of files: the rgrps are transitioned to EX, then back to SH multiple times as it looks at the dinode allocation states, then frees them, but the clones prevent allocations until the files are evicted. Subsequent uses often cause the rgrp glock to be transitioned from SH to EX and back again in rapid succession. In these cases it's proper to sync the rgrp bitmaps to the storage media but wasteful to free the clones, because the very next unlink needs to reallocate the clone bitmaps again. So in short, today we have: 1. SH->EX (for unlink or other) 2. Allocate (kmalloc) a clone bitmap. 3. Clear the bits in original bitmap. 4. Keep original state in the clone bitmap to prevent re-allocation until the last user closes the file. 5. EX->SH 6. Sync bitmap to storage media. 7. Free the clone bitmaps. 8. Go to 1. This repeated kmalloc -> kfree -> kmalloc -> kfree is a waste of time: We only need to free the clone bitmaps when the glock is invalidated (i.e. when transitioning the glock to UN or DF so another node's view is consistent.) However, we still need to re-sync the clones with the real bitmap. This patch allows rgrp bitmaps to stick around until we have an invalidate of the glock. So in short: 1. SH->EX (for unlink or other) 2. Only the first time, allocate (kmalloc) a clone bitmap. 3. Free the bits in original bitmap. 4. Keep original state in the clone bitmap to prevent re-allocation until the last user closes the file. 5. EX->SH 6. Sync bitmap to storage media. 7. Go to 1. Other transitions, like EX->UN still sync and free the clone bitmaps. And, of course, transition from SH->EX cannot have dirty buffers, so will not have clone bitmaps. Signed-off-by: Bob Peterson --- fs/gfs2/glops.c | 5 - fs/gfs2/rgrp.c | 13 + fs/gfs2/rgrp.h | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c index ef31218060aa..7c124c57d268 100644 --- a/fs/gfs2/glops.c +++ b/fs/gfs2/glops.c @@ -205,7 +205,10 @@ static int rgrp_go_sync(struct gfs2_glock *gl) error = gfs2_rgrp_metasync(gl); if (!error) error = gfs2_ail_empty_gl(gl); - gfs2_free_clones(rgd); + if (test_bit(GLF_INVALIDATE_IN_PROGRESS, >gl_flags)) + gfs2_free_clones(rgd); + else + gfs2_sync_clones(rgd); return error; } diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index 3b9b76e980ad..6e212e0eb74e 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c @@ -616,6 +616,19 @@ void gfs2_free_clones(struct gfs2_rgrpd *rgd) } } +void gfs2_sync_clones(struct gfs2_rgrpd *rgd) +{ + int x; + + for (x = 0; x < rgd->rd_length; x++) { + struct gfs2_bitmap *bi = rgd->rd_bits + x; + if (bi->bi_clone) + memcpy(bi->bi_clone + bi->bi_offset, + bi->bi_bh->b_data + bi->bi_offset, + bi->bi_bytes); + } +} + static void dump_rs(struct seq_file *seq, const struct gfs2_blkreserv *rs, const char *fs_id_buf) { diff --git a/fs/gfs2/rgrp.h b/fs/gfs2/rgrp.h index 00b30cf893af..254188cf2d7b 100644 --- a/fs/gfs2/rgrp.h +++ b/fs/gfs2/rgrp.h @@ -32,6 +32,7 @@ extern void gfs2_clear_rgrpd(struct gfs2_sbd *sdp); extern int gfs2_rindex_update(struct gfs2_sbd *sdp); extern void gfs2_free_clones(struct gfs2_rgrpd *rgd); extern int gfs2_rgrp_go_instantiate(struct gfs2_glock *gl); +extern void gfs2_sync_clones(struct gfs2_rgrpd *rgd); extern void gfs2_rgrp_brelse(struct gfs2_rgrpd *rgd); extern struct gfs2_alloc *gfs2_alloc_get(struct gfs2_inode *ip); -- 2.40.0
[Cluster-devel] [GIT PULL] dlm updates for 6.4
Hi Linus, Please pull dlm updates from tag: git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm.git dlm-6.4 Change summary: Remove some unused features (related to lock timeouts) that have been previously scheduled for removal. Fix a bug where the pending callback flag would be incorrectly cleared, which could potentially result in missing a completion callback. Use an unbound workqueue for dlm socket handling so that socket operations can be processed with less delay. Fix possible lockspace join connection errors with large clusters (e.g. over 16 nodes) caused by a small socket backlog setting. Use atomic bit ops for internal flags to help avoid mistakes copying flag values from messages. Fix recently introduced bug where memory for lvb data could be unnecessarily allocated for a lock. Thanks, Dave Alexander Aring (11): fs: dlm: fix DLM_IFL_CB_PENDING gets overwritten fs: dlm: add unbound flag to dlm_io workqueue fs: dlm: remove deprecated code parts fs: dlm: rename stub to local message flag fs: dlm: remove DLM_IFL_LOCAL_MS flag fs: dlm: store lkb distributed flags into own value fs: dlm: change dflags to use atomic bits fs: dlm: move internal flags to atomic ops fs: dlm: rsb hash table flag value to atomic ops fs: dlm: switch lkb_sbflags to atomic ops fs: dlm: stop unnecessarily filling zero ms_extra bytes Edwin Török (1): DLM: increase socket backlog to avoid hangs with 16 nodes fs/dlm/Kconfig| 9 - fs/dlm/Makefile | 1 - fs/dlm/ast.c | 11 +- fs/dlm/config.c | 21 -- fs/dlm/config.h | 3 - fs/dlm/debug_fs.c | 8 +- fs/dlm/dlm_internal.h | 154 +++ fs/dlm/lock.c | 533 -- fs/dlm/lock.h | 17 -- fs/dlm/lockspace.c| 29 +-- fs/dlm/lowcomms.c | 6 +- fs/dlm/main.c | 9 +- fs/dlm/memory.c | 2 +- fs/dlm/netlink.c | 139 -- fs/dlm/rcom.c | 2 +- fs/dlm/recover.c | 2 +- fs/dlm/recoverd.c | 2 - fs/dlm/user.c | 34 +-- include/linux/dlm.h | 3 - include/trace/events/dlm.h| 12 +- include/uapi/linux/dlm.h | 1 + include/uapi/linux/dlm_netlink.h | 60 - include/uapi/linux/dlmconstants.h | 5 +- 23 files changed, 299 insertions(+), 764 deletions(-) delete mode 100644 fs/dlm/netlink.c delete mode 100644 include/uapi/linux/dlm_netlink.h
[Cluster-devel] [GIT PULL] gfs2 fixes for 6.4
Hi Linus, please consider pulling the following gfs2 fixes. Thanks a lot, Andreas The following changes since commit 1e760fa3596e8c7f08412712c168288b79670d78: Merge tag 'gfs2-v6.3-rc3-fix' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2 (2023-03-23 15:25:49 -0700) are available in the Git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git tags/gfs2-v6.3-rc3-fixes for you to fetch changes up to 644f6bf762fa903f64c59c2ec0f4d0d753527053: gfs2: gfs2_ail_empty_gl no log flush on error (2023-04-25 11:07:16 +0200) gfs2 fixes - Fix revoke processing at unmount and on read-only remount. - Refuse reading in inodes with an impossible indirect block height. - Various minor cleanups. Andreas Gruenbacher (1): gfs2: Fix inode height consistency check Andrew Price (3): gfs2: Remove duplicate i_nlink check from gfs2_link() gfs2: Remove ghs[] from gfs2_link gfs2: Remove ghs[] from gfs2_unlink Bob Peterson (6): gfs2: Eliminate gfs2_trim_blocks gfs2: Use gfs2_holder_initialized for jindex gfs2: return errors from gfs2_ail_empty_gl gfs2: Perform second log flush in gfs2_make_fs_ro gfs2: Issue message when revokes cannot be written gfs2: gfs2_ail_empty_gl no log flush on error Markus Elfring (1): gfs2: Move variable assignment behind a null pointer check in inode_go_dump fs/gfs2/bmap.c | 8 fs/gfs2/bmap.h | 1 - fs/gfs2/glops.c | 23 +++ fs/gfs2/inode.c | 47 ++- fs/gfs2/ops_fstype.c | 9 +++-- fs/gfs2/super.c | 9 + 6 files changed, 49 insertions(+), 48 deletions(-)