aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-09-11 15:23:51 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-09-11 15:23:51 -0400
commit01cab5549c3e9a0fe7248fc5ad0fd79361cc0d39 (patch)
tree8b61b4fac425eb23a46df1765d7ff9342c211bc1 /fs
parent64d1def7d33856824d2c5c6fd6d4579d4d54bb87 (diff)
parent8f7e0a806db0a3ba33234af3c39d68ed8c144071 (diff)
Merge tag 'gfs2-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2
Pull GFS2 updates from Bob Peterson: "Here is a list of patches we've accumulated for GFS2 for the current upstream merge window. This time we've only got six patches, many of which are very small: - three cleanups from Andreas Gruenbacher, including a nice cleanup of the sequence file code for the sbstats debugfs file. - a patch from Ben Hutchings that changes statistics variables from signed to unsigned. - two patches from me that increase GFS2's glock scalability by switching from a conventional hash table to rhashtable" * tag 'gfs2-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2: gfs2: A minor "sbstats" cleanup gfs2: Fix a typo in a comment gfs2: Make statistics unsigned, suitable for use with do_div() GFS2: Use resizable hash table for glocks GFS2: Move glock superblock pointer to field gl_name gfs2: Simplify the seq file code for "sbstats"
Diffstat (limited to 'fs')
-rw-r--r--fs/gfs2/glock.c348
-rw-r--r--fs/gfs2/glops.c38
-rw-r--r--fs/gfs2/incore.h15
-rw-r--r--fs/gfs2/lock_dlm.c12
-rw-r--r--fs/gfs2/lops.c6
-rw-r--r--fs/gfs2/meta_io.c6
-rw-r--r--fs/gfs2/meta_io.h2
-rw-r--r--fs/gfs2/quota.c22
-rw-r--r--fs/gfs2/rgrp.c10
-rw-r--r--fs/gfs2/trace_gfs2.h34
-rw-r--r--fs/gfs2/trans.c4
11 files changed, 212 insertions, 285 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index a38e38f7b6fc..9bd1244caf38 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -34,6 +34,7 @@
34#include <linux/percpu.h> 34#include <linux/percpu.h>
35#include <linux/list_sort.h> 35#include <linux/list_sort.h>
36#include <linux/lockref.h> 36#include <linux/lockref.h>
37#include <linux/rhashtable.h>
37 38
38#include "gfs2.h" 39#include "gfs2.h"
39#include "incore.h" 40#include "incore.h"
@@ -50,9 +51,8 @@
50#include "trace_gfs2.h" 51#include "trace_gfs2.h"
51 52
52struct gfs2_glock_iter { 53struct gfs2_glock_iter {
53 int hash; /* hash bucket index */
54 unsigned nhash; /* Index within current bucket */
55 struct gfs2_sbd *sdp; /* incore superblock */ 54 struct gfs2_sbd *sdp; /* incore superblock */
55 struct rhashtable_iter hti; /* rhashtable iterator */
56 struct gfs2_glock *gl; /* current glock struct */ 56 struct gfs2_glock *gl; /* current glock struct */
57 loff_t last_pos; /* last position */ 57 loff_t last_pos; /* last position */
58}; 58};
@@ -70,44 +70,19 @@ static DEFINE_SPINLOCK(lru_lock);
70 70
71#define GFS2_GL_HASH_SHIFT 15 71#define GFS2_GL_HASH_SHIFT 15
72#define GFS2_GL_HASH_SIZE (1 << GFS2_GL_HASH_SHIFT) 72#define GFS2_GL_HASH_SIZE (1 << GFS2_GL_HASH_SHIFT)
73#define GFS2_GL_HASH_MASK (GFS2_GL_HASH_SIZE - 1)
74 73
75static struct hlist_bl_head gl_hash_table[GFS2_GL_HASH_SIZE]; 74static struct rhashtable_params ht_parms = {
76static struct dentry *gfs2_root; 75 .nelem_hint = GFS2_GL_HASH_SIZE * 3 / 4,
77 76 .key_len = sizeof(struct lm_lockname),
78/** 77 .key_offset = offsetof(struct gfs2_glock, gl_name),
79 * gl_hash() - Turn glock number into hash bucket number 78 .head_offset = offsetof(struct gfs2_glock, gl_node),
80 * @lock: The glock number 79};
81 *
82 * Returns: The number of the corresponding hash bucket
83 */
84
85static unsigned int gl_hash(const struct gfs2_sbd *sdp,
86 const struct lm_lockname *name)
87{
88 unsigned int h;
89
90 h = jhash(&name->ln_number, sizeof(u64), 0);
91 h = jhash(&name->ln_type, sizeof(unsigned int), h);
92 h = jhash(&sdp, sizeof(struct gfs2_sbd *), h);
93 h &= GFS2_GL_HASH_MASK;
94
95 return h;
96}
97
98static inline void spin_lock_bucket(unsigned int hash)
99{
100 hlist_bl_lock(&gl_hash_table[hash]);
101}
102 80
103static inline void spin_unlock_bucket(unsigned int hash) 81static struct rhashtable gl_hash_table;
104{
105 hlist_bl_unlock(&gl_hash_table[hash]);
106}
107 82
108static void gfs2_glock_dealloc(struct rcu_head *rcu) 83void gfs2_glock_free(struct gfs2_glock *gl)
109{ 84{
110 struct gfs2_glock *gl = container_of(rcu, struct gfs2_glock, gl_rcu); 85 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
111 86
112 if (gl->gl_ops->go_flags & GLOF_ASPACE) { 87 if (gl->gl_ops->go_flags & GLOF_ASPACE) {
113 kmem_cache_free(gfs2_glock_aspace_cachep, gl); 88 kmem_cache_free(gfs2_glock_aspace_cachep, gl);
@@ -115,13 +90,6 @@ static void gfs2_glock_dealloc(struct rcu_head *rcu)
115 kfree(gl->gl_lksb.sb_lvbptr); 90 kfree(gl->gl_lksb.sb_lvbptr);
116 kmem_cache_free(gfs2_glock_cachep, gl); 91 kmem_cache_free(gfs2_glock_cachep, gl);
117 } 92 }
118}
119
120void gfs2_glock_free(struct gfs2_glock *gl)
121{
122 struct gfs2_sbd *sdp = gl->gl_sbd;
123
124 call_rcu(&gl->gl_rcu, gfs2_glock_dealloc);
125 if (atomic_dec_and_test(&sdp->sd_glock_disposal)) 93 if (atomic_dec_and_test(&sdp->sd_glock_disposal))
126 wake_up(&sdp->sd_glock_wait); 94 wake_up(&sdp->sd_glock_wait);
127} 95}
@@ -192,7 +160,7 @@ static void gfs2_glock_remove_from_lru(struct gfs2_glock *gl)
192 160
193void gfs2_glock_put(struct gfs2_glock *gl) 161void gfs2_glock_put(struct gfs2_glock *gl)
194{ 162{
195 struct gfs2_sbd *sdp = gl->gl_sbd; 163 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
196 struct address_space *mapping = gfs2_glock2aspace(gl); 164 struct address_space *mapping = gfs2_glock2aspace(gl);
197 165
198 if (lockref_put_or_lock(&gl->gl_lockref)) 166 if (lockref_put_or_lock(&gl->gl_lockref))
@@ -202,9 +170,7 @@ void gfs2_glock_put(struct gfs2_glock *gl)
202 170
203 gfs2_glock_remove_from_lru(gl); 171 gfs2_glock_remove_from_lru(gl);
204 spin_unlock(&gl->gl_lockref.lock); 172 spin_unlock(&gl->gl_lockref.lock);
205 spin_lock_bucket(gl->gl_hash); 173 rhashtable_remove_fast(&gl_hash_table, &gl->gl_node, ht_parms);
206 hlist_bl_del_rcu(&gl->gl_list);
207 spin_unlock_bucket(gl->gl_hash);
208 GLOCK_BUG_ON(gl, !list_empty(&gl->gl_holders)); 174 GLOCK_BUG_ON(gl, !list_empty(&gl->gl_holders));
209 GLOCK_BUG_ON(gl, mapping && mapping->nrpages); 175 GLOCK_BUG_ON(gl, mapping && mapping->nrpages);
210 trace_gfs2_glock_put(gl); 176 trace_gfs2_glock_put(gl);
@@ -212,33 +178,6 @@ void gfs2_glock_put(struct gfs2_glock *gl)
212} 178}
213 179
214/** 180/**
215 * search_bucket() - Find struct gfs2_glock by lock number
216 * @bucket: the bucket to search
217 * @name: The lock name
218 *
219 * Returns: NULL, or the struct gfs2_glock with the requested number
220 */
221
222static struct gfs2_glock *search_bucket(unsigned int hash,
223 const struct gfs2_sbd *sdp,
224 const struct lm_lockname *name)
225{
226 struct gfs2_glock *gl;
227 struct hlist_bl_node *h;
228
229 hlist_bl_for_each_entry_rcu(gl, h, &gl_hash_table[hash], gl_list) {
230 if (!lm_name_equal(&gl->gl_name, name))
231 continue;
232 if (gl->gl_sbd != sdp)
233 continue;
234 if (lockref_get_not_dead(&gl->gl_lockref))
235 return gl;
236 }
237
238 return NULL;
239}
240
241/**
242 * may_grant - check if its ok to grant a new lock 181 * may_grant - check if its ok to grant a new lock
243 * @gl: The glock 182 * @gl: The glock
244 * @gh: The lock request which we wish to grant 183 * @gh: The lock request which we wish to grant
@@ -506,7 +445,7 @@ __releases(&gl->gl_spin)
506__acquires(&gl->gl_spin) 445__acquires(&gl->gl_spin)
507{ 446{
508 const struct gfs2_glock_operations *glops = gl->gl_ops; 447 const struct gfs2_glock_operations *glops = gl->gl_ops;
509 struct gfs2_sbd *sdp = gl->gl_sbd; 448 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
510 unsigned int lck_flags = gh ? gh->gh_flags : 0; 449 unsigned int lck_flags = gh ? gh->gh_flags : 0;
511 int ret; 450 int ret;
512 451
@@ -628,7 +567,7 @@ out_unlock:
628static void delete_work_func(struct work_struct *work) 567static void delete_work_func(struct work_struct *work)
629{ 568{
630 struct gfs2_glock *gl = container_of(work, struct gfs2_glock, gl_delete); 569 struct gfs2_glock *gl = container_of(work, struct gfs2_glock, gl_delete);
631 struct gfs2_sbd *sdp = gl->gl_sbd; 570 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
632 struct gfs2_inode *ip; 571 struct gfs2_inode *ip;
633 struct inode *inode; 572 struct inode *inode;
634 u64 no_addr = gl->gl_name.ln_number; 573 u64 no_addr = gl->gl_name.ln_number;
@@ -704,15 +643,17 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number,
704 struct gfs2_glock **glp) 643 struct gfs2_glock **glp)
705{ 644{
706 struct super_block *s = sdp->sd_vfs; 645 struct super_block *s = sdp->sd_vfs;
707 struct lm_lockname name = { .ln_number = number, .ln_type = glops->go_type }; 646 struct lm_lockname name = { .ln_number = number,
708 struct gfs2_glock *gl, *tmp; 647 .ln_type = glops->go_type,
709 unsigned int hash = gl_hash(sdp, &name); 648 .ln_sbd = sdp };
649 struct gfs2_glock *gl, *tmp = NULL;
710 struct address_space *mapping; 650 struct address_space *mapping;
711 struct kmem_cache *cachep; 651 struct kmem_cache *cachep;
652 int ret, tries = 0;
712 653
713 rcu_read_lock(); 654 gl = rhashtable_lookup_fast(&gl_hash_table, &name, ht_parms);
714 gl = search_bucket(hash, sdp, &name); 655 if (gl && !lockref_get_not_dead(&gl->gl_lockref))
715 rcu_read_unlock(); 656 gl = NULL;
716 657
717 *glp = gl; 658 *glp = gl;
718 if (gl) 659 if (gl)
@@ -739,14 +680,13 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number,
739 } 680 }
740 681
741 atomic_inc(&sdp->sd_glock_disposal); 682 atomic_inc(&sdp->sd_glock_disposal);
742 gl->gl_sbd = sdp; 683 gl->gl_node.next = NULL;
743 gl->gl_flags = 0; 684 gl->gl_flags = 0;
744 gl->gl_name = name; 685 gl->gl_name = name;
745 gl->gl_lockref.count = 1; 686 gl->gl_lockref.count = 1;
746 gl->gl_state = LM_ST_UNLOCKED; 687 gl->gl_state = LM_ST_UNLOCKED;
747 gl->gl_target = LM_ST_UNLOCKED; 688 gl->gl_target = LM_ST_UNLOCKED;
748 gl->gl_demote_state = LM_ST_EXCLUSIVE; 689 gl->gl_demote_state = LM_ST_EXCLUSIVE;
749 gl->gl_hash = hash;
750 gl->gl_ops = glops; 690 gl->gl_ops = glops;
751 gl->gl_dstamp = ktime_set(0, 0); 691 gl->gl_dstamp = ktime_set(0, 0);
752 preempt_disable(); 692 preempt_disable();
@@ -771,22 +711,34 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number,
771 mapping->writeback_index = 0; 711 mapping->writeback_index = 0;
772 } 712 }
773 713
774 spin_lock_bucket(hash); 714again:
775 tmp = search_bucket(hash, sdp, &name); 715 ret = rhashtable_lookup_insert_fast(&gl_hash_table, &gl->gl_node,
776 if (tmp) { 716 ht_parms);
777 spin_unlock_bucket(hash); 717 if (ret == 0) {
778 kfree(gl->gl_lksb.sb_lvbptr); 718 *glp = gl;
779 kmem_cache_free(cachep, gl); 719 return 0;
780 atomic_dec(&sdp->sd_glock_disposal);
781 gl = tmp;
782 } else {
783 hlist_bl_add_head_rcu(&gl->gl_list, &gl_hash_table[hash]);
784 spin_unlock_bucket(hash);
785 } 720 }
786 721
787 *glp = gl; 722 if (ret == -EEXIST) {
723 ret = 0;
724 tmp = rhashtable_lookup_fast(&gl_hash_table, &name, ht_parms);
725 if (tmp == NULL || !lockref_get_not_dead(&tmp->gl_lockref)) {
726 if (++tries < 100) {
727 cond_resched();
728 goto again;
729 }
730 tmp = NULL;
731 ret = -ENOMEM;
732 }
733 } else {
734 WARN_ON_ONCE(ret);
735 }
736 kfree(gl->gl_lksb.sb_lvbptr);
737 kmem_cache_free(cachep, gl);
738 atomic_dec(&sdp->sd_glock_disposal);
739 *glp = tmp;
788 740
789 return 0; 741 return ret;
790} 742}
791 743
792/** 744/**
@@ -928,7 +880,7 @@ __releases(&gl->gl_spin)
928__acquires(&gl->gl_spin) 880__acquires(&gl->gl_spin)
929{ 881{
930 struct gfs2_glock *gl = gh->gh_gl; 882 struct gfs2_glock *gl = gh->gh_gl;
931 struct gfs2_sbd *sdp = gl->gl_sbd; 883 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
932 struct list_head *insert_pt = NULL; 884 struct list_head *insert_pt = NULL;
933 struct gfs2_holder *gh2; 885 struct gfs2_holder *gh2;
934 int try_futile = 0; 886 int try_futile = 0;
@@ -1006,7 +958,7 @@ trap_recursive:
1006int gfs2_glock_nq(struct gfs2_holder *gh) 958int gfs2_glock_nq(struct gfs2_holder *gh)
1007{ 959{
1008 struct gfs2_glock *gl = gh->gh_gl; 960 struct gfs2_glock *gl = gh->gh_gl;
1009 struct gfs2_sbd *sdp = gl->gl_sbd; 961 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
1010 int error = 0; 962 int error = 0;
1011 963
1012 if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) 964 if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
@@ -1313,7 +1265,7 @@ static int gfs2_should_freeze(const struct gfs2_glock *gl)
1313 1265
1314void gfs2_glock_complete(struct gfs2_glock *gl, int ret) 1266void gfs2_glock_complete(struct gfs2_glock *gl, int ret)
1315{ 1267{
1316 struct lm_lockstruct *ls = &gl->gl_sbd->sd_lockstruct; 1268 struct lm_lockstruct *ls = &gl->gl_name.ln_sbd->sd_lockstruct;
1317 1269
1318 spin_lock(&gl->gl_spin); 1270 spin_lock(&gl->gl_spin);
1319 gl->gl_reply = ret; 1271 gl->gl_reply = ret;
@@ -1462,31 +1414,26 @@ static struct shrinker glock_shrinker = {
1462 * 1414 *
1463 */ 1415 */
1464 1416
1465static void examine_bucket(glock_examiner examiner, const struct gfs2_sbd *sdp, 1417static void glock_hash_walk(glock_examiner examiner, const struct gfs2_sbd *sdp)
1466 unsigned int hash)
1467{ 1418{
1468 struct gfs2_glock *gl; 1419 struct gfs2_glock *gl;
1469 struct hlist_bl_head *head = &gl_hash_table[hash]; 1420 struct rhash_head *pos, *next;
1470 struct hlist_bl_node *pos; 1421 const struct bucket_table *tbl;
1422 int i;
1471 1423
1472 rcu_read_lock(); 1424 rcu_read_lock();
1473 hlist_bl_for_each_entry_rcu(gl, pos, head, gl_list) { 1425 tbl = rht_dereference_rcu(gl_hash_table.tbl, &gl_hash_table);
1474 if ((gl->gl_sbd == sdp) && lockref_get_not_dead(&gl->gl_lockref)) 1426 for (i = 0; i < tbl->size; i++) {
1475 examiner(gl); 1427 rht_for_each_entry_safe(gl, pos, next, tbl, i, gl_node) {
1428 if ((gl->gl_name.ln_sbd == sdp) &&
1429 lockref_get_not_dead(&gl->gl_lockref))
1430 examiner(gl);
1431 }
1476 } 1432 }
1477 rcu_read_unlock(); 1433 rcu_read_unlock();
1478 cond_resched(); 1434 cond_resched();
1479} 1435}
1480 1436
1481static void glock_hash_walk(glock_examiner examiner, const struct gfs2_sbd *sdp)
1482{
1483 unsigned x;
1484
1485 for (x = 0; x < GFS2_GL_HASH_SIZE; x++)
1486 examine_bucket(examiner, sdp, x);
1487}
1488
1489
1490/** 1437/**
1491 * thaw_glock - thaw out a glock which has an unprocessed reply waiting 1438 * thaw_glock - thaw out a glock which has an unprocessed reply waiting
1492 * @gl: The glock to thaw 1439 * @gl: The glock to thaw
@@ -1569,7 +1516,7 @@ void gfs2_glock_finish_truncate(struct gfs2_inode *ip)
1569 int ret; 1516 int ret;
1570 1517
1571 ret = gfs2_truncatei_resume(ip); 1518 ret = gfs2_truncatei_resume(ip);
1572 gfs2_assert_withdraw(gl->gl_sbd, ret == 0); 1519 gfs2_assert_withdraw(gl->gl_name.ln_sbd, ret == 0);
1573 1520
1574 spin_lock(&gl->gl_spin); 1521 spin_lock(&gl->gl_spin);
1575 clear_bit(GLF_LOCK, &gl->gl_flags); 1522 clear_bit(GLF_LOCK, &gl->gl_flags);
@@ -1733,17 +1680,17 @@ static int gfs2_glstats_seq_show(struct seq_file *seq, void *iter_ptr)
1733{ 1680{
1734 struct gfs2_glock *gl = iter_ptr; 1681 struct gfs2_glock *gl = iter_ptr;
1735 1682
1736 seq_printf(seq, "G: n:%u/%llx rtt:%lld/%lld rttb:%lld/%lld irt:%lld/%lld dcnt: %lld qcnt: %lld\n", 1683 seq_printf(seq, "G: n:%u/%llx rtt:%llu/%llu rttb:%llu/%llu irt:%llu/%llu dcnt: %llu qcnt: %llu\n",
1737 gl->gl_name.ln_type, 1684 gl->gl_name.ln_type,
1738 (unsigned long long)gl->gl_name.ln_number, 1685 (unsigned long long)gl->gl_name.ln_number,
1739 (long long)gl->gl_stats.stats[GFS2_LKS_SRTT], 1686 (unsigned long long)gl->gl_stats.stats[GFS2_LKS_SRTT],
1740 (long long)gl->gl_stats.stats[GFS2_LKS_SRTTVAR], 1687 (unsigned long long)gl->gl_stats.stats[GFS2_LKS_SRTTVAR],
1741 (long long)gl->gl_stats.stats[GFS2_LKS_SRTTB], 1688 (unsigned long long)gl->gl_stats.stats[GFS2_LKS_SRTTB],
1742 (long long)gl->gl_stats.stats[GFS2_LKS_SRTTVARB], 1689 (unsigned long long)gl->gl_stats.stats[GFS2_LKS_SRTTVARB],
1743 (long long)gl->gl_stats.stats[GFS2_LKS_SIRT], 1690 (unsigned long long)gl->gl_stats.stats[GFS2_LKS_SIRT],
1744 (long long)gl->gl_stats.stats[GFS2_LKS_SIRTVAR], 1691 (unsigned long long)gl->gl_stats.stats[GFS2_LKS_SIRTVAR],
1745 (long long)gl->gl_stats.stats[GFS2_LKS_DCOUNT], 1692 (unsigned long long)gl->gl_stats.stats[GFS2_LKS_DCOUNT],
1746 (long long)gl->gl_stats.stats[GFS2_LKS_QCOUNT]); 1693 (unsigned long long)gl->gl_stats.stats[GFS2_LKS_QCOUNT]);
1747 return 0; 1694 return 0;
1748} 1695}
1749 1696
@@ -1776,11 +1723,10 @@ static const char *gfs2_stype[] = {
1776 1723
1777static int gfs2_sbstats_seq_show(struct seq_file *seq, void *iter_ptr) 1724static int gfs2_sbstats_seq_show(struct seq_file *seq, void *iter_ptr)
1778{ 1725{
1779 struct gfs2_glock_iter *gi = seq->private; 1726 struct gfs2_sbd *sdp = seq->private;
1780 struct gfs2_sbd *sdp = gi->sdp; 1727 loff_t pos = *(loff_t *)iter_ptr;
1781 unsigned index = gi->hash >> 3; 1728 unsigned index = pos >> 3;
1782 unsigned subindex = gi->hash & 0x07; 1729 unsigned subindex = pos & 0x07;
1783 s64 value;
1784 int i; 1730 int i;
1785 1731
1786 if (index == 0 && subindex != 0) 1732 if (index == 0 && subindex != 0)
@@ -1791,12 +1737,12 @@ static int gfs2_sbstats_seq_show(struct seq_file *seq, void *iter_ptr)
1791 1737
1792 for_each_possible_cpu(i) { 1738 for_each_possible_cpu(i) {
1793 const struct gfs2_pcpu_lkstats *lkstats = per_cpu_ptr(sdp->sd_lkstats, i); 1739 const struct gfs2_pcpu_lkstats *lkstats = per_cpu_ptr(sdp->sd_lkstats, i);
1794 if (index == 0) { 1740
1795 value = i; 1741 if (index == 0)
1796 } else { 1742 seq_printf(seq, " %15u", i);
1797 value = lkstats->lkstats[index - 1].stats[subindex]; 1743 else
1798 } 1744 seq_printf(seq, " %15llu", (unsigned long long)lkstats->
1799 seq_printf(seq, " %15lld", (long long)value); 1745 lkstats[index - 1].stats[subindex]);
1800 } 1746 }
1801 seq_putc(seq, '\n'); 1747 seq_putc(seq, '\n');
1802 return 0; 1748 return 0;
@@ -1804,20 +1750,24 @@ static int gfs2_sbstats_seq_show(struct seq_file *seq, void *iter_ptr)
1804 1750
1805int __init gfs2_glock_init(void) 1751int __init gfs2_glock_init(void)
1806{ 1752{
1807 unsigned i; 1753 int ret;
1808 for(i = 0; i < GFS2_GL_HASH_SIZE; i++) { 1754
1809 INIT_HLIST_BL_HEAD(&gl_hash_table[i]); 1755 ret = rhashtable_init(&gl_hash_table, &ht_parms);
1810 } 1756 if (ret < 0)
1757 return ret;
1811 1758
1812 glock_workqueue = alloc_workqueue("glock_workqueue", WQ_MEM_RECLAIM | 1759 glock_workqueue = alloc_workqueue("glock_workqueue", WQ_MEM_RECLAIM |
1813 WQ_HIGHPRI | WQ_FREEZABLE, 0); 1760 WQ_HIGHPRI | WQ_FREEZABLE, 0);
1814 if (!glock_workqueue) 1761 if (!glock_workqueue) {
1762 rhashtable_destroy(&gl_hash_table);
1815 return -ENOMEM; 1763 return -ENOMEM;
1764 }
1816 gfs2_delete_workqueue = alloc_workqueue("delete_workqueue", 1765 gfs2_delete_workqueue = alloc_workqueue("delete_workqueue",
1817 WQ_MEM_RECLAIM | WQ_FREEZABLE, 1766 WQ_MEM_RECLAIM | WQ_FREEZABLE,
1818 0); 1767 0);
1819 if (!gfs2_delete_workqueue) { 1768 if (!gfs2_delete_workqueue) {
1820 destroy_workqueue(glock_workqueue); 1769 destroy_workqueue(glock_workqueue);
1770 rhashtable_destroy(&gl_hash_table);
1821 return -ENOMEM; 1771 return -ENOMEM;
1822 } 1772 }
1823 1773
@@ -1829,72 +1779,41 @@ int __init gfs2_glock_init(void)
1829void gfs2_glock_exit(void) 1779void gfs2_glock_exit(void)
1830{ 1780{
1831 unregister_shrinker(&glock_shrinker); 1781 unregister_shrinker(&glock_shrinker);
1782 rhashtable_destroy(&gl_hash_table);
1832 destroy_workqueue(glock_workqueue); 1783 destroy_workqueue(glock_workqueue);
1833 destroy_workqueue(gfs2_delete_workqueue); 1784 destroy_workqueue(gfs2_delete_workqueue);
1834} 1785}
1835 1786
1836static inline struct gfs2_glock *glock_hash_chain(unsigned hash) 1787static void gfs2_glock_iter_next(struct gfs2_glock_iter *gi)
1837{ 1788{
1838 return hlist_bl_entry(hlist_bl_first_rcu(&gl_hash_table[hash]),
1839 struct gfs2_glock, gl_list);
1840}
1841
1842static inline struct gfs2_glock *glock_hash_next(struct gfs2_glock *gl)
1843{
1844 return hlist_bl_entry(rcu_dereference(gl->gl_list.next),
1845 struct gfs2_glock, gl_list);
1846}
1847
1848static int gfs2_glock_iter_next(struct gfs2_glock_iter *gi)
1849{
1850 struct gfs2_glock *gl;
1851
1852 do { 1789 do {
1853 gl = gi->gl; 1790 gi->gl = rhashtable_walk_next(&gi->hti);
1854 if (gl) { 1791 if (IS_ERR(gi->gl)) {
1855 gi->gl = glock_hash_next(gl); 1792 if (PTR_ERR(gi->gl) == -EAGAIN)
1856 gi->nhash++; 1793 continue;
1857 } else { 1794 gi->gl = NULL;
1858 if (gi->hash >= GFS2_GL_HASH_SIZE) {
1859 rcu_read_unlock();
1860 return 1;
1861 }
1862 gi->gl = glock_hash_chain(gi->hash);
1863 gi->nhash = 0;
1864 }
1865 while (gi->gl == NULL) {
1866 gi->hash++;
1867 if (gi->hash >= GFS2_GL_HASH_SIZE) {
1868 rcu_read_unlock();
1869 return 1;
1870 }
1871 gi->gl = glock_hash_chain(gi->hash);
1872 gi->nhash = 0;
1873 } 1795 }
1874 /* Skip entries for other sb and dead entries */ 1796 /* Skip entries for other sb and dead entries */
1875 } while (gi->sdp != gi->gl->gl_sbd || 1797 } while ((gi->gl) && ((gi->sdp != gi->gl->gl_name.ln_sbd) ||
1876 __lockref_is_dead(&gi->gl->gl_lockref)); 1798 __lockref_is_dead(&gi->gl->gl_lockref)));
1877
1878 return 0;
1879} 1799}
1880 1800
1881static void *gfs2_glock_seq_start(struct seq_file *seq, loff_t *pos) 1801static void *gfs2_glock_seq_start(struct seq_file *seq, loff_t *pos)
1882{ 1802{
1883 struct gfs2_glock_iter *gi = seq->private; 1803 struct gfs2_glock_iter *gi = seq->private;
1884 loff_t n = *pos; 1804 loff_t n = *pos;
1805 int ret;
1885 1806
1886 if (gi->last_pos <= *pos) 1807 if (gi->last_pos <= *pos)
1887 n = gi->nhash + (*pos - gi->last_pos); 1808 n = (*pos - gi->last_pos);
1888 else
1889 gi->hash = 0;
1890 1809
1891 gi->nhash = 0; 1810 ret = rhashtable_walk_start(&gi->hti);
1892 rcu_read_lock(); 1811 if (ret)
1812 return NULL;
1893 1813
1894 do { 1814 do {
1895 if (gfs2_glock_iter_next(gi)) 1815 gfs2_glock_iter_next(gi);
1896 return NULL; 1816 } while (gi->gl && n--);
1897 } while (n--);
1898 1817
1899 gi->last_pos = *pos; 1818 gi->last_pos = *pos;
1900 return gi->gl; 1819 return gi->gl;
@@ -1907,9 +1826,7 @@ static void *gfs2_glock_seq_next(struct seq_file *seq, void *iter_ptr,
1907 1826
1908 (*pos)++; 1827 (*pos)++;
1909 gi->last_pos = *pos; 1828 gi->last_pos = *pos;
1910 if (gfs2_glock_iter_next(gi)) 1829 gfs2_glock_iter_next(gi);
1911 return NULL;
1912
1913 return gi->gl; 1830 return gi->gl;
1914} 1831}
1915 1832
@@ -1917,9 +1834,8 @@ static void gfs2_glock_seq_stop(struct seq_file *seq, void *iter_ptr)
1917{ 1834{
1918 struct gfs2_glock_iter *gi = seq->private; 1835 struct gfs2_glock_iter *gi = seq->private;
1919 1836
1920 if (gi->gl)
1921 rcu_read_unlock();
1922 gi->gl = NULL; 1837 gi->gl = NULL;
1838 rhashtable_walk_stop(&gi->hti);
1923} 1839}
1924 1840
1925static int gfs2_glock_seq_show(struct seq_file *seq, void *iter_ptr) 1841static int gfs2_glock_seq_show(struct seq_file *seq, void *iter_ptr)
@@ -1930,26 +1846,19 @@ static int gfs2_glock_seq_show(struct seq_file *seq, void *iter_ptr)
1930 1846
1931static void *gfs2_sbstats_seq_start(struct seq_file *seq, loff_t *pos) 1847static void *gfs2_sbstats_seq_start(struct seq_file *seq, loff_t *pos)
1932{ 1848{
1933 struct gfs2_glock_iter *gi = seq->private; 1849 preempt_disable();
1934
1935 gi->hash = *pos;
1936 if (*pos >= GFS2_NR_SBSTATS) 1850 if (*pos >= GFS2_NR_SBSTATS)
1937 return NULL; 1851 return NULL;
1938 preempt_disable(); 1852 return pos;
1939 return SEQ_START_TOKEN;
1940} 1853}
1941 1854
1942static void *gfs2_sbstats_seq_next(struct seq_file *seq, void *iter_ptr, 1855static void *gfs2_sbstats_seq_next(struct seq_file *seq, void *iter_ptr,
1943 loff_t *pos) 1856 loff_t *pos)
1944{ 1857{
1945 struct gfs2_glock_iter *gi = seq->private;
1946 (*pos)++; 1858 (*pos)++;
1947 gi->hash++; 1859 if (*pos >= GFS2_NR_SBSTATS)
1948 if (gi->hash >= GFS2_NR_SBSTATS) {
1949 preempt_enable();
1950 return NULL; 1860 return NULL;
1951 } 1861 return pos;
1952 return SEQ_START_TOKEN;
1953} 1862}
1954 1863
1955static void gfs2_sbstats_seq_stop(struct seq_file *seq, void *iter_ptr) 1864static void gfs2_sbstats_seq_stop(struct seq_file *seq, void *iter_ptr)
@@ -1987,14 +1896,28 @@ static int gfs2_glocks_open(struct inode *inode, struct file *file)
1987 if (ret == 0) { 1896 if (ret == 0) {
1988 struct seq_file *seq = file->private_data; 1897 struct seq_file *seq = file->private_data;
1989 struct gfs2_glock_iter *gi = seq->private; 1898 struct gfs2_glock_iter *gi = seq->private;
1899
1990 gi->sdp = inode->i_private; 1900 gi->sdp = inode->i_private;
1901 gi->last_pos = 0;
1991 seq->buf = kmalloc(GFS2_SEQ_GOODSIZE, GFP_KERNEL | __GFP_NOWARN); 1902 seq->buf = kmalloc(GFS2_SEQ_GOODSIZE, GFP_KERNEL | __GFP_NOWARN);
1992 if (seq->buf) 1903 if (seq->buf)
1993 seq->size = GFS2_SEQ_GOODSIZE; 1904 seq->size = GFS2_SEQ_GOODSIZE;
1905 gi->gl = NULL;
1906 ret = rhashtable_walk_init(&gl_hash_table, &gi->hti);
1994 } 1907 }
1995 return ret; 1908 return ret;
1996} 1909}
1997 1910
1911static int gfs2_glocks_release(struct inode *inode, struct file *file)
1912{
1913 struct seq_file *seq = file->private_data;
1914 struct gfs2_glock_iter *gi = seq->private;
1915
1916 gi->gl = NULL;
1917 rhashtable_walk_exit(&gi->hti);
1918 return seq_release_private(inode, file);
1919}
1920
1998static int gfs2_glstats_open(struct inode *inode, struct file *file) 1921static int gfs2_glstats_open(struct inode *inode, struct file *file)
1999{ 1922{
2000 int ret = seq_open_private(file, &gfs2_glstats_seq_ops, 1923 int ret = seq_open_private(file, &gfs2_glstats_seq_ops,
@@ -2003,21 +1926,22 @@ static int gfs2_glstats_open(struct inode *inode, struct file *file)
2003 struct seq_file *seq = file->private_data; 1926 struct seq_file *seq = file->private_data;
2004 struct gfs2_glock_iter *gi = seq->private; 1927 struct gfs2_glock_iter *gi = seq->private;
2005 gi->sdp = inode->i_private; 1928 gi->sdp = inode->i_private;
1929 gi->last_pos = 0;
2006 seq->buf = kmalloc(GFS2_SEQ_GOODSIZE, GFP_KERNEL | __GFP_NOWARN); 1930 seq->buf = kmalloc(GFS2_SEQ_GOODSIZE, GFP_KERNEL | __GFP_NOWARN);
2007 if (seq->buf) 1931 if (seq->buf)
2008 seq->size = GFS2_SEQ_GOODSIZE; 1932 seq->size = GFS2_SEQ_GOODSIZE;
1933 gi->gl = NULL;
1934 ret = rhashtable_walk_init(&gl_hash_table, &gi->hti);
2009 } 1935 }
2010 return ret; 1936 return ret;
2011} 1937}
2012 1938
2013static int gfs2_sbstats_open(struct inode *inode, struct file *file) 1939static int gfs2_sbstats_open(struct inode *inode, struct file *file)
2014{ 1940{
2015 int ret = seq_open_private(file, &gfs2_sbstats_seq_ops, 1941 int ret = seq_open(file, &gfs2_sbstats_seq_ops);
2016 sizeof(struct gfs2_glock_iter));
2017 if (ret == 0) { 1942 if (ret == 0) {
2018 struct seq_file *seq = file->private_data; 1943 struct seq_file *seq = file->private_data;
2019 struct gfs2_glock_iter *gi = seq->private; 1944 seq->private = inode->i_private; /* sdp */
2020 gi->sdp = inode->i_private;
2021 } 1945 }
2022 return ret; 1946 return ret;
2023} 1947}
@@ -2027,7 +1951,7 @@ static const struct file_operations gfs2_glocks_fops = {
2027 .open = gfs2_glocks_open, 1951 .open = gfs2_glocks_open,
2028 .read = seq_read, 1952 .read = seq_read,
2029 .llseek = seq_lseek, 1953 .llseek = seq_lseek,
2030 .release = seq_release_private, 1954 .release = gfs2_glocks_release,
2031}; 1955};
2032 1956
2033static const struct file_operations gfs2_glstats_fops = { 1957static const struct file_operations gfs2_glstats_fops = {
@@ -2035,7 +1959,7 @@ static const struct file_operations gfs2_glstats_fops = {
2035 .open = gfs2_glstats_open, 1959 .open = gfs2_glstats_open,
2036 .read = seq_read, 1960 .read = seq_read,
2037 .llseek = seq_lseek, 1961 .llseek = seq_lseek,
2038 .release = seq_release_private, 1962 .release = gfs2_glocks_release,
2039}; 1963};
2040 1964
2041static const struct file_operations gfs2_sbstats_fops = { 1965static const struct file_operations gfs2_sbstats_fops = {
@@ -2043,7 +1967,7 @@ static const struct file_operations gfs2_sbstats_fops = {
2043 .open = gfs2_sbstats_open, 1967 .open = gfs2_sbstats_open,
2044 .read = seq_read, 1968 .read = seq_read,
2045 .llseek = seq_lseek, 1969 .llseek = seq_lseek,
2046 .release = seq_release_private, 1970 .release = seq_release,
2047}; 1971};
2048 1972
2049int gfs2_create_debugfs_file(struct gfs2_sbd *sdp) 1973int gfs2_create_debugfs_file(struct gfs2_sbd *sdp)
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index fa3fa5e94553..1f6c9c3fe5cb 100644
--- a/fs/gfs2/glops.c
+++ b/fs/gfs2/glops.c
@@ -32,13 +32,15 @@ struct workqueue_struct *gfs2_freeze_wq;
32 32
33static void gfs2_ail_error(struct gfs2_glock *gl, const struct buffer_head *bh) 33static void gfs2_ail_error(struct gfs2_glock *gl, const struct buffer_head *bh)
34{ 34{
35 fs_err(gl->gl_sbd, "AIL buffer %p: blocknr %llu state 0x%08lx mapping %p page state 0x%lx\n", 35 fs_err(gl->gl_name.ln_sbd,
36 "AIL buffer %p: blocknr %llu state 0x%08lx mapping %p page "
37 "state 0x%lx\n",
36 bh, (unsigned long long)bh->b_blocknr, bh->b_state, 38 bh, (unsigned long long)bh->b_blocknr, bh->b_state,
37 bh->b_page->mapping, bh->b_page->flags); 39 bh->b_page->mapping, bh->b_page->flags);
38 fs_err(gl->gl_sbd, "AIL glock %u:%llu mapping %p\n", 40 fs_err(gl->gl_name.ln_sbd, "AIL glock %u:%llu mapping %p\n",
39 gl->gl_name.ln_type, gl->gl_name.ln_number, 41 gl->gl_name.ln_type, gl->gl_name.ln_number,
40 gfs2_glock2aspace(gl)); 42 gfs2_glock2aspace(gl));
41 gfs2_lm_withdraw(gl->gl_sbd, "AIL error\n"); 43 gfs2_lm_withdraw(gl->gl_name.ln_sbd, "AIL error\n");
42} 44}
43 45
44/** 46/**
@@ -52,7 +54,7 @@ static void gfs2_ail_error(struct gfs2_glock *gl, const struct buffer_head *bh)
52static void __gfs2_ail_flush(struct gfs2_glock *gl, bool fsync, 54static void __gfs2_ail_flush(struct gfs2_glock *gl, bool fsync,
53 unsigned int nr_revokes) 55 unsigned int nr_revokes)
54{ 56{
55 struct gfs2_sbd *sdp = gl->gl_sbd; 57 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
56 struct list_head *head = &gl->gl_ail_list; 58 struct list_head *head = &gl->gl_ail_list;
57 struct gfs2_bufdata *bd, *tmp; 59 struct gfs2_bufdata *bd, *tmp;
58 struct buffer_head *bh; 60 struct buffer_head *bh;
@@ -80,7 +82,7 @@ static void __gfs2_ail_flush(struct gfs2_glock *gl, bool fsync,
80 82
81static void gfs2_ail_empty_gl(struct gfs2_glock *gl) 83static void gfs2_ail_empty_gl(struct gfs2_glock *gl)
82{ 84{
83 struct gfs2_sbd *sdp = gl->gl_sbd; 85 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
84 struct gfs2_trans tr; 86 struct gfs2_trans tr;
85 87
86 memset(&tr, 0, sizeof(tr)); 88 memset(&tr, 0, sizeof(tr));
@@ -109,7 +111,7 @@ static void gfs2_ail_empty_gl(struct gfs2_glock *gl)
109 111
110void gfs2_ail_flush(struct gfs2_glock *gl, bool fsync) 112void gfs2_ail_flush(struct gfs2_glock *gl, bool fsync)
111{ 113{
112 struct gfs2_sbd *sdp = gl->gl_sbd; 114 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
113 unsigned int revokes = atomic_read(&gl->gl_ail_count); 115 unsigned int revokes = atomic_read(&gl->gl_ail_count);
114 unsigned int max_revokes = (sdp->sd_sb.sb_bsize - sizeof(struct gfs2_log_descriptor)) / sizeof(u64); 116 unsigned int max_revokes = (sdp->sd_sb.sb_bsize - sizeof(struct gfs2_log_descriptor)) / sizeof(u64);
115 int ret; 117 int ret;
@@ -139,7 +141,7 @@ void gfs2_ail_flush(struct gfs2_glock *gl, bool fsync)
139 141
140static void rgrp_go_sync(struct gfs2_glock *gl) 142static void rgrp_go_sync(struct gfs2_glock *gl)
141{ 143{
142 struct gfs2_sbd *sdp = gl->gl_sbd; 144 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
143 struct address_space *mapping = &sdp->sd_aspace; 145 struct address_space *mapping = &sdp->sd_aspace;
144 struct gfs2_rgrpd *rgd; 146 struct gfs2_rgrpd *rgd;
145 int error; 147 int error;
@@ -179,7 +181,7 @@ static void rgrp_go_sync(struct gfs2_glock *gl)
179 181
180static void rgrp_go_inval(struct gfs2_glock *gl, int flags) 182static void rgrp_go_inval(struct gfs2_glock *gl, int flags)
181{ 183{
182 struct gfs2_sbd *sdp = gl->gl_sbd; 184 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
183 struct address_space *mapping = &sdp->sd_aspace; 185 struct address_space *mapping = &sdp->sd_aspace;
184 struct gfs2_rgrpd *rgd = gl->gl_object; 186 struct gfs2_rgrpd *rgd = gl->gl_object;
185 187
@@ -218,7 +220,7 @@ static void inode_go_sync(struct gfs2_glock *gl)
218 220
219 GLOCK_BUG_ON(gl, gl->gl_state != LM_ST_EXCLUSIVE); 221 GLOCK_BUG_ON(gl, gl->gl_state != LM_ST_EXCLUSIVE);
220 222
221 gfs2_log_flush(gl->gl_sbd, gl, NORMAL_FLUSH); 223 gfs2_log_flush(gl->gl_name.ln_sbd, gl, NORMAL_FLUSH);
222 filemap_fdatawrite(metamapping); 224 filemap_fdatawrite(metamapping);
223 if (ip) { 225 if (ip) {
224 struct address_space *mapping = ip->i_inode.i_mapping; 226 struct address_space *mapping = ip->i_inode.i_mapping;
@@ -252,7 +254,7 @@ static void inode_go_inval(struct gfs2_glock *gl, int flags)
252{ 254{
253 struct gfs2_inode *ip = gl->gl_object; 255 struct gfs2_inode *ip = gl->gl_object;
254 256
255 gfs2_assert_withdraw(gl->gl_sbd, !atomic_read(&gl->gl_ail_count)); 257 gfs2_assert_withdraw(gl->gl_name.ln_sbd, !atomic_read(&gl->gl_ail_count));
256 258
257 if (flags & DIO_METADATA) { 259 if (flags & DIO_METADATA) {
258 struct address_space *mapping = gfs2_glock2aspace(gl); 260 struct address_space *mapping = gfs2_glock2aspace(gl);
@@ -264,9 +266,9 @@ static void inode_go_inval(struct gfs2_glock *gl, int flags)
264 } 266 }
265 } 267 }
266 268
267 if (ip == GFS2_I(gl->gl_sbd->sd_rindex)) { 269 if (ip == GFS2_I(gl->gl_name.ln_sbd->sd_rindex)) {
268 gfs2_log_flush(gl->gl_sbd, NULL, NORMAL_FLUSH); 270 gfs2_log_flush(gl->gl_name.ln_sbd, NULL, NORMAL_FLUSH);
269 gl->gl_sbd->sd_rindex_uptodate = 0; 271 gl->gl_name.ln_sbd->sd_rindex_uptodate = 0;
270 } 272 }
271 if (ip && S_ISREG(ip->i_inode.i_mode)) 273 if (ip && S_ISREG(ip->i_inode.i_mode))
272 truncate_inode_pages(ip->i_inode.i_mapping, 0); 274 truncate_inode_pages(ip->i_inode.i_mapping, 0);
@@ -281,7 +283,7 @@ static void inode_go_inval(struct gfs2_glock *gl, int flags)
281 283
282static int inode_go_demote_ok(const struct gfs2_glock *gl) 284static int inode_go_demote_ok(const struct gfs2_glock *gl)
283{ 285{
284 struct gfs2_sbd *sdp = gl->gl_sbd; 286 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
285 struct gfs2_holder *gh; 287 struct gfs2_holder *gh;
286 288
287 if (sdp->sd_jindex == gl->gl_object || sdp->sd_rindex == gl->gl_object) 289 if (sdp->sd_jindex == gl->gl_object || sdp->sd_rindex == gl->gl_object)
@@ -416,7 +418,7 @@ int gfs2_inode_refresh(struct gfs2_inode *ip)
416static int inode_go_lock(struct gfs2_holder *gh) 418static int inode_go_lock(struct gfs2_holder *gh)
417{ 419{
418 struct gfs2_glock *gl = gh->gh_gl; 420 struct gfs2_glock *gl = gh->gh_gl;
419 struct gfs2_sbd *sdp = gl->gl_sbd; 421 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
420 struct gfs2_inode *ip = gl->gl_object; 422 struct gfs2_inode *ip = gl->gl_object;
421 int error = 0; 423 int error = 0;
422 424
@@ -477,7 +479,7 @@ static void inode_go_dump(struct seq_file *seq, const struct gfs2_glock *gl)
477static void freeze_go_sync(struct gfs2_glock *gl) 479static void freeze_go_sync(struct gfs2_glock *gl)
478{ 480{
479 int error = 0; 481 int error = 0;
480 struct gfs2_sbd *sdp = gl->gl_sbd; 482 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
481 483
482 if (gl->gl_state == LM_ST_SHARED && 484 if (gl->gl_state == LM_ST_SHARED &&
483 test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) { 485 test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) {
@@ -500,7 +502,7 @@ static void freeze_go_sync(struct gfs2_glock *gl)
500 502
501static int freeze_go_xmote_bh(struct gfs2_glock *gl, struct gfs2_holder *gh) 503static int freeze_go_xmote_bh(struct gfs2_glock *gl, struct gfs2_holder *gh)
502{ 504{
503 struct gfs2_sbd *sdp = gl->gl_sbd; 505 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
504 struct gfs2_inode *ip = GFS2_I(sdp->sd_jdesc->jd_inode); 506 struct gfs2_inode *ip = GFS2_I(sdp->sd_jdesc->jd_inode);
505 struct gfs2_glock *j_gl = ip->i_gl; 507 struct gfs2_glock *j_gl = ip->i_gl;
506 struct gfs2_log_header_host head; 508 struct gfs2_log_header_host head;
@@ -545,7 +547,7 @@ static int freeze_go_demote_ok(const struct gfs2_glock *gl)
545static void iopen_go_callback(struct gfs2_glock *gl, bool remote) 547static void iopen_go_callback(struct gfs2_glock *gl, bool remote)
546{ 548{
547 struct gfs2_inode *ip = (struct gfs2_inode *)gl->gl_object; 549 struct gfs2_inode *ip = (struct gfs2_inode *)gl->gl_object;
548 struct gfs2_sbd *sdp = gl->gl_sbd; 550 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
549 551
550 if (!remote || (sdp->sd_vfs->s_flags & MS_RDONLY)) 552 if (!remote || (sdp->sd_vfs->s_flags & MS_RDONLY))
551 return; 553 return;
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index a1ec7c20e498..121ed08d9d9f 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -22,6 +22,7 @@
22#include <linux/ktime.h> 22#include <linux/ktime.h>
23#include <linux/percpu.h> 23#include <linux/percpu.h>
24#include <linux/lockref.h> 24#include <linux/lockref.h>
25#include <linux/rhashtable.h>
25 26
26#define DIO_WAIT 0x00000010 27#define DIO_WAIT 0x00000010
27#define DIO_METADATA 0x00000020 28#define DIO_METADATA 0x00000020
@@ -203,13 +204,15 @@ enum {
203}; 204};
204 205
205struct lm_lockname { 206struct lm_lockname {
207 struct gfs2_sbd *ln_sbd;
206 u64 ln_number; 208 u64 ln_number;
207 unsigned int ln_type; 209 unsigned int ln_type;
208}; 210};
209 211
210#define lm_name_equal(name1, name2) \ 212#define lm_name_equal(name1, name2) \
211 (((name1)->ln_number == (name2)->ln_number) && \ 213 (((name1)->ln_number == (name2)->ln_number) && \
212 ((name1)->ln_type == (name2)->ln_type)) 214 ((name1)->ln_type == (name2)->ln_type) && \
215 ((name1)->ln_sbd == (name2)->ln_sbd))
213 216
214 217
215struct gfs2_glock_operations { 218struct gfs2_glock_operations {
@@ -241,7 +244,7 @@ enum {
241}; 244};
242 245
243struct gfs2_lkstats { 246struct gfs2_lkstats {
244 s64 stats[GFS2_NR_LKSTATS]; 247 u64 stats[GFS2_NR_LKSTATS];
245}; 248};
246 249
247enum { 250enum {
@@ -327,7 +330,6 @@ enum {
327 330
328struct gfs2_glock { 331struct gfs2_glock {
329 struct hlist_bl_node gl_list; 332 struct hlist_bl_node gl_list;
330 struct gfs2_sbd *gl_sbd;
331 unsigned long gl_flags; /* GLF_... */ 333 unsigned long gl_flags; /* GLF_... */
332 struct lm_lockname gl_name; 334 struct lm_lockname gl_name;
333 335
@@ -341,7 +343,6 @@ struct gfs2_glock {
341 gl_req:2, /* State in last dlm request */ 343 gl_req:2, /* State in last dlm request */
342 gl_reply:8; /* Last reply from the dlm */ 344 gl_reply:8; /* Last reply from the dlm */
343 345
344 unsigned int gl_hash;
345 unsigned long gl_demote_time; /* time of first demote request */ 346 unsigned long gl_demote_time; /* time of first demote request */
346 long gl_hold_time; 347 long gl_hold_time;
347 struct list_head gl_holders; 348 struct list_head gl_holders;
@@ -367,7 +368,7 @@ struct gfs2_glock {
367 loff_t end; 368 loff_t end;
368 } gl_vm; 369 } gl_vm;
369 }; 370 };
370 struct rcu_head gl_rcu; 371 struct rhash_head gl_node;
371}; 372};
372 373
373#define GFS2_MIN_LVB_SIZE 32 /* Min size of LVB that gfs2 supports */ 374#define GFS2_MIN_LVB_SIZE 32 /* Min size of LVB that gfs2 supports */
@@ -835,7 +836,7 @@ static inline void gfs2_glstats_inc(struct gfs2_glock *gl, int which)
835 836
836static inline void gfs2_sbstats_inc(const struct gfs2_glock *gl, int which) 837static inline void gfs2_sbstats_inc(const struct gfs2_glock *gl, int which)
837{ 838{
838 const struct gfs2_sbd *sdp = gl->gl_sbd; 839 const struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
839 preempt_disable(); 840 preempt_disable();
840 this_cpu_ptr(sdp->sd_lkstats)->lkstats[gl->gl_name.ln_type].stats[which]++; 841 this_cpu_ptr(sdp->sd_lkstats)->lkstats[gl->gl_name.ln_type].stats[which]++;
841 preempt_enable(); 842 preempt_enable();
diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c
index 641383a9c1bb..284c1542783e 100644
--- a/fs/gfs2/lock_dlm.c
+++ b/fs/gfs2/lock_dlm.c
@@ -31,7 +31,7 @@ extern struct workqueue_struct *gfs2_control_wq;
31 * 31 *
32 * @delta is the difference between the current rtt sample and the 32 * @delta is the difference between the current rtt sample and the
33 * running average srtt. We add 1/8 of that to the srtt in order to 33 * running average srtt. We add 1/8 of that to the srtt in order to
34 * update the current srtt estimate. The varience estimate is a bit 34 * update the current srtt estimate. The variance estimate is a bit
35 * more complicated. We subtract the abs value of the @delta from 35 * more complicated. We subtract the abs value of the @delta from
36 * the current variance estimate and add 1/4 of that to the running 36 * the current variance estimate and add 1/4 of that to the running
37 * total. 37 * total.
@@ -80,7 +80,7 @@ static inline void gfs2_update_reply_times(struct gfs2_glock *gl)
80 80
81 preempt_disable(); 81 preempt_disable();
82 rtt = ktime_to_ns(ktime_sub(ktime_get_real(), gl->gl_dstamp)); 82 rtt = ktime_to_ns(ktime_sub(ktime_get_real(), gl->gl_dstamp));
83 lks = this_cpu_ptr(gl->gl_sbd->sd_lkstats); 83 lks = this_cpu_ptr(gl->gl_name.ln_sbd->sd_lkstats);
84 gfs2_update_stats(&gl->gl_stats, index, rtt); /* Local */ 84 gfs2_update_stats(&gl->gl_stats, index, rtt); /* Local */
85 gfs2_update_stats(&lks->lkstats[gltype], index, rtt); /* Global */ 85 gfs2_update_stats(&lks->lkstats[gltype], index, rtt); /* Global */
86 preempt_enable(); 86 preempt_enable();
@@ -108,7 +108,7 @@ static inline void gfs2_update_request_times(struct gfs2_glock *gl)
108 dstamp = gl->gl_dstamp; 108 dstamp = gl->gl_dstamp;
109 gl->gl_dstamp = ktime_get_real(); 109 gl->gl_dstamp = ktime_get_real();
110 irt = ktime_to_ns(ktime_sub(gl->gl_dstamp, dstamp)); 110 irt = ktime_to_ns(ktime_sub(gl->gl_dstamp, dstamp));
111 lks = this_cpu_ptr(gl->gl_sbd->sd_lkstats); 111 lks = this_cpu_ptr(gl->gl_name.ln_sbd->sd_lkstats);
112 gfs2_update_stats(&gl->gl_stats, GFS2_LKS_SIRT, irt); /* Local */ 112 gfs2_update_stats(&gl->gl_stats, GFS2_LKS_SIRT, irt); /* Local */
113 gfs2_update_stats(&lks->lkstats[gltype], GFS2_LKS_SIRT, irt); /* Global */ 113 gfs2_update_stats(&lks->lkstats[gltype], GFS2_LKS_SIRT, irt); /* Global */
114 preempt_enable(); 114 preempt_enable();
@@ -253,7 +253,7 @@ static void gfs2_reverse_hex(char *c, u64 value)
253static int gdlm_lock(struct gfs2_glock *gl, unsigned int req_state, 253static int gdlm_lock(struct gfs2_glock *gl, unsigned int req_state,
254 unsigned int flags) 254 unsigned int flags)
255{ 255{
256 struct lm_lockstruct *ls = &gl->gl_sbd->sd_lockstruct; 256 struct lm_lockstruct *ls = &gl->gl_name.ln_sbd->sd_lockstruct;
257 int req; 257 int req;
258 u32 lkf; 258 u32 lkf;
259 char strname[GDLM_STRNAME_BYTES] = ""; 259 char strname[GDLM_STRNAME_BYTES] = "";
@@ -281,7 +281,7 @@ static int gdlm_lock(struct gfs2_glock *gl, unsigned int req_state,
281 281
282static void gdlm_put_lock(struct gfs2_glock *gl) 282static void gdlm_put_lock(struct gfs2_glock *gl)
283{ 283{
284 struct gfs2_sbd *sdp = gl->gl_sbd; 284 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
285 struct lm_lockstruct *ls = &sdp->sd_lockstruct; 285 struct lm_lockstruct *ls = &sdp->sd_lockstruct;
286 int lvb_needs_unlock = 0; 286 int lvb_needs_unlock = 0;
287 int error; 287 int error;
@@ -319,7 +319,7 @@ static void gdlm_put_lock(struct gfs2_glock *gl)
319 319
320static void gdlm_cancel(struct gfs2_glock *gl) 320static void gdlm_cancel(struct gfs2_glock *gl)
321{ 321{
322 struct lm_lockstruct *ls = &gl->gl_sbd->sd_lockstruct; 322 struct lm_lockstruct *ls = &gl->gl_name.ln_sbd->sd_lockstruct;
323 dlm_unlock(ls->ls_dlm, gl->gl_lksb.sb_lkid, DLM_LKF_CANCEL, NULL, gl); 323 dlm_unlock(ls->ls_dlm, gl->gl_lksb.sb_lkid, DLM_LKF_CANCEL, NULL, gl);
324} 324}
325 325
diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c
index 92324ac58290..d5369a109781 100644
--- a/fs/gfs2/lops.c
+++ b/fs/gfs2/lops.c
@@ -70,7 +70,7 @@ static bool buffer_is_rgrp(const struct gfs2_bufdata *bd)
70static void maybe_release_space(struct gfs2_bufdata *bd) 70static void maybe_release_space(struct gfs2_bufdata *bd)
71{ 71{
72 struct gfs2_glock *gl = bd->bd_gl; 72 struct gfs2_glock *gl = bd->bd_gl;
73 struct gfs2_sbd *sdp = gl->gl_sbd; 73 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
74 struct gfs2_rgrpd *rgd = gl->gl_object; 74 struct gfs2_rgrpd *rgd = gl->gl_object;
75 unsigned int index = bd->bd_bh->b_blocknr - gl->gl_name.ln_number; 75 unsigned int index = bd->bd_bh->b_blocknr - gl->gl_name.ln_number;
76 struct gfs2_bitmap *bi = rgd->rd_bits + index; 76 struct gfs2_bitmap *bi = rgd->rd_bits + index;
@@ -578,7 +578,7 @@ static int buf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
578static void gfs2_meta_sync(struct gfs2_glock *gl) 578static void gfs2_meta_sync(struct gfs2_glock *gl)
579{ 579{
580 struct address_space *mapping = gfs2_glock2aspace(gl); 580 struct address_space *mapping = gfs2_glock2aspace(gl);
581 struct gfs2_sbd *sdp = gl->gl_sbd; 581 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
582 int error; 582 int error;
583 583
584 if (mapping == NULL) 584 if (mapping == NULL)
@@ -588,7 +588,7 @@ static void gfs2_meta_sync(struct gfs2_glock *gl)
588 error = filemap_fdatawait(mapping); 588 error = filemap_fdatawait(mapping);
589 589
590 if (error) 590 if (error)
591 gfs2_io_error(gl->gl_sbd); 591 gfs2_io_error(gl->gl_name.ln_sbd);
592} 592}
593 593
594static void buf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass) 594static void buf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass)
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c
index b984a6e190bc..0e1d4be5865a 100644
--- a/fs/gfs2/meta_io.c
+++ b/fs/gfs2/meta_io.c
@@ -114,7 +114,7 @@ const struct address_space_operations gfs2_rgrp_aops = {
114struct buffer_head *gfs2_getbuf(struct gfs2_glock *gl, u64 blkno, int create) 114struct buffer_head *gfs2_getbuf(struct gfs2_glock *gl, u64 blkno, int create)
115{ 115{
116 struct address_space *mapping = gfs2_glock2aspace(gl); 116 struct address_space *mapping = gfs2_glock2aspace(gl);
117 struct gfs2_sbd *sdp = gl->gl_sbd; 117 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
118 struct page *page; 118 struct page *page;
119 struct buffer_head *bh; 119 struct buffer_head *bh;
120 unsigned int shift; 120 unsigned int shift;
@@ -200,7 +200,7 @@ struct buffer_head *gfs2_meta_new(struct gfs2_glock *gl, u64 blkno)
200int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags, 200int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags,
201 struct buffer_head **bhp) 201 struct buffer_head **bhp)
202{ 202{
203 struct gfs2_sbd *sdp = gl->gl_sbd; 203 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
204 struct buffer_head *bh; 204 struct buffer_head *bh;
205 205
206 if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) { 206 if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) {
@@ -362,7 +362,7 @@ int gfs2_meta_indirect_buffer(struct gfs2_inode *ip, int height, u64 num,
362 362
363struct buffer_head *gfs2_meta_ra(struct gfs2_glock *gl, u64 dblock, u32 extlen) 363struct buffer_head *gfs2_meta_ra(struct gfs2_glock *gl, u64 dblock, u32 extlen)
364{ 364{
365 struct gfs2_sbd *sdp = gl->gl_sbd; 365 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
366 struct buffer_head *first_bh, *bh; 366 struct buffer_head *first_bh, *bh;
367 u32 max_ra = gfs2_tune_get(sdp, gt_max_readahead) >> 367 u32 max_ra = gfs2_tune_get(sdp, gt_max_readahead) >>
368 sdp->sd_sb.sb_bsize_shift; 368 sdp->sd_sb.sb_bsize_shift;
diff --git a/fs/gfs2/meta_io.h b/fs/gfs2/meta_io.h
index ac5d8027d335..8ca161567a93 100644
--- a/fs/gfs2/meta_io.h
+++ b/fs/gfs2/meta_io.h
@@ -44,7 +44,7 @@ static inline struct gfs2_sbd *gfs2_mapping2sbd(struct address_space *mapping)
44{ 44{
45 struct inode *inode = mapping->host; 45 struct inode *inode = mapping->host;
46 if (mapping->a_ops == &gfs2_meta_aops) 46 if (mapping->a_ops == &gfs2_meta_aops)
47 return (((struct gfs2_glock *)mapping) - 1)->gl_sbd; 47 return (((struct gfs2_glock *)mapping) - 1)->gl_name.ln_sbd;
48 else if (mapping->a_ops == &gfs2_rgrp_aops) 48 else if (mapping->a_ops == &gfs2_rgrp_aops)
49 return container_of(mapping, struct gfs2_sbd, sd_aspace); 49 return container_of(mapping, struct gfs2_sbd, sd_aspace);
50 else 50 else
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index 9b61f92fcfdf..3a31226531ea 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -119,7 +119,7 @@ static void gfs2_qd_dispose(struct list_head *list)
119 119
120 while (!list_empty(list)) { 120 while (!list_empty(list)) {
121 qd = list_entry(list->next, struct gfs2_quota_data, qd_lru); 121 qd = list_entry(list->next, struct gfs2_quota_data, qd_lru);
122 sdp = qd->qd_gl->gl_sbd; 122 sdp = qd->qd_gl->gl_name.ln_sbd;
123 123
124 list_del(&qd->qd_lru); 124 list_del(&qd->qd_lru);
125 125
@@ -302,7 +302,7 @@ static int qd_get(struct gfs2_sbd *sdp, struct kqid qid,
302 302
303static void qd_hold(struct gfs2_quota_data *qd) 303static void qd_hold(struct gfs2_quota_data *qd)
304{ 304{
305 struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd; 305 struct gfs2_sbd *sdp = qd->qd_gl->gl_name.ln_sbd;
306 gfs2_assert(sdp, !__lockref_is_dead(&qd->qd_lockref)); 306 gfs2_assert(sdp, !__lockref_is_dead(&qd->qd_lockref));
307 lockref_get(&qd->qd_lockref); 307 lockref_get(&qd->qd_lockref);
308} 308}
@@ -367,7 +367,7 @@ static void slot_put(struct gfs2_quota_data *qd)
367 367
368static int bh_get(struct gfs2_quota_data *qd) 368static int bh_get(struct gfs2_quota_data *qd)
369{ 369{
370 struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd; 370 struct gfs2_sbd *sdp = qd->qd_gl->gl_name.ln_sbd;
371 struct gfs2_inode *ip = GFS2_I(sdp->sd_qc_inode); 371 struct gfs2_inode *ip = GFS2_I(sdp->sd_qc_inode);
372 unsigned int block, offset; 372 unsigned int block, offset;
373 struct buffer_head *bh; 373 struct buffer_head *bh;
@@ -414,7 +414,7 @@ fail:
414 414
415static void bh_put(struct gfs2_quota_data *qd) 415static void bh_put(struct gfs2_quota_data *qd)
416{ 416{
417 struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd; 417 struct gfs2_sbd *sdp = qd->qd_gl->gl_name.ln_sbd;
418 418
419 mutex_lock(&sdp->sd_quota_mutex); 419 mutex_lock(&sdp->sd_quota_mutex);
420 gfs2_assert(sdp, qd->qd_bh_count); 420 gfs2_assert(sdp, qd->qd_bh_count);
@@ -486,7 +486,7 @@ static int qd_fish(struct gfs2_sbd *sdp, struct gfs2_quota_data **qdp)
486 486
487static void qd_unlock(struct gfs2_quota_data *qd) 487static void qd_unlock(struct gfs2_quota_data *qd)
488{ 488{
489 gfs2_assert_warn(qd->qd_gl->gl_sbd, 489 gfs2_assert_warn(qd->qd_gl->gl_name.ln_sbd,
490 test_bit(QDF_LOCKED, &qd->qd_flags)); 490 test_bit(QDF_LOCKED, &qd->qd_flags));
491 clear_bit(QDF_LOCKED, &qd->qd_flags); 491 clear_bit(QDF_LOCKED, &qd->qd_flags);
492 bh_put(qd); 492 bh_put(qd);
@@ -614,7 +614,7 @@ static int sort_qd(const void *a, const void *b)
614 614
615static void do_qc(struct gfs2_quota_data *qd, s64 change) 615static void do_qc(struct gfs2_quota_data *qd, s64 change)
616{ 616{
617 struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd; 617 struct gfs2_sbd *sdp = qd->qd_gl->gl_name.ln_sbd;
618 struct gfs2_inode *ip = GFS2_I(sdp->sd_qc_inode); 618 struct gfs2_inode *ip = GFS2_I(sdp->sd_qc_inode);
619 struct gfs2_quota_change *qc = qd->qd_bh_qc; 619 struct gfs2_quota_change *qc = qd->qd_bh_qc;
620 s64 x; 620 s64 x;
@@ -831,7 +831,7 @@ static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc,
831 831
832static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda) 832static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda)
833{ 833{
834 struct gfs2_sbd *sdp = (*qda)->qd_gl->gl_sbd; 834 struct gfs2_sbd *sdp = (*qda)->qd_gl->gl_name.ln_sbd;
835 struct gfs2_inode *ip = GFS2_I(sdp->sd_quota_inode); 835 struct gfs2_inode *ip = GFS2_I(sdp->sd_quota_inode);
836 struct gfs2_alloc_parms ap = { .aflags = 0, }; 836 struct gfs2_alloc_parms ap = { .aflags = 0, };
837 unsigned int data_blocks, ind_blocks; 837 unsigned int data_blocks, ind_blocks;
@@ -922,7 +922,7 @@ out:
922 gfs2_glock_dq_uninit(&ghs[qx]); 922 gfs2_glock_dq_uninit(&ghs[qx]);
923 mutex_unlock(&ip->i_inode.i_mutex); 923 mutex_unlock(&ip->i_inode.i_mutex);
924 kfree(ghs); 924 kfree(ghs);
925 gfs2_log_flush(ip->i_gl->gl_sbd, ip->i_gl, NORMAL_FLUSH); 925 gfs2_log_flush(ip->i_gl->gl_name.ln_sbd, ip->i_gl, NORMAL_FLUSH);
926 return error; 926 return error;
927} 927}
928 928
@@ -954,7 +954,7 @@ static int update_qd(struct gfs2_sbd *sdp, struct gfs2_quota_data *qd)
954static int do_glock(struct gfs2_quota_data *qd, int force_refresh, 954static int do_glock(struct gfs2_quota_data *qd, int force_refresh,
955 struct gfs2_holder *q_gh) 955 struct gfs2_holder *q_gh)
956{ 956{
957 struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd; 957 struct gfs2_sbd *sdp = qd->qd_gl->gl_name.ln_sbd;
958 struct gfs2_inode *ip = GFS2_I(sdp->sd_quota_inode); 958 struct gfs2_inode *ip = GFS2_I(sdp->sd_quota_inode);
959 struct gfs2_holder i_gh; 959 struct gfs2_holder i_gh;
960 int error; 960 int error;
@@ -1037,7 +1037,7 @@ int gfs2_quota_lock(struct gfs2_inode *ip, kuid_t uid, kgid_t gid)
1037 1037
1038static int need_sync(struct gfs2_quota_data *qd) 1038static int need_sync(struct gfs2_quota_data *qd)
1039{ 1039{
1040 struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd; 1040 struct gfs2_sbd *sdp = qd->qd_gl->gl_name.ln_sbd;
1041 struct gfs2_tune *gt = &sdp->sd_tune; 1041 struct gfs2_tune *gt = &sdp->sd_tune;
1042 s64 value; 1042 s64 value;
1043 unsigned int num, den; 1043 unsigned int num, den;
@@ -1125,7 +1125,7 @@ out:
1125 1125
1126static int print_message(struct gfs2_quota_data *qd, char *type) 1126static int print_message(struct gfs2_quota_data *qd, char *type)
1127{ 1127{
1128 struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd; 1128 struct gfs2_sbd *sdp = qd->qd_gl->gl_name.ln_sbd;
1129 1129
1130 fs_info(sdp, "quota %s for %s %u\n", 1130 fs_info(sdp, "quota %s for %s %u\n",
1131 type, 1131 type,
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index c6c62321dfd6..475985d14758 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -1860,13 +1860,13 @@ static void try_rgrp_unlink(struct gfs2_rgrpd *rgd, u64 *last_unlinked, u64 skip
1860static bool gfs2_rgrp_congested(const struct gfs2_rgrpd *rgd, int loops) 1860static bool gfs2_rgrp_congested(const struct gfs2_rgrpd *rgd, int loops)
1861{ 1861{
1862 const struct gfs2_glock *gl = rgd->rd_gl; 1862 const struct gfs2_glock *gl = rgd->rd_gl;
1863 const struct gfs2_sbd *sdp = gl->gl_sbd; 1863 const struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
1864 struct gfs2_lkstats *st; 1864 struct gfs2_lkstats *st;
1865 s64 r_dcount, l_dcount; 1865 u64 r_dcount, l_dcount;
1866 s64 l_srttb, a_srttb = 0; 1866 u64 l_srttb, a_srttb = 0;
1867 s64 srttb_diff; 1867 s64 srttb_diff;
1868 s64 sqr_diff; 1868 u64 sqr_diff;
1869 s64 var; 1869 u64 var;
1870 int cpu, nonzero = 0; 1870 int cpu, nonzero = 0;
1871 1871
1872 preempt_disable(); 1872 preempt_disable();
diff --git a/fs/gfs2/trace_gfs2.h b/fs/gfs2/trace_gfs2.h
index 20c007d747ab..49ac55da4e33 100644
--- a/fs/gfs2/trace_gfs2.h
+++ b/fs/gfs2/trace_gfs2.h
@@ -104,7 +104,7 @@ TRACE_EVENT(gfs2_glock_state_change,
104 ), 104 ),
105 105
106 TP_fast_assign( 106 TP_fast_assign(
107 __entry->dev = gl->gl_sbd->sd_vfs->s_dev; 107 __entry->dev = gl->gl_name.ln_sbd->sd_vfs->s_dev;
108 __entry->glnum = gl->gl_name.ln_number; 108 __entry->glnum = gl->gl_name.ln_number;
109 __entry->gltype = gl->gl_name.ln_type; 109 __entry->gltype = gl->gl_name.ln_type;
110 __entry->cur_state = glock_trace_state(gl->gl_state); 110 __entry->cur_state = glock_trace_state(gl->gl_state);
@@ -140,7 +140,7 @@ TRACE_EVENT(gfs2_glock_put,
140 ), 140 ),
141 141
142 TP_fast_assign( 142 TP_fast_assign(
143 __entry->dev = gl->gl_sbd->sd_vfs->s_dev; 143 __entry->dev = gl->gl_name.ln_sbd->sd_vfs->s_dev;
144 __entry->gltype = gl->gl_name.ln_type; 144 __entry->gltype = gl->gl_name.ln_type;
145 __entry->glnum = gl->gl_name.ln_number; 145 __entry->glnum = gl->gl_name.ln_number;
146 __entry->cur_state = glock_trace_state(gl->gl_state); 146 __entry->cur_state = glock_trace_state(gl->gl_state);
@@ -174,7 +174,7 @@ TRACE_EVENT(gfs2_demote_rq,
174 ), 174 ),
175 175
176 TP_fast_assign( 176 TP_fast_assign(
177 __entry->dev = gl->gl_sbd->sd_vfs->s_dev; 177 __entry->dev = gl->gl_name.ln_sbd->sd_vfs->s_dev;
178 __entry->gltype = gl->gl_name.ln_type; 178 __entry->gltype = gl->gl_name.ln_type;
179 __entry->glnum = gl->gl_name.ln_number; 179 __entry->glnum = gl->gl_name.ln_number;
180 __entry->cur_state = glock_trace_state(gl->gl_state); 180 __entry->cur_state = glock_trace_state(gl->gl_state);
@@ -209,7 +209,7 @@ TRACE_EVENT(gfs2_promote,
209 ), 209 ),
210 210
211 TP_fast_assign( 211 TP_fast_assign(
212 __entry->dev = gh->gh_gl->gl_sbd->sd_vfs->s_dev; 212 __entry->dev = gh->gh_gl->gl_name.ln_sbd->sd_vfs->s_dev;
213 __entry->glnum = gh->gh_gl->gl_name.ln_number; 213 __entry->glnum = gh->gh_gl->gl_name.ln_number;
214 __entry->gltype = gh->gh_gl->gl_name.ln_type; 214 __entry->gltype = gh->gh_gl->gl_name.ln_type;
215 __entry->first = first; 215 __entry->first = first;
@@ -239,7 +239,7 @@ TRACE_EVENT(gfs2_glock_queue,
239 ), 239 ),
240 240
241 TP_fast_assign( 241 TP_fast_assign(
242 __entry->dev = gh->gh_gl->gl_sbd->sd_vfs->s_dev; 242 __entry->dev = gh->gh_gl->gl_name.ln_sbd->sd_vfs->s_dev;
243 __entry->glnum = gh->gh_gl->gl_name.ln_number; 243 __entry->glnum = gh->gh_gl->gl_name.ln_number;
244 __entry->gltype = gh->gh_gl->gl_name.ln_type; 244 __entry->gltype = gh->gh_gl->gl_name.ln_type;
245 __entry->queue = queue; 245 __entry->queue = queue;
@@ -267,18 +267,18 @@ TRACE_EVENT(gfs2_glock_lock_time,
267 __field( int, status ) 267 __field( int, status )
268 __field( char, flags ) 268 __field( char, flags )
269 __field( s64, tdiff ) 269 __field( s64, tdiff )
270 __field( s64, srtt ) 270 __field( u64, srtt )
271 __field( s64, srttvar ) 271 __field( u64, srttvar )
272 __field( s64, srttb ) 272 __field( u64, srttb )
273 __field( s64, srttvarb ) 273 __field( u64, srttvarb )
274 __field( s64, sirt ) 274 __field( u64, sirt )
275 __field( s64, sirtvar ) 275 __field( u64, sirtvar )
276 __field( s64, dcount ) 276 __field( u64, dcount )
277 __field( s64, qcount ) 277 __field( u64, qcount )
278 ), 278 ),
279 279
280 TP_fast_assign( 280 TP_fast_assign(
281 __entry->dev = gl->gl_sbd->sd_vfs->s_dev; 281 __entry->dev = gl->gl_name.ln_sbd->sd_vfs->s_dev;
282 __entry->glnum = gl->gl_name.ln_number; 282 __entry->glnum = gl->gl_name.ln_number;
283 __entry->gltype = gl->gl_name.ln_type; 283 __entry->gltype = gl->gl_name.ln_type;
284 __entry->status = gl->gl_lksb.sb_status; 284 __entry->status = gl->gl_lksb.sb_status;
@@ -333,7 +333,7 @@ TRACE_EVENT(gfs2_pin,
333 ), 333 ),
334 334
335 TP_fast_assign( 335 TP_fast_assign(
336 __entry->dev = bd->bd_gl->gl_sbd->sd_vfs->s_dev; 336 __entry->dev = bd->bd_gl->gl_name.ln_sbd->sd_vfs->s_dev;
337 __entry->pin = pin; 337 __entry->pin = pin;
338 __entry->len = bd->bd_bh->b_size; 338 __entry->len = bd->bd_bh->b_size;
339 __entry->block = bd->bd_bh->b_blocknr; 339 __entry->block = bd->bd_bh->b_blocknr;
@@ -449,7 +449,7 @@ TRACE_EVENT(gfs2_bmap,
449 ), 449 ),
450 450
451 TP_fast_assign( 451 TP_fast_assign(
452 __entry->dev = ip->i_gl->gl_sbd->sd_vfs->s_dev; 452 __entry->dev = ip->i_gl->gl_name.ln_sbd->sd_vfs->s_dev;
453 __entry->lblock = lblock; 453 __entry->lblock = lblock;
454 __entry->pblock = buffer_mapped(bh) ? bh->b_blocknr : 0; 454 __entry->pblock = buffer_mapped(bh) ? bh->b_blocknr : 0;
455 __entry->inum = ip->i_no_addr; 455 __entry->inum = ip->i_no_addr;
@@ -489,7 +489,7 @@ TRACE_EVENT(gfs2_block_alloc,
489 ), 489 ),
490 490
491 TP_fast_assign( 491 TP_fast_assign(
492 __entry->dev = rgd->rd_gl->gl_sbd->sd_vfs->s_dev; 492 __entry->dev = rgd->rd_gl->gl_name.ln_sbd->sd_vfs->s_dev;
493 __entry->start = block; 493 __entry->start = block;
494 __entry->inum = ip->i_no_addr; 494 __entry->inum = ip->i_no_addr;
495 __entry->len = len; 495 __entry->len = len;
diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c
index 88bff2430669..b95d0d625f32 100644
--- a/fs/gfs2/trans.c
+++ b/fs/gfs2/trans.c
@@ -158,7 +158,7 @@ static struct gfs2_bufdata *gfs2_alloc_bufdata(struct gfs2_glock *gl,
158void gfs2_trans_add_data(struct gfs2_glock *gl, struct buffer_head *bh) 158void gfs2_trans_add_data(struct gfs2_glock *gl, struct buffer_head *bh)
159{ 159{
160 struct gfs2_trans *tr = current->journal_info; 160 struct gfs2_trans *tr = current->journal_info;
161 struct gfs2_sbd *sdp = gl->gl_sbd; 161 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
162 struct address_space *mapping = bh->b_page->mapping; 162 struct address_space *mapping = bh->b_page->mapping;
163 struct gfs2_inode *ip = GFS2_I(mapping->host); 163 struct gfs2_inode *ip = GFS2_I(mapping->host);
164 struct gfs2_bufdata *bd; 164 struct gfs2_bufdata *bd;
@@ -224,7 +224,7 @@ static void meta_lo_add(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd)
224void gfs2_trans_add_meta(struct gfs2_glock *gl, struct buffer_head *bh) 224void gfs2_trans_add_meta(struct gfs2_glock *gl, struct buffer_head *bh)
225{ 225{
226 226
227 struct gfs2_sbd *sdp = gl->gl_sbd; 227 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
228 struct gfs2_bufdata *bd; 228 struct gfs2_bufdata *bd;
229 229
230 lock_buffer(bh); 230 lock_buffer(bh);