Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

docs: filesystems: convert gfs2-glocks.txt to ReST

- Add a SPDX header;
- Adjust document and section titles;
- Some whitespace fixes and new line breaks;
- Add table markups;
- Use notes markups;
- Add it to filesystems/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>

authored by

Mauro Carvalho Chehab and committed by
Andreas Gruenbacher
3700bec3 3d77e6a8

+86 -64
+84 -63
Documentation/filesystems/gfs2-glocks.txt Documentation/filesystems/gfs2-glocks.rst
··· 1 - Glock internal locking rules 2 - ------------------------------ 1 + .. SPDX-License-Identifier: GPL-2.0 2 + 3 + ============================ 4 + Glock internal locking rules 5 + ============================ 3 6 4 7 This documents the basic principles of the glock state machine 5 8 internals. Each glock (struct gfs2_glock in fs/gfs2/incore.h) ··· 27 24 namely shared (SH), deferred (DF) and exclusive (EX). Those translate 28 25 to the following DLM lock modes: 29 26 30 - Glock mode | DLM lock mode 31 - ------------------------------ 32 - UN | IV/NL Unlocked (no DLM lock associated with glock) or NL 33 - SH | PR (Protected read) 34 - DF | CW (Concurrent write) 35 - EX | EX (Exclusive) 27 + ========== ====== ===================================================== 28 + Glock mode DLM lock mode 29 + ========== ====== ===================================================== 30 + UN IV/NL Unlocked (no DLM lock associated with glock) or NL 31 + SH PR (Protected read) 32 + DF CW (Concurrent write) 33 + EX EX (Exclusive) 34 + ========== ====== ===================================================== 36 35 37 36 Thus DF is basically a shared mode which is incompatible with the "normal" 38 37 shared lock mode, SH. In GFS2 the DF mode is used exclusively for direct I/O 39 38 operations. The glocks are basically a lock plus some routines which deal 40 39 with cache management. The following rules apply for the cache: 41 40 42 - Glock mode | Cache data | Cache Metadata | Dirty Data | Dirty Metadata 43 - -------------------------------------------------------------------------- 44 - UN | No | No | No | No 45 - SH | Yes | Yes | No | No 46 - DF | No | Yes | No | No 47 - EX | Yes | Yes | Yes | Yes 41 + ========== ========== ============== ========== ============== 42 + Glock mode Cache data Cache Metadata Dirty Data Dirty Metadata 43 + ========== ========== ============== ========== ============== 44 + UN No No No No 45 + SH Yes Yes No No 46 + DF No Yes No No 47 + EX Yes Yes Yes Yes 48 + ========== ========== ============== ========== ============== 48 49 49 50 These rules are implemented using the various glock operations which 50 51 are defined for each type of glock. Not all types of glocks use ··· 56 49 57 50 Table of glock operations and per type constants: 58 51 59 - Field | Purpose 60 - ---------------------------------------------------------------------------- 61 - go_xmote_th | Called before remote state change (e.g. to sync dirty data) 62 - go_xmote_bh | Called after remote state change (e.g. to refill cache) 63 - go_inval | Called if remote state change requires invalidating the cache 64 - go_demote_ok | Returns boolean value of whether its ok to demote a glock 65 - | (e.g. checks timeout, and that there is no cached data) 66 - go_lock | Called for the first local holder of a lock 67 - go_unlock | Called on the final local unlock of a lock 68 - go_dump | Called to print content of object for debugfs file, or on 69 - | error to dump glock to the log. 70 - go_type | The type of the glock, LM_TYPE_..... 71 - go_callback | Called if the DLM sends a callback to drop this lock 72 - go_flags | GLOF_ASPACE is set, if the glock has an address space 73 - | associated with it 52 + ============= ============================================================= 53 + Field Purpose 54 + ============= ============================================================= 55 + go_xmote_th Called before remote state change (e.g. to sync dirty data) 56 + go_xmote_bh Called after remote state change (e.g. to refill cache) 57 + go_inval Called if remote state change requires invalidating the cache 58 + go_demote_ok Returns boolean value of whether its ok to demote a glock 59 + (e.g. checks timeout, and that there is no cached data) 60 + go_lock Called for the first local holder of a lock 61 + go_unlock Called on the final local unlock of a lock 62 + go_dump Called to print content of object for debugfs file, or on 63 + error to dump glock to the log. 64 + go_type The type of the glock, ``LM_TYPE_*`` 65 + go_callback Called if the DLM sends a callback to drop this lock 66 + go_flags GLOF_ASPACE is set, if the glock has an address space 67 + associated with it 68 + ============= ============================================================= 74 69 75 70 The minimum hold time for each lock is the time after a remote lock 76 71 grant for which we ignore remote demote requests. This is in order to ··· 91 82 92 83 Locking rules for glock operations: 93 84 94 - Operation | GLF_LOCK bit lock held | gl_lockref.lock spinlock held 95 - ------------------------------------------------------------------------- 96 - go_xmote_th | Yes | No 97 - go_xmote_bh | Yes | No 98 - go_inval | Yes | No 99 - go_demote_ok | Sometimes | Yes 100 - go_lock | Yes | No 101 - go_unlock | Yes | No 102 - go_dump | Sometimes | Yes 103 - go_callback | Sometimes (N/A) | Yes 85 + ============= ====================== ============================= 86 + Operation GLF_LOCK bit lock held gl_lockref.lock spinlock held 87 + ============= ====================== ============================= 88 + go_xmote_th Yes No 89 + go_xmote_bh Yes No 90 + go_inval Yes No 91 + go_demote_ok Sometimes Yes 92 + go_lock Yes No 93 + go_unlock Yes No 94 + go_dump Sometimes Yes 95 + go_callback Sometimes (N/A) Yes 96 + ============= ====================== ============================= 104 97 105 - N.B. Operations must not drop either the bit lock or the spinlock 106 - if its held on entry. go_dump and do_demote_ok must never block. 107 - Note that go_dump will only be called if the glock's state 108 - indicates that it is caching uptodate data. 98 + .. Note:: 99 + 100 + Operations must not drop either the bit lock or the spinlock 101 + if its held on entry. go_dump and do_demote_ok must never block. 102 + Note that go_dump will only be called if the glock's state 103 + indicates that it is caching uptodate data. 109 104 110 105 Glock locking order within GFS2: 111 106 ··· 117 104 2. Rename glock (for rename only) 118 105 3. Inode glock(s) 119 106 (Parents before children, inodes at "same level" with same parent in 120 - lock number order) 107 + lock number order) 121 108 4. Rgrp glock(s) (for (de)allocation operations) 122 109 5. Transaction glock (via gfs2_trans_begin) for non-read operations 123 110 6. i_rw_mutex (if required) ··· 130 117 is on a per-inode basis. Locking of rgrps is on a per rgrp basis. 131 118 In general we prefer to lock local locks prior to cluster locks. 132 119 133 - Glock Statistics 134 - ------------------ 120 + Glock Statistics 121 + ---------------- 135 122 136 123 The stats are divided into two sets: those relating to the 137 124 super block and those relating to an individual glock. The ··· 186 173 1. To be able to better set the glock "min hold time" 187 174 2. To spot performance issues more easily 188 175 3. To improve the algorithm for selecting resource groups for 189 - allocation (to base it on lock wait time, rather than blindly 190 - using a "try lock") 176 + allocation (to base it on lock wait time, rather than blindly 177 + using a "try lock") 191 178 192 179 Due to the smoothing action of the updates, a step change in 193 180 some input quantity being sampled will only fully be taken ··· 208 195 measuring system, but I hope this is as accurate as we 209 196 can reasonably make it. 210 197 211 - Per sb stats can be found here: 212 - /sys/kernel/debug/gfs2/<fsname>/sbstats 213 - Per glock stats can be found here: 214 - /sys/kernel/debug/gfs2/<fsname>/glstats 198 + Per sb stats can be found here:: 199 + 200 + /sys/kernel/debug/gfs2/<fsname>/sbstats 201 + 202 + Per glock stats can be found here:: 203 + 204 + /sys/kernel/debug/gfs2/<fsname>/glstats 215 205 216 206 Assuming that debugfs is mounted on /sys/kernel/debug and also 217 207 that <fsname> is replaced with the name of the gfs2 filesystem ··· 222 206 223 207 The abbreviations used in the output as are follows: 224 208 225 - srtt - Smoothed round trip time for non-blocking dlm requests 226 - srttvar - Variance estimate for srtt 227 - srttb - Smoothed round trip time for (potentially) blocking dlm requests 228 - srttvarb - Variance estimate for srttb 229 - sirt - Smoothed inter-request time (for dlm requests) 230 - sirtvar - Variance estimate for sirt 231 - dlm - Number of dlm requests made (dcnt in glstats file) 232 - queue - Number of glock requests queued (qcnt in glstats file) 209 + ========= ================================================================ 210 + srtt Smoothed round trip time for non blocking dlm requests 211 + srttvar Variance estimate for srtt 212 + srttb Smoothed round trip time for (potentially) blocking dlm requests 213 + srttvarb Variance estimate for srttb 214 + sirt Smoothed inter request time (for dlm requests) 215 + sirtvar Variance estimate for sirt 216 + dlm Number of dlm requests made (dcnt in glstats file) 217 + queue Number of glock requests queued (qcnt in glstats file) 218 + ========= ================================================================ 233 219 234 220 The sbstats file contains a set of these stats for each glock type (so 8 lines 235 221 for each type) and for each cpu (one column per cpu). The glstats file contains ··· 242 224 for the glock in question, along with some addition information on each dlm 243 225 reply that is received: 244 226 245 - status - The status of the dlm request 246 - flags - The dlm request flags 247 - tdiff - The time taken by this specific request 227 + ====== ======================================= 228 + status The status of the dlm request 229 + flags The dlm request flags 230 + tdiff The time taken by this specific request 231 + ====== ======================================= 232 + 248 233 (remaining fields as per above list) 249 234 250 235
+1
Documentation/filesystems/index.rst
··· 69 69 f2fs 70 70 gfs2 71 71 gfs2-uevents 72 + gfs2-glocks 72 73 hfs 73 74 hfsplus 74 75 hpfs
+1 -1
MAINTAINERS
··· 7179 7179 S: Supported 7180 7180 W: http://sources.redhat.com/cluster/ 7181 7181 T: git git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git 7182 - F: Documentation/filesystems/gfs2*.txt 7182 + F: Documentation/filesystems/gfs2* 7183 7183 F: fs/gfs2/ 7184 7184 F: include/uapi/linux/gfs2_ondisk.h 7185 7185