Skip to content

Commit f246dd4

Browse files
author
Andreas Gruenbacher
committed
gfs: Get rid of unnucessary locking in inode_go_dump
Commit 27a2660 ("gfs2: Dump nrpages for inodes and their glocks") added some locking around reading inode->i_data.nrpages. That locking doesn't do anything really, so get rid of it. With that, the glock argument to ->go_dump() can be made const again as well. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
1 parent 6c7410f commit f246dd4

2 files changed

Lines changed: 7 additions & 12 deletions

File tree

fs/gfs2/glops.c

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ static void rgrp_go_inval(struct gfs2_glock *gl, int flags)
236236
truncate_inode_pages_range(mapping, start, end);
237237
}
238238

239-
static void gfs2_rgrp_go_dump(struct seq_file *seq, struct gfs2_glock *gl,
239+
static void gfs2_rgrp_go_dump(struct seq_file *seq, const struct gfs2_glock *gl,
240240
const char *fs_id_buf)
241241
{
242242
struct gfs2_rgrpd *rgd = gl->gl_object;
@@ -536,28 +536,23 @@ static int inode_go_held(struct gfs2_holder *gh)
536536
*
537537
*/
538538

539-
static void inode_go_dump(struct seq_file *seq, struct gfs2_glock *gl,
539+
static void inode_go_dump(struct seq_file *seq, const struct gfs2_glock *gl,
540540
const char *fs_id_buf)
541541
{
542542
struct gfs2_inode *ip = gl->gl_object;
543-
struct inode *inode;
544-
unsigned long nrpages;
543+
const struct inode *inode = &ip->i_inode;
545544

546545
if (ip == NULL)
547546
return;
548547

549-
inode = &ip->i_inode;
550-
xa_lock_irq(&inode->i_data.i_pages);
551-
nrpages = inode->i_data.nrpages;
552-
xa_unlock_irq(&inode->i_data.i_pages);
553-
554548
gfs2_print_dbg(seq, "%s I: n:%llu/%llu t:%u f:0x%02lx d:0x%08x s:%llu "
555549
"p:%lu\n", fs_id_buf,
556550
(unsigned long long)ip->i_no_formal_ino,
557551
(unsigned long long)ip->i_no_addr,
558-
IF2DT(ip->i_inode.i_mode), ip->i_flags,
552+
IF2DT(inode->i_mode), ip->i_flags,
559553
(unsigned int)ip->i_diskflags,
560-
(unsigned long long)i_size_read(inode), nrpages);
554+
(unsigned long long)i_size_read(inode),
555+
inode->i_data.nrpages);
561556
}
562557

563558
/**

fs/gfs2/incore.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ struct gfs2_glock_operations {
221221
int (*go_demote_ok) (const struct gfs2_glock *gl);
222222
int (*go_instantiate) (struct gfs2_glock *gl);
223223
int (*go_held)(struct gfs2_holder *gh);
224-
void (*go_dump)(struct seq_file *seq, struct gfs2_glock *gl,
224+
void (*go_dump)(struct seq_file *seq, const struct gfs2_glock *gl,
225225
const char *fs_id_buf);
226226
void (*go_callback)(struct gfs2_glock *gl, bool remote);
227227
void (*go_free)(struct gfs2_glock *gl);

0 commit comments

Comments
 (0)