Skip to content

Commit

Permalink
Merge tag 'gfs2-4.21.fixes' of git://git.kernel.org/pub/scm/linux/ker…
Browse files Browse the repository at this point in the history
…nel/git/gfs2/linux-gfs2

Pull gfs2 updates from Bob Peterson:

 - Enhancements and performance improvements to journal replay (Abhi
   Das)

 - Cleanup of gfs2_is_ordered and gfs2_is_writeback (Andreas
   Gruenbacher)

 - Fix a potential double-free in inode creation (Andreas Gruenbacher)

 - Fix the bitmap search loop that was searching too far (Andreas
   Gruenbacher)

 - Various cleanups (Andreas Gruenbacher, Bob Peterson)

 - Implement Steve Whitehouse's patch to dump nrpages for inodes (Bob
   Peterson)

 - Fix a withdraw bug where stuffed journaled data files didn't allocate
   enough journal space to be grown (Bob Peterson)

* tag 'gfs2-4.21.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2:
  gfs2: take jdata unstuff into account in do_grow
  gfs2: Dump nrpages for inodes and their glocks
  gfs2: Fix loop in gfs2_rbm_find
  gfs2: Get rid of potential double-freeing in gfs2_create_inode
  gfs2: Remove vestigial bd_ops
  gfs2: read journal in large chunks to locate the head
  gfs2: add a helper function to get_log_header that can be used elsewhere
  gfs2: changes to gfs2_log_XXX_bio
  gfs2: add more timing info to journal recovery process
  gfs2: Fix the gfs2_invalidatepage description
  gfs2: Clean up gfs2_is_{ordered,writeback}
  • Loading branch information
torvalds committed Dec 28, 2018
2 parents b71acb0 + bc02056 commit 7bbbf2c
Show file tree
Hide file tree
Showing 19 changed files with 317 additions and 231 deletions.
16 changes: 8 additions & 8 deletions fs/gfs2/aops.c
Original file line number Diff line number Diff line change
Expand Up @@ -820,10 +820,10 @@ static void gfs2_invalidatepage(struct page *page, unsigned int offset,
* @page: the page that's being released
* @gfp_mask: passed from Linux VFS, ignored by us
*
* Call try_to_free_buffers() if the buffers in this page can be
* released.
* Calls try_to_free_buffers() to free the buffers and put the page if the
* buffers can be released.
*
* Returns: 0
* Returns: 1 if the page was put or else 0
*/

int gfs2_releasepage(struct page *page, gfp_t gfp_mask)
Expand Down Expand Up @@ -930,14 +930,14 @@ static const struct address_space_operations gfs2_jdata_aops = {
void gfs2_set_aops(struct inode *inode)
{
struct gfs2_inode *ip = GFS2_I(inode);
struct gfs2_sbd *sdp = GFS2_SB(inode);

if (gfs2_is_writeback(ip))
if (gfs2_is_jdata(ip))
inode->i_mapping->a_ops = &gfs2_jdata_aops;
else if (gfs2_is_writeback(sdp))
inode->i_mapping->a_ops = &gfs2_writeback_aops;
else if (gfs2_is_ordered(ip))
else if (gfs2_is_ordered(sdp))
inode->i_mapping->a_ops = &gfs2_ordered_aops;
else if (gfs2_is_jdata(ip))
inode->i_mapping->a_ops = &gfs2_jdata_aops;
else
BUG();
}

10 changes: 8 additions & 2 deletions fs/gfs2/bmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <linux/gfs2_ondisk.h>
#include <linux/crc32.h>
#include <linux/iomap.h>
#include <linux/ktime.h>

#include "gfs2.h"
#include "incore.h"
Expand Down Expand Up @@ -2083,6 +2084,8 @@ static int do_grow(struct inode *inode, u64 size)
}

error = gfs2_trans_begin(sdp, RES_DINODE + RES_STATFS + RES_RG_BIT +
(unstuff &&
gfs2_is_jdata(ip) ? RES_JDATA : 0) +
(sdp->sd_args.ar_quota == GFS2_QUOTA_OFF ?
0 : RES_QUOTA), 0);
if (error)
Expand Down Expand Up @@ -2248,7 +2251,9 @@ int gfs2_map_journal_extents(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd)
unsigned int shift = sdp->sd_sb.sb_bsize_shift;
u64 size;
int rc;
ktime_t start, end;

start = ktime_get();
lblock_stop = i_size_read(jd->jd_inode) >> shift;
size = (lblock_stop - lblock) << shift;
jd->nr_extents = 0;
Expand All @@ -2268,8 +2273,9 @@ int gfs2_map_journal_extents(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd)
lblock += (bh.b_size >> ip->i_inode.i_blkbits);
} while(size > 0);

fs_info(sdp, "journal %d mapped with %u extents\n", jd->jd_jid,
jd->nr_extents);
end = ktime_get();
fs_info(sdp, "journal %d mapped with %u extents in %lldms\n", jd->jd_jid,
jd->nr_extents, ktime_ms_delta(end, start));
return 0;

fail:
Expand Down
2 changes: 1 addition & 1 deletion fs/gfs2/glock.c
Original file line number Diff line number Diff line change
Expand Up @@ -1777,7 +1777,7 @@ static const char *gflags2str(char *buf, const struct gfs2_glock *gl)
*
*/

void gfs2_dump_glock(struct seq_file *seq, const struct gfs2_glock *gl)
void gfs2_dump_glock(struct seq_file *seq, struct gfs2_glock *gl)
{
const struct gfs2_glock_operations *glops = gl->gl_ops;
unsigned long long dtime;
Expand Down
2 changes: 1 addition & 1 deletion fs/gfs2/glock.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ extern int gfs2_glock_nq_num(struct gfs2_sbd *sdp, u64 number,
struct gfs2_holder *gh);
extern int gfs2_glock_nq_m(unsigned int num_gh, struct gfs2_holder *ghs);
extern void gfs2_glock_dq_m(unsigned int num_gh, struct gfs2_holder *ghs);
extern void gfs2_dump_glock(struct seq_file *seq, const struct gfs2_glock *gl);
extern void gfs2_dump_glock(struct seq_file *seq, struct gfs2_glock *gl);
#define GLOCK_BUG_ON(gl,x) do { if (unlikely(x)) { gfs2_dump_glock(NULL, gl); BUG(); } } while(0)
extern __printf(2, 3)
void gfs2_print_dbg(struct seq_file *seq, const char *fmt, ...);
Expand Down
17 changes: 13 additions & 4 deletions fs/gfs2/glops.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "util.h"
#include "trans.h"
#include "dir.h"
#include "lops.h"

struct workqueue_struct *gfs2_freeze_wq;

Expand Down Expand Up @@ -466,17 +467,25 @@ static int inode_go_lock(struct gfs2_holder *gh)
*
*/

static void inode_go_dump(struct seq_file *seq, const struct gfs2_glock *gl)
static void inode_go_dump(struct seq_file *seq, struct gfs2_glock *gl)
{
const struct gfs2_inode *ip = gl->gl_object;
struct gfs2_inode *ip = gl->gl_object;
struct inode *inode = &ip->i_inode;
unsigned long nrpages;

if (ip == NULL)
return;
gfs2_print_dbg(seq, " I: n:%llu/%llu t:%u f:0x%02lx d:0x%08x s:%llu\n",

xa_lock_irq(&inode->i_data.i_pages);
nrpages = inode->i_data.nrpages;
xa_unlock_irq(&inode->i_data.i_pages);

gfs2_print_dbg(seq, " I: n:%llu/%llu t:%u f:0x%02lx d:0x%08x s:%llu p:%lu\n",
(unsigned long long)ip->i_no_formal_ino,
(unsigned long long)ip->i_no_addr,
IF2DT(ip->i_inode.i_mode), ip->i_flags,
(unsigned int)ip->i_diskflags,
(unsigned long long)i_size_read(&ip->i_inode));
(unsigned long long)i_size_read(inode), nrpages);
}

/**
Expand Down
3 changes: 1 addition & 2 deletions fs/gfs2/incore.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ struct gfs2_bufdata {
u64 bd_blkno;

struct list_head bd_list;
const struct gfs2_log_operations *bd_ops;

struct gfs2_trans *bd_tr;
struct list_head bd_ail_st_list;
Expand Down Expand Up @@ -244,7 +243,7 @@ struct gfs2_glock_operations {
int (*go_demote_ok) (const struct gfs2_glock *gl);
int (*go_lock) (struct gfs2_holder *gh);
void (*go_unlock) (struct gfs2_holder *gh);
void (*go_dump)(struct seq_file *seq, const struct gfs2_glock *gl);
void (*go_dump)(struct seq_file *seq, struct gfs2_glock *gl);
void (*go_callback)(struct gfs2_glock *gl, bool remote);
const int go_type;
const unsigned long go_flags;
Expand Down
18 changes: 9 additions & 9 deletions fs/gfs2/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -744,17 +744,19 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
the gfs2 structures. */
if (default_acl) {
error = __gfs2_set_acl(inode, default_acl, ACL_TYPE_DEFAULT);
if (error)
goto fail_gunlock3;
posix_acl_release(default_acl);
default_acl = NULL;
}
if (acl) {
if (!error)
error = __gfs2_set_acl(inode, acl, ACL_TYPE_ACCESS);
error = __gfs2_set_acl(inode, acl, ACL_TYPE_ACCESS);
if (error)
goto fail_gunlock3;
posix_acl_release(acl);
acl = NULL;
}

if (error)
goto fail_gunlock3;

error = security_inode_init_security(&ip->i_inode, &dip->i_inode, name,
&gfs2_initxattrs, NULL);
if (error)
Expand Down Expand Up @@ -789,10 +791,8 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
}
gfs2_rsqa_delete(ip, NULL);
fail_free_acls:
if (default_acl)
posix_acl_release(default_acl);
if (acl)
posix_acl_release(acl);
posix_acl_release(default_acl);
posix_acl_release(acl);
fail_gunlock:
gfs2_dir_no_add(&da);
gfs2_glock_dq_uninit(ghs);
Expand Down
10 changes: 4 additions & 6 deletions fs/gfs2/inode.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,14 @@ static inline int gfs2_is_jdata(const struct gfs2_inode *ip)
return ip->i_diskflags & GFS2_DIF_JDATA;
}

static inline int gfs2_is_writeback(const struct gfs2_inode *ip)
static inline bool gfs2_is_ordered(const struct gfs2_sbd *sdp)
{
const struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
return (sdp->sd_args.ar_data == GFS2_DATA_WRITEBACK) && !gfs2_is_jdata(ip);
return sdp->sd_args.ar_data == GFS2_DATA_ORDERED;
}

static inline int gfs2_is_ordered(const struct gfs2_inode *ip)
static inline bool gfs2_is_writeback(const struct gfs2_sbd *sdp)
{
const struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
return (sdp->sd_args.ar_data == GFS2_DATA_ORDERED) && !gfs2_is_jdata(ip);
return sdp->sd_args.ar_data == GFS2_DATA_WRITEBACK;
}

static inline int gfs2_is_dir(const struct gfs2_inode *ip)
Expand Down
5 changes: 2 additions & 3 deletions fs/gfs2/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,6 @@ void gfs2_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd)
bd->bd_blkno = bh->b_blocknr;
gfs2_remove_from_ail(bd); /* drops ref on bh */
bd->bd_bh = NULL;
bd->bd_ops = &gfs2_revoke_lops;
sdp->sd_log_num_revoke++;
atomic_inc(&gl->gl_revokes);
set_bit(GLF_LFLUSH, &gl->gl_flags);
Expand Down Expand Up @@ -734,7 +733,7 @@ void gfs2_write_log_header(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd,
lh->lh_crc = cpu_to_be32(crc);

gfs2_log_write(sdp, page, sb->s_blocksize, 0, addr);
gfs2_log_flush_bio(sdp, REQ_OP_WRITE, op_flags);
gfs2_log_submit_bio(&sdp->sd_log_bio, REQ_OP_WRITE | op_flags);
log_flush_wait(sdp);
}

Expand Down Expand Up @@ -811,7 +810,7 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl, u32 flags)

gfs2_ordered_write(sdp);
lops_before_commit(sdp, tr);
gfs2_log_flush_bio(sdp, REQ_OP_WRITE, 0);
gfs2_log_submit_bio(&sdp->sd_log_bio, REQ_OP_WRITE);

if (sdp->sd_log_head != sdp->sd_log_flush_head) {
log_flush_wait(sdp);
Expand Down
5 changes: 2 additions & 3 deletions fs/gfs2/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,11 @@ static inline void gfs2_log_pointers_init(struct gfs2_sbd *sdp,

static inline void gfs2_ordered_add_inode(struct gfs2_inode *ip)
{
struct gfs2_sbd *sdp;
struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);

if (!gfs2_is_ordered(ip))
if (gfs2_is_jdata(ip) || !gfs2_is_ordered(sdp))
return;

sdp = GFS2_SB(&ip->i_inode);
if (!test_bit(GIF_ORDERED, &ip->i_flags)) {
spin_lock(&sdp->sd_ordered_lock);
if (!test_and_set_bit(GIF_ORDERED, &ip->i_flags))
Expand Down
Loading

0 comments on commit 7bbbf2c

Please sign in to comment.