Skip to content

Commit 01cab55

Browse files
committed
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"
2 parents 64d1def + 8f7e0a8 commit 01cab55

File tree

11 files changed

+212
-285
lines changed

11 files changed

+212
-285
lines changed

fs/gfs2/glock.c

Lines changed: 136 additions & 212 deletions
Large diffs are not rendered by default.

fs/gfs2/glops.c

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,15 @@ struct workqueue_struct *gfs2_freeze_wq;
3232

3333
static void gfs2_ail_error(struct gfs2_glock *gl, const struct buffer_head *bh)
3434
{
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",
3638
bh, (unsigned long long)bh->b_blocknr, bh->b_state,
3739
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",
3941
gl->gl_name.ln_type, gl->gl_name.ln_number,
4042
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");
4244
}
4345

4446
/**
@@ -52,7 +54,7 @@ static void gfs2_ail_error(struct gfs2_glock *gl, const struct buffer_head *bh)
5254
static void __gfs2_ail_flush(struct gfs2_glock *gl, bool fsync,
5355
unsigned int nr_revokes)
5456
{
55-
struct gfs2_sbd *sdp = gl->gl_sbd;
57+
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
5658
struct list_head *head = &gl->gl_ail_list;
5759
struct gfs2_bufdata *bd, *tmp;
5860
struct buffer_head *bh;
@@ -80,7 +82,7 @@ static void __gfs2_ail_flush(struct gfs2_glock *gl, bool fsync,
8082

8183
static void gfs2_ail_empty_gl(struct gfs2_glock *gl)
8284
{
83-
struct gfs2_sbd *sdp = gl->gl_sbd;
85+
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
8486
struct gfs2_trans tr;
8587

8688
memset(&tr, 0, sizeof(tr));
@@ -109,7 +111,7 @@ static void gfs2_ail_empty_gl(struct gfs2_glock *gl)
109111

110112
void gfs2_ail_flush(struct gfs2_glock *gl, bool fsync)
111113
{
112-
struct gfs2_sbd *sdp = gl->gl_sbd;
114+
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
113115
unsigned int revokes = atomic_read(&gl->gl_ail_count);
114116
unsigned int max_revokes = (sdp->sd_sb.sb_bsize - sizeof(struct gfs2_log_descriptor)) / sizeof(u64);
115117
int ret;
@@ -139,7 +141,7 @@ void gfs2_ail_flush(struct gfs2_glock *gl, bool fsync)
139141

140142
static void rgrp_go_sync(struct gfs2_glock *gl)
141143
{
142-
struct gfs2_sbd *sdp = gl->gl_sbd;
144+
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
143145
struct address_space *mapping = &sdp->sd_aspace;
144146
struct gfs2_rgrpd *rgd;
145147
int error;
@@ -179,7 +181,7 @@ static void rgrp_go_sync(struct gfs2_glock *gl)
179181

180182
static void rgrp_go_inval(struct gfs2_glock *gl, int flags)
181183
{
182-
struct gfs2_sbd *sdp = gl->gl_sbd;
184+
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
183185
struct address_space *mapping = &sdp->sd_aspace;
184186
struct gfs2_rgrpd *rgd = gl->gl_object;
185187

@@ -218,7 +220,7 @@ static void inode_go_sync(struct gfs2_glock *gl)
218220

219221
GLOCK_BUG_ON(gl, gl->gl_state != LM_ST_EXCLUSIVE);
220222

221-
gfs2_log_flush(gl->gl_sbd, gl, NORMAL_FLUSH);
223+
gfs2_log_flush(gl->gl_name.ln_sbd, gl, NORMAL_FLUSH);
222224
filemap_fdatawrite(metamapping);
223225
if (ip) {
224226
struct address_space *mapping = ip->i_inode.i_mapping;
@@ -252,7 +254,7 @@ static void inode_go_inval(struct gfs2_glock *gl, int flags)
252254
{
253255
struct gfs2_inode *ip = gl->gl_object;
254256

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));
256258

257259
if (flags & DIO_METADATA) {
258260
struct address_space *mapping = gfs2_glock2aspace(gl);
@@ -264,9 +266,9 @@ static void inode_go_inval(struct gfs2_glock *gl, int flags)
264266
}
265267
}
266268

267-
if (ip == GFS2_I(gl->gl_sbd->sd_rindex)) {
268-
gfs2_log_flush(gl->gl_sbd, NULL, NORMAL_FLUSH);
269-
gl->gl_sbd->sd_rindex_uptodate = 0;
269+
if (ip == GFS2_I(gl->gl_name.ln_sbd->sd_rindex)) {
270+
gfs2_log_flush(gl->gl_name.ln_sbd, NULL, NORMAL_FLUSH);
271+
gl->gl_name.ln_sbd->sd_rindex_uptodate = 0;
270272
}
271273
if (ip && S_ISREG(ip->i_inode.i_mode))
272274
truncate_inode_pages(ip->i_inode.i_mapping, 0);
@@ -281,7 +283,7 @@ static void inode_go_inval(struct gfs2_glock *gl, int flags)
281283

282284
static int inode_go_demote_ok(const struct gfs2_glock *gl)
283285
{
284-
struct gfs2_sbd *sdp = gl->gl_sbd;
286+
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
285287
struct gfs2_holder *gh;
286288

287289
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)
416418
static int inode_go_lock(struct gfs2_holder *gh)
417419
{
418420
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;
420422
struct gfs2_inode *ip = gl->gl_object;
421423
int error = 0;
422424

@@ -477,7 +479,7 @@ static void inode_go_dump(struct seq_file *seq, const struct gfs2_glock *gl)
477479
static void freeze_go_sync(struct gfs2_glock *gl)
478480
{
479481
int error = 0;
480-
struct gfs2_sbd *sdp = gl->gl_sbd;
482+
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
481483

482484
if (gl->gl_state == LM_ST_SHARED &&
483485
test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) {
@@ -500,7 +502,7 @@ static void freeze_go_sync(struct gfs2_glock *gl)
500502

501503
static int freeze_go_xmote_bh(struct gfs2_glock *gl, struct gfs2_holder *gh)
502504
{
503-
struct gfs2_sbd *sdp = gl->gl_sbd;
505+
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
504506
struct gfs2_inode *ip = GFS2_I(sdp->sd_jdesc->jd_inode);
505507
struct gfs2_glock *j_gl = ip->i_gl;
506508
struct gfs2_log_header_host head;
@@ -545,7 +547,7 @@ static int freeze_go_demote_ok(const struct gfs2_glock *gl)
545547
static void iopen_go_callback(struct gfs2_glock *gl, bool remote)
546548
{
547549
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;
549551

550552
if (!remote || (sdp->sd_vfs->s_flags & MS_RDONLY))
551553
return;

fs/gfs2/incore.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <linux/ktime.h>
2323
#include <linux/percpu.h>
2424
#include <linux/lockref.h>
25+
#include <linux/rhashtable.h>
2526

2627
#define DIO_WAIT 0x00000010
2728
#define DIO_METADATA 0x00000020
@@ -203,13 +204,15 @@ enum {
203204
};
204205

205206
struct lm_lockname {
207+
struct gfs2_sbd *ln_sbd;
206208
u64 ln_number;
207209
unsigned int ln_type;
208210
};
209211

210212
#define lm_name_equal(name1, name2) \
211-
(((name1)->ln_number == (name2)->ln_number) && \
212-
((name1)->ln_type == (name2)->ln_type))
213+
(((name1)->ln_number == (name2)->ln_number) && \
214+
((name1)->ln_type == (name2)->ln_type) && \
215+
((name1)->ln_sbd == (name2)->ln_sbd))
213216

214217

215218
struct gfs2_glock_operations {
@@ -241,7 +244,7 @@ enum {
241244
};
242245

243246
struct gfs2_lkstats {
244-
s64 stats[GFS2_NR_LKSTATS];
247+
u64 stats[GFS2_NR_LKSTATS];
245248
};
246249

247250
enum {
@@ -327,7 +330,6 @@ enum {
327330

328331
struct gfs2_glock {
329332
struct hlist_bl_node gl_list;
330-
struct gfs2_sbd *gl_sbd;
331333
unsigned long gl_flags; /* GLF_... */
332334
struct lm_lockname gl_name;
333335

@@ -341,7 +343,6 @@ struct gfs2_glock {
341343
gl_req:2, /* State in last dlm request */
342344
gl_reply:8; /* Last reply from the dlm */
343345

344-
unsigned int gl_hash;
345346
unsigned long gl_demote_time; /* time of first demote request */
346347
long gl_hold_time;
347348
struct list_head gl_holders;
@@ -367,7 +368,7 @@ struct gfs2_glock {
367368
loff_t end;
368369
} gl_vm;
369370
};
370-
struct rcu_head gl_rcu;
371+
struct rhash_head gl_node;
371372
};
372373

373374
#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)
835836

836837
static inline void gfs2_sbstats_inc(const struct gfs2_glock *gl, int which)
837838
{
838-
const struct gfs2_sbd *sdp = gl->gl_sbd;
839+
const struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
839840
preempt_disable();
840841
this_cpu_ptr(sdp->sd_lkstats)->lkstats[gl->gl_name.ln_type].stats[which]++;
841842
preempt_enable();

fs/gfs2/lock_dlm.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ extern struct workqueue_struct *gfs2_control_wq;
3131
*
3232
* @delta is the difference between the current rtt sample and the
3333
* 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
3535
* more complicated. We subtract the abs value of the @delta from
3636
* the current variance estimate and add 1/4 of that to the running
3737
* total.
@@ -80,7 +80,7 @@ static inline void gfs2_update_reply_times(struct gfs2_glock *gl)
8080

8181
preempt_disable();
8282
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);
8484
gfs2_update_stats(&gl->gl_stats, index, rtt); /* Local */
8585
gfs2_update_stats(&lks->lkstats[gltype], index, rtt); /* Global */
8686
preempt_enable();
@@ -108,7 +108,7 @@ static inline void gfs2_update_request_times(struct gfs2_glock *gl)
108108
dstamp = gl->gl_dstamp;
109109
gl->gl_dstamp = ktime_get_real();
110110
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);
112112
gfs2_update_stats(&gl->gl_stats, GFS2_LKS_SIRT, irt); /* Local */
113113
gfs2_update_stats(&lks->lkstats[gltype], GFS2_LKS_SIRT, irt); /* Global */
114114
preempt_enable();
@@ -253,7 +253,7 @@ static void gfs2_reverse_hex(char *c, u64 value)
253253
static int gdlm_lock(struct gfs2_glock *gl, unsigned int req_state,
254254
unsigned int flags)
255255
{
256-
struct lm_lockstruct *ls = &gl->gl_sbd->sd_lockstruct;
256+
struct lm_lockstruct *ls = &gl->gl_name.ln_sbd->sd_lockstruct;
257257
int req;
258258
u32 lkf;
259259
char strname[GDLM_STRNAME_BYTES] = "";
@@ -281,7 +281,7 @@ static int gdlm_lock(struct gfs2_glock *gl, unsigned int req_state,
281281

282282
static void gdlm_put_lock(struct gfs2_glock *gl)
283283
{
284-
struct gfs2_sbd *sdp = gl->gl_sbd;
284+
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
285285
struct lm_lockstruct *ls = &sdp->sd_lockstruct;
286286
int lvb_needs_unlock = 0;
287287
int error;
@@ -319,7 +319,7 @@ static void gdlm_put_lock(struct gfs2_glock *gl)
319319

320320
static void gdlm_cancel(struct gfs2_glock *gl)
321321
{
322-
struct lm_lockstruct *ls = &gl->gl_sbd->sd_lockstruct;
322+
struct lm_lockstruct *ls = &gl->gl_name.ln_sbd->sd_lockstruct;
323323
dlm_unlock(ls->ls_dlm, gl->gl_lksb.sb_lkid, DLM_LKF_CANCEL, NULL, gl);
324324
}
325325

fs/gfs2/lops.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ static bool buffer_is_rgrp(const struct gfs2_bufdata *bd)
7070
static void maybe_release_space(struct gfs2_bufdata *bd)
7171
{
7272
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;
7474
struct gfs2_rgrpd *rgd = gl->gl_object;
7575
unsigned int index = bd->bd_bh->b_blocknr - gl->gl_name.ln_number;
7676
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,
578578
static void gfs2_meta_sync(struct gfs2_glock *gl)
579579
{
580580
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;
582582
int error;
583583

584584
if (mapping == NULL)
@@ -588,7 +588,7 @@ static void gfs2_meta_sync(struct gfs2_glock *gl)
588588
error = filemap_fdatawait(mapping);
589589

590590
if (error)
591-
gfs2_io_error(gl->gl_sbd);
591+
gfs2_io_error(gl->gl_name.ln_sbd);
592592
}
593593

594594
static void buf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass)

fs/gfs2/meta_io.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ const struct address_space_operations gfs2_rgrp_aops = {
114114
struct buffer_head *gfs2_getbuf(struct gfs2_glock *gl, u64 blkno, int create)
115115
{
116116
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;
118118
struct page *page;
119119
struct buffer_head *bh;
120120
unsigned int shift;
@@ -200,7 +200,7 @@ struct buffer_head *gfs2_meta_new(struct gfs2_glock *gl, u64 blkno)
200200
int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags,
201201
struct buffer_head **bhp)
202202
{
203-
struct gfs2_sbd *sdp = gl->gl_sbd;
203+
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
204204
struct buffer_head *bh;
205205

206206
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,
362362

363363
struct buffer_head *gfs2_meta_ra(struct gfs2_glock *gl, u64 dblock, u32 extlen)
364364
{
365-
struct gfs2_sbd *sdp = gl->gl_sbd;
365+
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
366366
struct buffer_head *first_bh, *bh;
367367
u32 max_ra = gfs2_tune_get(sdp, gt_max_readahead) >>
368368
sdp->sd_sb.sb_bsize_shift;

fs/gfs2/meta_io.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ static inline struct gfs2_sbd *gfs2_mapping2sbd(struct address_space *mapping)
4444
{
4545
struct inode *inode = mapping->host;
4646
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;
4848
else if (mapping->a_ops == &gfs2_rgrp_aops)
4949
return container_of(mapping, struct gfs2_sbd, sd_aspace);
5050
else

0 commit comments

Comments
 (0)