--- /dev/null
+=========================================================
+¤³¤ì¤Ï¡¢
+Linux-3.6/Documentation/filesystems/gfs2-glocks.txt ¤ÎÏÂÌõ¤Ç¤¹¡£
+ËÝÌõÃÄÂΡ§ JF ¥×¥í¥¸¥§¥¯¥È < http://linuxjf.sourceforge.jp/ >
+¹¹¿·Æü ¡§ 2012/10/02
+ËÝÌõ¼Ô ¡§ Seiji Kaneko < skaneko at a2 dot mbn dot or dot jp >
+=========================================================
+# Glock internal locking rules
+# ------------------------------
+ Glock ÆâÉô¥í¥Ã¥¯¥ë¡¼¥ë
+ ----------------------
+
+#This documents the basic principles of the glock state machine
+#internals. Each glock (struct gfs2_glock in fs/gfs2/incore.h)
+#has two main (internal) locks:
+¤³¤Îʸ½ñ¤Ï¡¢glock ¥¹¥Æ¡¼¥È¥Þ¥·¥ó¤ÎÆâÉô½èÍý¤Î´ðËÜŪÊý¿Ë¤òµºÜ¤·¤¿¤â¤Î¤Ç¤¹¡£
+³Æ glock (fs/gfs2/incore.h ¤Î gfs2_glock ¹½Â¤ÂÎ) ¤ÏÆó¤Ä¤Î¥á¥¤¥ó (ÆâÉô) ¥í
+¥Ã¥¯¤ò»ý¤Ã¤Æ¤¤¤Þ¤¹¡£
+
+# 1. A spinlock (gl_spin) which protects the internal state such
+# as gl_state, gl_target and the list of holders (gl_holders)
+# 2. A non-blocking bit lock, GLF_LOCK, which is used to prevent other
+# threads from making calls to the DLM, etc. at the same time. If a
+# thread takes this lock, it must then call run_queue (usually via the
+# workqueue) when it releases it in order to ensure any pending tasks
+# are completed.
+1. gl_spin ¥¹¥Ô¥ó¥í¥Ã¥¯¡£¤³¤Î¥í¥Ã¥¯¤Ï gl_state¡¢gl_target¡¢¥í¥Ã¥¯ÊÝ»ý¼Ô¤Î
+ ¥ê¥¹¥È gl_holders ¤Ê¤É¤ÎÊݸî¤ËÍѤ¤¤é¤ì¤Þ¤¹¡£
+2. GLF_LOCK ¥Î¥ó¥Ö¥í¥Ã¥¥ó¥°¥Ó¥Ã¥È¥í¥Ã¥¯¡£¤³¤Î¥í¥Ã¥¯¤Ï¡¢DLM ¤Ê¤É¤Î¸Æ¤Ó½Ð¤·
+ ¤¬Â¾¤Î¥¹¥ì¥Ã¥É¤«¤éƱ»þ¤Ëµ¯¤¤Ê¤¤¤è¤¦¤ËÇÓ¾¤ò¹Ô¤¦¤¿¤á¤ËÍѤ¤¤Þ¤¹¡£¥¹¥ì¥Ã¥É
+ ¤¬¤³¤Î¥í¥Ã¥¯¤ò¼èÆÀ¤·¤è¤¦¤È¤¹¤ë¾ì¹ç¡¢¥í¥Ã¥¯³«Êü»þ¤Ë¤Ï°ú¤Â³¤ run_queue ¤ò
+ (Ä̾ï¤Ï workqueue ·Ðͳ¤Ç) ¸Æ¤Ó½Ð¤·¤Æ¡¢»Å³Ý¤«¤êÃæ¤Î¥¿¥¹¥¯¤Î´°Î»¤ò³Îǧ¤·¤Ê
+ ¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£
+
+#The gl_holders list contains all the queued lock requests (not
+#just the holders) associated with the glock. If there are any
+#held locks, then they will be contiguous entries at the head
+#of the list. Locks are granted in strictly the order that they
+#are queued, except for those marked LM_FLAG_PRIORITY which are
+#used only during recovery, and even then only for journal locks.
+gl_holder ¥ê¥¹¥È¤Ë¤Ï¡¢Ã±¤Ë¥í¥Ã¥¯¤ÎÊÝ»ý¼Ô¤À¤±¤Ç¤Ï¤Ê¤¯¡¢glock ¤Ë´ØÏ¢¤·¤¿¡¢¥
+¥å¡¼¤ËÆþ¤Ã¤¿Á´¤Æ¤Î¥í¥Ã¥¯Í׵᤬³ÊǼ¤µ¤ì¤Þ¤¹¡£ÊÝ»ý¤µ¤ì¤Æ¤¤¤ë¥í¥Ã¥¯¤¬¤¢¤ë¾ì
+¹ç¡¢¥ê¥¹¥È¤ÎÀèƬ¤«¤é½ç¤ËϢ³¥¨¥ó¥È¥ê¤È¤·¤Æ³ÊǼ¤µ¤ì¤Þ¤¹¡£¥í¥Ã¥¯¤ÏÎã³°¤ò¤Î¤¾
+¤¡¢¸·³Ê¤Ë¥¥å¡¼¤ËÆþ¤Ã¤¿½ç¤ËÍ¿¤¨¤é¤ì¤Þ¤¹¡£¤½¤ÎÎã³°¤È¤Ï¡¢¥ê¥«¥Ð¥ê»þ¤Ë¤Î¤ß
+ÍѤ¤¤ë LM_FLAGS_PRIORITY ¥Õ¥é¥°¤Î¤Ä¤¤¤¿Í×µá¤Ç¡¢¤µ¤é¤ËÂоݤȤ¹¤ë¤Î¤Ï¥¸¥ã¡¼¥Ê
+¥ë¥í¥Ã¥¯¤Î¤ß¤Ç¤¹¡£
+
+#There are three lock states that users of the glock layer can request,
+#namely shared (SH), deferred (DF) and exclusive (EX). Those translate
+#to the following DLM lock modes:
+glock ¥ì¥¤¥ä¤ÎÍøÍѼԤ¬Í×µá²Äǽ¤Ê¥í¥Ã¥¯¾õÂ֤ϻ°¤Ä¤¢¤ê¤Þ¤¹¡£¶¦Í (SH:Shared)¡¢
+ÃÙ±ä¥í¥Ã¥¯ (DF:Deferred)¡¢ÇÓ¾ (EX:Exclusive) ¤Ç¤¹¡£
+¤³¤ì¤é¤Ï DLM ¥í¥Ã¥¯¾õÂ֤˰ʲ¼¤Î¤è¤¦¤ËÈ¿±Ç¤µ¤ì¤Þ¤¹¡£
+
+#Glock mode | DLM lock mode
+#------------------------------
+# UN | IV/NL Unlocked (no DLM lock associated with glock) or NL
+# SH | PR (Protected read)
+# DF | CW (Concurrent write)
+# EX | EX (Exclusive)
+ Glock ¥â¡¼¥É | DLM ¥í¥Ã¥¯¥â¡¼¥É
+------------------------------
+ UN | IV/NL ¥í¥Ã¥¯¤Ê¤· (glock ¤Ë´ØÏ¢¤·¤¿ DLM ¥í¥Ã¥¯¤Ê¤·) ¤Þ¤¿¤Ï NL
+ SH | PR (Êݸ¤ì¤¿Æɤ߽Ф·)
+ DF | CW (ʹԥ饤¥È)
+ EX | EX (ÇÓ¾)
+
+#Thus DF is basically a shared mode which is incompatible with the "normal"
+#shared lock mode, SH. In GFS2 the DF mode is used exclusively for direct I/O
+#operations. The glocks are basically a lock plus some routines which deal
+#with cache management. The following rules apply for the cache:
+¤³¤Î¤è¤¦¤Ë¡¢´ðËÜŪ¤Ë¤Ï DF ¤Ï¡ÖÄ̾ï¤Î¡×¶¦Í¥í¥Ã¥¯¤Ç¤¢¤ë SH ¤È¤ÏÈó¸ß´¹¤Î¶¦Í
+¥â¡¼¥É¤È¤¤¤¦°ÌÃ֤Ť±¤Ç¤¹¡£GFS2 ¤Ç¤Ï¡¢DF ¥â¡¼¥É¤ÏľÀÜ I/O (Direct I/O) ¤Ç¤Î
+¤ßÍѤ¤¤é¤ì¤Æ¤¤¤Þ¤¹¡£¤³¤ì¤é¤Î glock ¤Ï´ðËÜŪ¤Ë¤Ï¡¢¥í¥Ã¥¯¤Ë¥¥ã¥Ã¥·¥å´ÉÍý¤ò¹Ô¤¦
+½èÍý¤ò²Ã¤¨¤¿¤â¤Î¤Ç¤¹¡£¥¥ã¥Ã¥·¥å¤Ë¤Ï°Ê²¼¤Îµ¬Â§¤¬Å¬ÍѤµ¤ì¤Þ¤¹¡£
+
+#Glock mode | Cache data | Cache Metadata | Dirty Data | Dirty Metadata
+#--------------------------------------------------------------------------
+# UN | No | No | No | No
+# SH | Yes | Yes | No | No
+# DF | No | Yes | No | No
+# EX | Yes | Yes | Yes | Yes
+ Glock ¥â¡¼¥É | Cache¥Ç¡¼¥¿ | Cache¥á¥¿¥Ç¡¼¥¿| ¥À¡¼¥Æ¥£¥Ç¡¼¥¿ | ¥À¡¼¥Æ¥£¥á¥¿¥Ç¡¼¥¿
+#---------------------------------------------------------------------------------
+# UN | ¤¤¤¤¤¨ | ¤¤¤¤¤¨ | ¤¤¤¤¤¨ | ¤¤¤¤¤¨
+# SH | ¤Ï¤¤ | ¤Ï¤¤ | ¤¤¤¤¤¨ | ¤¤¤¤¤¨
+# DF | ¤¤¤¤¤¨ | ¤Ï¤¤ | ¤¤¤¤¤¨ | ¤¤¤¤¤¨
+# EX | ¤Ï¤¤ | ¤Ï¤¤ | ¤Ï¤¤ | ¤Ï¤¤
+
+#These rules are implemented using the various glock operations which
+#are defined for each type of glock. Not all types of glocks use
+#all the modes. Only inode glocks use the DF mode for example.
+¤³¤ì¤é¤Îµ¬Â§¤Ï¡¢³Æ glock ¼ïËè¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤ëÍÍ¡¹¤Ê glock Áàºî¤òÍѤ¤¤Æ¼ÂÁõ
+¤µ¤ì¤Æ¤¤¤Þ¤¹¡£ÍÍ¡¹¤Ê¥¿¥¤¥×¤Î glock ¤Ë¤Ï¡¢¤³¤ì¤é¤ÎÁ´¥â¡¼¥É¤ò»ý¤Ã¤Æ¤¤¤Ê¤¤¤â
+¤Î¤â¤¢¤ê¤Þ¤¹¡£Î㤨¤Ð inode glock ¤Î¤ß¤¬ DF ¥â¡¼¥É¤òÍѤ¤¤Þ¤¹¡£
+
+#Table of glock operations and per type constants:
+glock Áàºî¤È¡¢¥¿¥¤¥×Ëè¤ÎÄê¿ô¤Î°ìÍ÷¤ò¼¨¤·¤Þ¤¹¡£
+
+#Field | Purpose
+#----------------------------------------------------------------------------
+#go_xmote_th | Called before remote state change (e.g. to sync dirty data)
+#go_xmote_bh | Called after remote state change (e.g. to refill cache)
+#go_inval | Called if remote state change requires invalidating the cache
+#go_demote_ok | Returns boolean value of whether its ok to demote a glock
+# | (e.g. checks timeout, and that there is no cached data)
+#go_lock | Called for the first local holder of a lock
+#go_unlock | Called on the final local unlock of a lock
+#go_dump | Called to print content of object for debugfs file, or on
+# | error to dump glock to the log.
+#go_type | The type of the glock, LM_TYPE_.....
+#go_callback | Called if the DLM sends a callback to drop this lock
+#go_flags | GLOF_ASPACE is set, if the glock has an address space
+# | associated with it
+ ¥Õ¥£¡¼¥ë¥É | ÌÜŪ
+----------------------------------------------------------------------------
+go_xmote_th | ¥ê¥â¡¼¥È¤Î¾õÂÖÊѹ¹¤ÎÁ°¤Ë¸Æ¤Ð¤ì¤Þ¤¹ (Îã: ¥À¡¼¥Æ¥£¥Ç¡¼¥¿¤Î sync ¤Ê¤É)
+go_xmote_bh | ¥ê¥â¡¼¥È¤Î¾õÂÖÊѹ¹¤Î¸å¤Ë¸Æ¤Ð¤ì¤Þ¤¹ (Îã: ¥¥ã¥Ã¥·¥å¤ÎºÆÆɤ߹þ¤ß¤Ê¤É)
+go_inval | ¥ê¥â¡¼¥È¤Î¾õÂÖÊѲ½¤Ë¤è¤ê¡¢¥¥ã¥Ã¥·¥å¤ò̵¸ú²½¤¹¤ëɬÍפ¬¤¢¤ë¾ì¹ç¤Ë¸Æ
+¤Ð¤ì¤Þ¤¹
+go_demote_ok | glock ¤Î³«Êü¤¬²Äǽ¤Ç¤¢¤ë¤«¤É¤¦¤«¤òÏÀÍýÃͤÇÊÖ¤·¤Þ¤¹
+ | (Îã: ¥¿¥¤¥à¥¢¥¦¥È¤ò¥Á¥§¥Ã¥¯¤·¡¢¥¥ã¥Ã¥·¥å¤µ¤ì¤¿¥Ç¡¼¥¿¤¬¤Ê¤¤¤³¤È¤ò³Îǧ)
+go_lock | ¥í¡¼¥«¥ë¤Ç¤Î¥í¥Ã¥¯¤ÎºÇ½é¤Î (¤½¤Î¥Þ¥·¥ó¤Ç¾¤Ëï¤â¥í¥Ã¥¯¤ò»ý¤Ã¤Æ¤¤¤Ê¤¤)
+ | ¼èÆÀ»þ¤Ë¸Æ¤Ð¤ì¤Þ¤¹
+go_unlock | ¥í¡¼¥«¥ë¤Ç¤Î¥í¥Ã¥¯¤ÎºÇ¸å¤Î³«Êü»þ¤Ë¸Æ¤Ð¤ì¤Þ¤¹
+go_dump | debugfs ¥Õ¥¡¥¤¥ë¸þ¤±¤Î¥ª¥Ö¥¸¥§¥¯¥È¤ÎÆâÍƤÎɽ¼¨¤ä¡¢¥¨¥é
+ | ¡¼»þ¤Ë¥í¥°¤Ë glock Ãͤò¥À¥ó¥×¤¹¤ëºÝ¤Ë¸Æ¤Ð¤ì¤Þ¤¹¡£
+go_type | glock ¤Î¼ïÊÌ¡£LM_TYPE_.....
+go_callback | DLM ¤¬¤³¤Î¥í¥Ã¥¯¤òÍî¤È¤¹¤¿¤á¤Ë¥³¡¼¥ë¥Ð¥Ã¥¯¤òÁ÷¤Ã¤¿¾ì¹ç¤Ë¸Æ¤Ð¤ì¤Þ¤¹¡£
+go_flags | glock ¤Ë¥¢¥É¥ì¥¹¶õ´Ö¤¬´ØÏ¢ÉÕ¤±¤é¤ì¤Æ¤¤¤¿¾ì¹ç¤Ë¡¢GLOF_ASPACE ¤¬¥»¥Ã¥È
+ | ¤µ¤ì¤Þ¤¹¡£
+
+#The minimum hold time for each lock is the time after a remote lock
+#grant for which we ignore remote demote requests. This is in order to
+#prevent a situation where locks are being bounced around the cluster
+#from node to node with none of the nodes making any progress. This
+#tends to show up most with shared mmaped files which are being written
+#to by multiple nodes. By delaying the demotion in response to a
+#remote callback, that gives the userspace program time to make
+#some progress before the pages are unmapped.
+³Æ¥í¥Ã¥¯¤ÎºÇ¾®¥Û¡¼¥ë¥É»þ´Ö¤È¤Ï¡¢¥ê¥â¡¼¥È¤Î¥í¥Ã¥¯¤Î¼èÆÀµö²Ä¸å¡¢¥ê¥â¡¼¥È¤«¤é
+¤Î³«ÊüÍ×µá¤ò̵»ë¤¹¤ë»þ´Ö¤Ç¤¹¡£¤³¤ì¤Ï¡¢¥í¥Ã¥¯¤¬¥¯¥é¥¹¥¿Æâ¤Ç¥Î¡¼¥É´Ö¤Ç¤Î¥Ô¥ó
+¥Ý¥ó¤ò·«¤êÊÖ¤·¡¢Áàºî¤¬¿Ê¤Þ¤Ê¤¯¤Ê¤ë¾õ¶·¤òÈò¤±¤ë¤¿¤á¤Î¤â¤Î¤Ç¤¹¡£¤³¤Î¤è¤¦¤Ê¶¥
+¹ç¾õ¶·¤Ï¡¢Ê£¿ô¤Î¥Î¡¼¥É¤«¤é½ñ¤¹þ¤Þ¤ì¤ë¶¦Í mmap ¥Õ¥¡¥¤¥ë¤Çµ¯¤³¤ê¤¬¤Á¤Ç¤¹¡£
+¥ê¥â¡¼¥È¤«¤é¤Î¥³¡¼¥ë¥Ð¥Ã¥¯¤Ë¤è¤ë¥í¥Ã¥¯¤Î²òÊü±þÅú¤òÃ٤餻¤ë¤³¤È¤Ç¡¢¥æ¡¼¥¶¶õ
+´Ö¤Î¥×¥í¥°¥é¥à¤Ë¥Ú¡¼¥¸¤¬¥¢¥ó¥Þ¥Ã¥×¤µ¤ì¤ëÁ°¤ËÁàºî¤ò¾¯¤·¤Ç¤â¿Ê¤Þ¤»¤ë¤³¤È¤¬¤Ç
+¤¤ë¤è¤¦Í¾Íµ¤òÍ¿¤¨¤Þ¤¹¡£
+
+#There is a plan to try and remove the go_lock and go_unlock callbacks
+#if possible, in order to try and speed up the fast path though the locking.
+#Also, eventually we hope to make the glock "EX" mode locally shared
+#such that any local locking will be done with the i_mutex as required
+#rather than via the glock.
+go_lock ¤È go_unlock ¥³¡¼¥ë¥Ð¥Ã¥¯¤ò¡¢²Äǽ¤Ê¸Â¤êºï¸º¤·¤è¤¦¤È¤¤¤¦·×²è¤¬¤¢¤ê¤Þ
+¤¹¡£¤³¤ì¤Ï¥í¥Ã¥¯´ØÏ¢¤Ç¹â®¥Ñ¥¹¤Î®ÅÙ¤ò²þÁ±¤¹¤ë¤³¤È¤¬ÌÜŪ¤Ç¤¹¡£¤Þ¤¿¡¢¾Íè¤Ï
+glock "EX" ¥â¡¼¥É¤ò¥í¡¼¥«¥ë¤Ç¶¦Í¤·¤Æ¡¢¥í¡¼¥«¥ë¤Ç¤Î¥í¥Ã¥¯¤ò glock ·Ðͳ¤Ç¤Ï
+¤Ê¤¯ i_mutex ¤Ç¹Ô¤ª¤¦¤È¤¤¤¦´õ˾Ū·×²è¤â¤¢¤ê¤Þ¤¹¡£
+
+#Locking rules for glock operations:
+glock Áàºî¤Î¥í¥Ã¥¯ÊÝ»ý¥ë¡¼¥ë
+
+#Operation | GLF_LOCK bit lock held | gl_spin spinlock held
+#-----------------------------------------------------------------
+#go_xmote_th | Yes | No
+#go_xmote_bh | Yes | No
+#go_inval | Yes | No
+#go_demote_ok | Sometimes | Yes
+#go_lock | Yes | No
+#go_unlock | Yes | No
+#go_dump | Sometimes | Yes
+#go_callback | Sometimes (N/A) | Yes
+ Áàºî | GLF_LOCK ¥Ó¥Ã¥È¤ÎÊÝ»ý | gl_spin ¥¹¥Ô¥ó¥í¥Ã¥¯ÊÝ»ý
+-----------------------------------------------------------------
+go_xmote_th | ɬÍ× | ¤¤¤¤¤¨
+go_xmote_bh | ɬÍ× | ¤¤¤¤¤¨
+go_inval | ɬÍ× | ¤¤¤¤¤¨
+go_demote_ok | ¾ì¹ç¤Ë¤è¤ë | ɬÍ×
+go_lock | ɬÍ× | ¤¤¤¤¤¨
+go_unlock | ɬÍ× | ¤¤¤¤¤¨
+go_dump | ¾ì¹ç¤Ë¤è¤ë | ɬÍ×
+go_callback | ¾ì¹ç¤Ë¤è¤ë (ŬÍѳ°) | ɬÍ×
+
+#N.B. Operations must not drop either the bit lock or the spinlock
+#if its held on entry. go_dump and do_demote_ok must never block.
+#Note that go_dump will only be called if the glock's state
+#indicates that it is caching uptodate data.
+Ãíµ:Áàºî»þ¤Ë¤Ï¡¢³«»Ï»þÅÀ¤Ç»ý¤Ã¤Æ¤¤¤¿¥Ó¥Ã¥È¥í¥Ã¥¯¤ä¥¹¥Ô¥ó¥í¥Ã¥¯¤òÅÓÃæ¤Ç²ò
+Êü¤·¤Æ¤Ï¤¤¤±¤Þ¤»¤ó¡£go_dump ¤ä do_demote_ok ¤Ï¥Ö¥í¥Ã¥¯¤·¤Æ¤Ï¤¤¤±¤Þ¤»¤ó¡£
+go_dump ¤Ï¡¢glock ¤Î¾õÂÖ¤«¤éºÇ¿·¤Î¥Ç¡¼¥¿¤ò¥¥ã¥Ã¥·¥å¤·¤Æ¤¤¤ë¤Èʬ¤«¤Ã¤Æ¤¤¤ë
+¾ì¹ç¤Ë¤Î¤ß¸Æ¤Ð¤ì¤ë¤³¤È¤ËÃí°Õ¤·¤Æ¤¯¤À¤µ¤¤¡£
+
+#Glock locking order within GFS2:
+GFS2 Æâ¤Î glock ¥í¥Ã¥¯½ç½ø¤ò°Ê²¼¤Ë¼¨¤·¤Þ¤¹¡£
+
+# 1. i_mutex (if required)
+# 2. Rename glock (for rename only)
+# 3. Inode glock(s)
+# (Parents before children, inodes at "same level" with same parent in
+# lock number order)
+# 4. Rgrp glock(s) (for (de)allocation operations)
+# 5. Transaction glock (via gfs2_trans_begin) for non-read operations
+# 6. Page lock (always last, very important!)
+ 1. i_mutex (ɬÍפʾì¹ç)
+ 2. rename glock (¥ê¥Í¡¼¥à¤Î¾ì¹ç¤Î¤ß)
+ 3. Inode glock
+ (¿Æ¤ò»Ò¤è¤ê¤âÀè¤Ë¥í¥Ã¥¯¡¢¼¡¤ËƱ¤¸¿Æ¤ÇƱ¤¸³¬Áؤˤ¢¤ë inode ¤È¤¤¤¦¥í¥Ã¥¯½ç¤Ç)
+ 4. Rgrp glock (³ä¤êÅö¤Æ¤È³«Êü½èÍý¤Ç)
+ 5. Æɤ߽Ф·¤ò¹Ô¤ï¤Ê¤¤Áàºî¤Ë¤Ä¤¤¤Æ¡¢Transaction glock (gfs2_trans_begin ·Ðͳ¤Ç)
+ 6. ¥Ú¡¼¥¸¥í¥Ã¥¯ (¾ï¤ËºÇ¸å¤Ç¡£¤³¤³½ÅÍ×!)
+
+#There are two glocks per inode. One deals with access to the inode
+#itself (locking order as above), and the other, known as the iopen
+#glock is used in conjunction with the i_nlink field in the inode to
+#determine the lifetime of the inode in question. Locking of inodes
+#is on a per-inode basis. Locking of rgrps is on a per rgrp basis.
+#In general we prefer to lock local locks prior to cluster locks.
+inode Ëè¤ËÆó¤Ä¤Î glock ¤¬¤¢¤ê¤Þ¤¹¡£°ìÊý¤Ï inode ¼«ÂΤؤΥ¢¥¯¥»¥¹¤ò°·¤¤ (¥í
+¥Ã¥¯½ç¤Ï¾åµ¤Î¤È¤ª¤ê)¡¢Â¾Êý (iopen glock) ¤Ï¡¢inode ¤Î i_nlink ¥Õ¥£¡¼¥ë¥É
+¤ÈÁȤ߹ç¤ï¤»¤Æ¡¢ÂоݤȤʤë inode ¤Î¼÷Ì¿¤òȽÃǤ¹¤ë¤Î¤Ë»È¤¤¤Þ¤¹¡£inode ¤Î¥í
+¥Ã¥¯¤Ï¡¢inode Ëè¤Ë¹Ô¤¤¤Þ¤¹¡£rgrp ¤Ø¤Î¥í¥Ã¥¯¤â rgrp Ëè¤Ë¹Ô¤¤¤Þ¤¹¡£
+¤Þ¤¿¡¢Ä̾ï¤Ï¥¯¥é¥¹¥¿¥í¥Ã¥¯¤è¤ê¥í¡¼¥«¥ë¥í¥Ã¥¯¤òÍ¥À褷¤Æ»ÈÍѤ¹¤ë¤è¤¦¤Ë¤·¤Þ¤¹¡£
+
+
+# Glock Statistics
+# ------------------
+ Glock Åý·×¾ðÊó
+ ------------------
+
+#The stats are divided into two sets: those relating to the
+#super block and those relating to an individual glock. The
+#super block stats are done on a per cpu basis in order to
+#try and reduce the overhead of gathering them. They are also
+#further divided by glock type. All timings are in nanoseconds.
+Åý·×¾ðÊó¤Ï¡¢¥¹¡¼¥Ñ¥Ö¥í¥Ã¥¯´ØÏ¢¤Î¤â¤Î¤È¸Ä¡¹¤Î glock ¤Ë´ØÏ¢¤¹¤ë¤â¤Î¤ÎÆó¼ïÎà
+¤ËʬÎà¤Ç¤¤Þ¤¹¡£¥¹¡¼¥Ñ¥Ö¥í¥Ã¥¯´ØÏ¢¤ÎÅý·×¾ðÊó¼èÆÀ¤Ï¡¢¼ý½¸¤Î¥ª¡¼¥Ð¥Ø¥Ã¥É·Ú¸º
+¤Î¤¿¤á CPU Ëè¤Ë¹Ô¤ï¤ì¤Þ¤¹¡£¤³¤ì¤é¤Ï¹¹¤Ë glock ¥¿¥¤¥×¤ÇʬÎव¤ì¤Þ¤¹¡£
+»þ´Öñ°Ì¤ÏÁ´¤Æ¥Ê¥ÎÉäǤ¹¡£
+
+#In the case of both the super block and glock statistics,
+#the same information is gathered in each case. The super
+#block timing statistics are used to provide default values for
+#the glock timing statistics, so that newly created glocks
+#should have, as far as possible, a sensible starting point.
+#The per-glock counters are initialised to zero when the
+#glock is created. The per-glock statistics are lost when
+#the glock is ejected from memory.
+¥¹¡¼¥Ñ¥Ö¥í¥Ã¥¯¤È glock ¤ÎξÊý¤ÎÅý·×¾ðÊ󤬼èÆÀ¤µ¤ì¤ë¾ì¹ç¤Ë¤Ï¡¢³Æ¡¹¤ÇƱ¤¸¾ðÊó
+¤¬¼ý½¸¤µ¤ì¤Þ¤¹¡£¥¹¡¼¥Ñ¥Ö¥í¥Ã¥¯¤Î»þ´Ö¤Ë´Ø¤¹¤ë¾ðÊó¤Ï¡¢glock ¤Î»þ´Ö¤Ë´Ø¤¹¤ë¾ð
+Êó¤Îɸ½àÃͤòÄ󶡤¹¤ë¤Î¤ËÍѤ¤¤é¤ì¤Æ¤ª¤ê¡¢¿·¤·¤¯ºîÀ®¤µ¤ì¤¿ glock ¤ËÂФ·¤Æ¤â²Ä
+ǽ¤Ê¸Â¤êÂÅÅö¤Ê½é´üÃͤ¬ÀßÄꤵ¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£glock Ëè¤Ë¤¢¤ë¥«¥¦¥ó¥¿
+¤Ï glock ºîÀ®»þ¤Ë 0 ¤Ë½é´ü²½¤µ¤ì¤Þ¤¹¡£glock Ëè¤ÎÅý·×¾ðÊó¤Ï¡¢glock ¤¬¥á¥â¥ê
+¤«¤éºï½ü¤µ¤ì¤¿ºÝ¤Ë¾Ãµî¤µ¤ì¤Þ¤¹¡£
+
+#The statistics are divided into three pairs of mean and
+#variance, plus two counters. The mean/variance pairs are
+#smoothed exponential estimates and the algorithm used is
+#one which will be very familiar to those used to calculation
+#of round trip times in network code. See "TCP/IP Illustrated,
+#Volume 1", W. Richard Stevens, sect 21.3, "Round-Trip Time Measurement",
+#p. 299 and onwards. Also, Volume 2, Sect. 25.10, p. 838 and onwards.
+#Unlike the TCP/IP Illustrated case, the mean and variance are
+#not scaled, but are in units of integer nanoseconds.
+Åý·×¾ðÊó¤Ï¡¢Ê¿¶ÑÃÍ¡¦Ê¬»¶¤ÎÁÈ 3 ¤Ä¤È 2 ¤Ä¤Î¥«¥¦¥ó¥¿¤«¤é¤Ê¤ê¤Þ¤¹¡£Ê¿¶ÑÃÍ¡¦Ê¬
+»¶¤ÎÁȤߤϡ¢´ö²¿Åª¤Ë¶Ñ¤¹½èÍý¤¬¹Ô¤ï¤ì¤Æ¤¤¤Þ¤¹¡£»È¤ï¤ì¤Æ¤¤¤ë¥¢¥ë¥´¥ê¥º¥à¤Ï¡¢
+¥Í¥Ã¥È¥ï¡¼¥¯¥³¡¼¥É¤Ç¤Î¥é¥¦¥ó¥É¥È¥ê¥Ã¥×»þ´Ö¤Î·×»»¤Ë´·¤ì¤Æ¤¤¤ë¿Í¤Ë¤ÏÆëÀ÷¤ß¤Î
+¤¢¤ë¤â¤Î¤Ç¤·¤ç¤¦¡£W. Richard Stevens ¤Î "TCP/IP Illustrated, Volume 1" ¤Î
+21.3 Àá "Round-Trip Time Measurement" p.299 ¤«¤é¤ÎÆâÍƤȡ¢Volume 2 ¤Î
+25.10 Àá¤Î p.838 ¤«¤é¤ÎÆâÍƤò»²¾È¤¯¤À¤µ¤¤¡£
+TCP/IP Illusrated ¤Î¾ì¹ç¤È¤Ï°Û¤Ê¤ê¡¢Ê¿¶ÑÃͤÈʬ»¶¤Ï¥Ê¥ÎÉÃñ°Ì¤ÎÀ°¿ôÃͤǡ¢
+·å¿ôÄ´À°¤Ï¤µ¤ì¤Þ¤»¤ó¡£
+
+#The three pairs of mean/variance measure the following
+#things:
+Ê¿¶ÑÃÍ/ʬ»¶¤Î 3 ¤Ä¤ÎÁȤϰʲ¼¤ÎÄ̤ê¤Ç¤¹¡£
+
+# 1. DLM lock time (non-blocking requests)
+# 2. DLM lock time (blocking requests)
+# 3. Inter-request time (again to the DLM)
+ 1. DLM ¥í¥Ã¥¯»þ´Ö (¥Î¥ó¥Ö¥í¥Ã¥¥ó¥°Í×µá)
+ 2. DLM ¥í¥Ã¥¯»þ´Ö (¥Ö¥í¥Ã¥¥ó¥°Í×µá)
+ 3. ¥ê¥¯¥¨¥¹¥È´Ö¤Î´Ö³Ö (¤³¤ì¤â DLM ¤Î)
+
+#A non-blocking request is one which will complete right
+#away, whatever the state of the DLM lock in question. That
+#currently means any requests when (a) the current state of
+#the lock is exclusive, i.e. a lock demotion (b) the requested
+#state is either null or unlocked (again, a demotion) or (c) the
+#"try lock" flag is set. A blocking request covers all the other
+#lock requests.
+¥Î¥ó¥Ö¥í¥Ã¥¥ó¥°Í×µá¤Ï¡¢ÌäÂê¤È¤·¤Æ¤¤¤ë DLM ¥í¥Ã¥¯¤Î¾õÂ֤ˤè¤é¤º¡¢¤¹¤°¤Ë½ª
+λ¤¹¤ë¤â¤Î¤Ç¤¹¡£¸½ºß¤³¤Î¤³¤È¤Ï¡¢(a) ¸½ºß¤Î¥í¥Ã¥¯¤Î¾õÂÖ¤¬ÇÓ¾ (EX) ¤Ç¤¢¤ë
+(¤Ä¤Þ¤ê¥í¥Ã¥¯²òÊüÍ×µá¤Ç¤¢¤ë) ¤«¡¢(b) ¥í¥Ã¥¯³«ÊüÍ×µá¤Ç¡¢Âоݥí¥Ã¥¯¤Î¾õÂÖ¤¬
+null ¤«¥¢¥ó¥í¥Ã¥¯¤Ç¤¢¤Ã¤¿ (Ʊ¤¸¤¯¥í¥Ã¥¯³«Êü) ¤«¡¢(c) "try lock" ¥Õ¥é¥°¤¬
+¥»¥Ã¥È¤µ¤ì¤Æ¤¤¤¿¾ì¹ç¤Î¤¤¤º¤ì¤«¤Ç¤¢¤ë¤³¤È¤ò°ÕÌ£¤·¤Þ¤¹¡£
+¥Ö¥í¥Ã¥¥ó¥°Í×µá¤Ï¡¢¤½¤ì°Ê³°¤ÎÁ´¤Æ¤Î¥í¥Ã¥¯Í×µá¤ò°·¤¤¤Þ¤¹¡£
+<!-- i.e. ¤Î·¸¤ê¤¬ÊÑ¡£¸íµ¤«¡© -->
+
+#There are two counters. The first is there primarily to show
+#how many lock requests have been made, and thus how much data
+#has gone into the mean/variance calculations. The other counter
+#is counting queuing of holders at the top layer of the glock
+#code. Hopefully that number will be a lot larger than the number
+#of dlm lock requests issued.
+¤µ¤é¤Ë 2 ¤Ä¤Î¥«¥¦¥ó¥¿¤¬¤¢¤ê¤Þ¤¹¡£°ì¤Ä¤Ï¼ç¤Ë¥í¥Ã¥¯Í×µá²ó¿ô¤ò¼¨¤¹¤â¤Î¤Ç¡¢¤Ä
+¤Þ¤êÊ¿¶Ñ¤Èʬ»¶¤ò½Ð¤¹¤Î¤Ë¤¤¤¯¤Ä¤Î¥Ç¡¼¥¿¤¬»È¤ï¤ì¤¿¤Î¤«¤ò¼¨¤·¤Æ¤¤¤Þ¤¹¡£¤â¤¦
+¤Ò¤È¤Ä¤Î¥«¥¦¥ó¥¿¤Ï¡¢glock ¥³¡¼¥É¤ÎºÇ¾å°Ì¥ì¥Ù¥ë¤Ç¥í¥Ã¥¯ÊÝ»ý¼Ô¤Î¥¥å¡¼ÆþÎϲó¿ô
+¤ò¿ô¤¨¤ë¤â¤Î¤Ç¤¹¡£¤³¤Î¥«¥¦¥ó¥¿¤Î¿ôÃÍ¤Ï dlm ¥í¥Ã¥¯Í×µáȯ¹Ô²ó¿ô¤è¤ê¤º¤Ã¤ÈÂç
+¤¤¤¤³¤È¤¬Ë¾¤Þ¤·¤¤¤Ç¤¹¡£
+
+#So why gather these statistics? There are several reasons
+#we'd like to get a better idea of these timings:
+¤Ç¤Ï¡¢¤Ê¤¼Åý·×¿ôÃͤò½¸¤á¤ë¤Î¤«¡£¤³¤ì¤é¤Î»þ´Ö¾ðÊó¤ò½¸¤á¤ÆÃ諤òÆÀ¤è¤¦¤È¤¹
+¤ë¤Î¤Ï¡¢°Ê²¼¤Î¤¤¤¯¤Ä¤«¤ÎÍýͳ¤«¤é¤Ç¤¹¡£
+
+#1. To be able to better set the glock "min hold time"
+#2. To spot performance issues more easily
+#3. To improve the algorithm for selecting resource groups for
+#allocation (to base it on lock wait time, rather than blindly
+#using a "try lock")
+1. glock ¤Î "min hold time (ºÇ¾®¥Û¡¼¥ë¥É»þ´Ö)" ¤Ë¤è¤êŬÀÚ¤ÊÃͤòÀßÄꤹ¤ë¤¿¤á
+2. Àǽ¾å¤ÎÌäÂê¤ò¤è¤êÍưפËŦ½Ð¤¹¤ë¤¿¤á
+3. ³ä¤êÅö¤Æ»þ¤Î¥ê¥½¡¼¥¹¥°¥ë¡¼¥×ÁªÂò¥¢¥ë¥´¥ê¥º¥à¤ò²þÁ±¤¹¤ë¤¿¤á (²¿¤â¹Í¤¨¤º¤Ë
+ "try lock (¥í¥Ã¥¯»î¹Ô)" ¤¹¤ë¤Î¤Ç¤Ï¤Ê¤¯¡¢ÁªÂò¤Ë¤¢¤¿¤Ã¤Æ¥í¥Ã¥¯¥¦¥§¥¤¥È»þ´Ö
+ ¤òÍѤ¤¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹)
+
+#Due to the smoothing action of the updates, a step change in
+#some input quantity being sampled will only fully be taken
+#into account after 8 samples (or 4 for the variance) and this
+#needs to be carefully considered when interpreting the
+#results.
+¹¹¿·¤òµÞ·ã¤Ë¤ÏÊѲ½¤·¤Ê¤¤¤â¤Î¤È¤¹¤ë¤¿¤á¡¢°ìÉô¤ÎÆþÎϤγ¬Ãʾõ¤ÎÊѹ¹¤Ï 8 ¥µ¥ó
+¥×¥ë¸å¤Ë¤Ê¤ë¤Þ¤Ç (ʬ»¶¤Î¾ì¹ç¤Ï 4 ¥µ¥ó¥×¥ë¸å¤Þ¤Ç) ·×»»¤ËÆþ¤ì¤é¤ì¤Ê¤¤¤¿¤á¡¢
+·ë²Ì¤Î²ò¼á¤ÎºÝ¤Ë¤ÏÃí°Õ¿¼¤¤È½ÃǤ¬É¬ÍפǤ¹¡£
+
+#Knowing both the time it takes a lock request to complete and
+#the average time between lock requests for a glock means we
+#can compute the total percentage of the time for which the
+#node is able to use a glock vs. time that the rest of the
+#cluster has its share. That will be very useful when setting
+#the lock min hold time.
+¥í¥Ã¥¯Í׵᤬´°Î»¤¹¤ë¤Þ¤Ç¤ËÍפ¹¤ë»þ´Ö¡¢¤ª¤è¤Ó glock ¥í¥Ã¥¯Í×µá´Ö¤ÎÊ¿¶Ñ·Ð²á
+»þ´Ö¤ÎξÊý¤¬¤ï¤«¤Ã¤Æ¤¤¤ì¤Ð¡¢¤½¤Î¥Î¡¼¥É¤Ç glock ¤òÍøÍѤǤ¤ë»þ´Ö¤È»Ä¤ê¤Î¥¯
+¥é¥¹¥¿¤Î¼è¤êʬ¤È¤Î³ä¹ç¤ò·×»»¤Ç¤¤Þ¤¹¡£¤³¤ì¤Ï¡¢¥í¥Ã¥¯¤ÎºÇ¾®ÊÝ»ý»þ´Ö¤òÀßÄê
+¤¹¤ë¤¿¤á¤Ë¤È¤Æ¤âÍÍѤÊÃͤǤ¹¡£
+
+#Great care has been taken to ensure that we
+#measure exactly the quantities that we want, as accurately
+#as possible. There are always inaccuracies in any
+#measuring system, but I hope this is as accurate as we
+#can reasonably make it.
+¼ÂºÝ¤ËɬÍפÊÃͤ¬²Äǽ¤Ê¸Â¤êÀµ³Î¤Ë¼èÆÀ¤Ç¤¤Æ¤¤¤ë¤³¤È¤ò³Îǧ¤¹¤ë¤¿¤á¤Ë¤Ï¡¢½½
+ʬ¤ËÃí°Õ¤òʧ¤¦É¬Íפ¬¤¢¤ê¤Þ¤¹¡£¤É¤ó¤Ê¬Äꥷ¥¹¥Æ¥à¤Ë¤â¸íº¹¤Ï¤Ä¤¤â¤Î¤Ç¤¹¤¬¡¢
+ÂÅÅö¤ÊÈϰϤÇÀµ³Î¤Ê¤â¤Î¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤³¤È¤È´üÂÔ¤·¤Æ¤¤¤Þ¤¹¡£
+
+#Per sb stats can be found here:
+sb Ëè¤ÎÅý·×¾ðÊó¤Ï°Ê²¼¤«¤é¼èÆÀ¤Ç¤¤Þ¤¹¡£
+/sys/kernel/debug/gfs2/<fsname>/sbstats
+#Per glock stats can be found here:
+glock Ëè¤ÎÅý·×¾ðÊó¤Ï°Ê²¼¤«¤é¼èÆÀ¤Ç¤¤Þ¤¹¡£
+/sys/kernel/debug/gfs2/<fsname>/glstats
+
+#Assuming that debugfs is mounted on /sys/kernel/debug and also
+#that <fsname> is replaced with the name of the gfs2 filesystem
+#in question.
+debugfs ¤¬ /sys/kernel/debug ¤Ë¥Þ¥¦¥ó¥È¤µ¤ì¤Æ¤¤¤ë¤Ê¤é¤Ð¡¢ÌäÂê¤È¤Ê¤ë
+gfs2 ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Î̾Á°¤ò <fsname> ¤ËÃÖ¤´¹¤¨¤¿µ¼»÷¥Õ¥¡¥¤¥ë¤«¤é¤â¾ðÊó
+¤ò¼èÆÀ¤Ç¤¤Þ¤¹¡£
+
+#The abbreviations used in the output as are follows:
+½ÐÎϤËÍѤ¤¤é¤ì¤ëά¹æ¤Ï°Ê²¼¤ÎÄ̤ê¤Ç¤¹¡£
+
+#srtt - Smoothed round trip time for non-blocking dlm requests
+#srttvar - Variance estimate for srtt
+#srttb - Smoothed round trip time for (potentially) blocking dlm requests
+#srttvarb - Variance estimate for srttb
+#sirt - Smoothed inter-request time (for dlm requests)
+#sirtvar - Variance estimate for sirt
+#dlm - Number of dlm requests made (dcnt in glstats file)
+#queue - Number of glock requests queued (qcnt in glstats file)
+srtt - ¥Î¥ó¥Ö¥í¥Ã¥¥ó¥° dlm Í×µá¤Î¼èÆÀ»þ´Ö¤Î°ÜÆ°Ê¿¶Ñ
+srttvar - srtt ¤Îʬ»¶¤Î¿äÄêÃÍ
+srttb - ¥Ö¥í¥Ã¥¥ó¥° (¤Î²ÄǽÀ¤Î¤¢¤ë) dlm Í×µá¤Î¼èÆÀ»þ´Ö¤Î°ÜÆ°Ê¿¶Ñ
+srttvarb - srttb ¤Îʬ»¶¤Î¿äÄêÃÍ
+sirt - dlm ¥ê¥¯¥¨¥¹¥È¤Î¥ê¥¯¥¨¥¹¥È´Ö¤Î´Ö³Ö¤Î°ÜÆ°Ê¿¶Ñ
+sirtvar - sirtb ¤Îʬ»¶¤Î¿äÄêÃÍ
+dlm - dlm ¥ê¥¯¥¨¥¹¥È¤ÎÍ×µá²ó¿ô (glstats ¥Õ¥¡¥¤¥ë¤Î dcnt ÃÍ)
+queue - ¥¥å¡¼¥¤¥ó¥°¤µ¤ì¤¿ glock Í×µá¤Î²ó¿ô (glstats ¥Õ¥¡¥¤¥ë¤Î qcnt ÃÍ)
+
+#The sbstats file contains a set of these stats for each glock type (so 8 lines
+#for each type) and for each cpu (one column per cpu). The glstats file contains
+#a set of these stats for each glock in a similar format to the glocks file, but
+#using the format mean/variance for each of the timing stats.
+sbstats ¥Õ¥¡¥¤¥ë¤Ë¤Ï¡¢³Æ glock ¥¿¥¤¥×Ëè¤Ë¤³¤ì¤é¤ÎÅý·×¾ðÊó¤ÎÁȤ¬³ÊǼ (¤·
+¤¿¤¬¤Ã¤Æ¥¿¥¤¥×¤´¤È¤Ë 8 ¹Ô) ¤µ¤ì¡¢¤½¤ÎÁȤߤ¬¹¹¤Ë CPU Ëè¤Ë³ÊǼ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
+glstats ¥Õ¥¡¥¤¥ë¤Ë¤Ï¡¢¥¿¥¤¥ß¥ó¥°¾ðÊó¤È¤·¤Æ¤ÏÊ¿¶ÑÃͤÈʬ»¶¤òÍѤ¤¤Æ¤¤¤ëÅÀ¤ò
+½ü¤±¤Ð³Æ glocks ¥Õ¥¡¥¤¥ë¤ÈƱÍͤΥե©¡¼¥Þ¥Ã¥È¤Ç¤³¤ì¤é¤ÎÅý·×¾ðÊó¤ÎÁȤ¬³ÊǼ
+¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
+
+#The gfs2_glock_lock_time tracepoint prints out the current values of the stats
+#for the glock in question, along with some addition information on each dlm
+#reply that is received:
+gfs2_glock_lock_time ¥È¥ì¡¼¥¹¥Ý¥¤¥ó¥È¤Ï¡¢ÂоݤȤʤë glock ¤ÎÅý·×¾ðÊó¤Î¸½
+ºß¤ÎÃͤò½ÐÎϤ·¡¢¤µ¤é¤Ë¼õ¤±¼è¤Ã¤¿³Æ dlm ¤Î±þÅú¤Ë´Ø¤¹¤ëÄɲþðÊó¤â½ÐÎϤµ¤ì
+¤Þ¤¹¡£
+
+#status - The status of the dlm request
+#flags - The dlm request flags
+#tdiff - The time taken by this specific request
+#(remaining fields as per above list)
+status - dlm Í×µá¤Î¾õÂÖ
+flags - dlm Í×µá¥Õ¥é¥°
+tdiff - ÆÃÄê¤Î¥ê¥¯¥¨¥¹¥È¤Î½èÍý¤ËÍפ·¤¿»þ´Ö
+ (»Ä¤ê¤Î¥Õ¥£¡¼¥ë¥É¤Ï¾åµ¥ê¥¹¥È¤Ë½¾¤¦)
+
+