GFS2: Pre-pull patch posting (merge window)
cover GFS2: Pre-pull patch posting (merge window)
Hi,
We've got 11 patches for this merge window:
- 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)
Regards,
Bob Peterson
---
Abhi Das (4):
gfs2: add more timing info to journal recovery process
gfs2: changes to gfs2_log_XXX_bio
gfs2: add a helper function to get_log_header that can be used
elsewhere
gfs2: read journal in large chunks to locate the head
Andreas Gruenbacher (4):
gfs2: Clean up gfs2_is_{ordered,writeback}
gfs2: Fix the gfs2_invalidatepage description
gfs2: Get rid of potential double-freeing in gfs2_create_inode
gfs2: Fix loop in gfs2_rbm_find
Bob Peterson (3):
gfs2: Remove vestigial bd_ops
gfs2: Dump nrpages for inodes and their glocks
gfs2: take jdata unstuff into account in do_grow
fs/gfs2/aops.c | 16 +-- fs/gfs2/bmap.c | 10 +- fs/gfs2/glock.c | 2 +- fs/gfs2/glock.h | 2 +- fs/gfs2/glops.c | 17 ++- fs/gfs2/incore.h | 3 +- fs/gfs2/inode.c | 18 +-- fs/gfs2/inode.h | 10 +- fs/gfs2/log.c | 5 +- fs/gfs2/log.h | 5 +- fs/gfs2/lops.c | 257 ++++++++++++++++++++++++++++++++++++------- fs/gfs2/lops.h | 4 +- fs/gfs2/ops_fstype.c | 1 + fs/gfs2/recovery.c | 178 ++++++------------------------ fs/gfs2/recovery.h | 5 +- fs/gfs2/rgrp.c | 4 +- fs/gfs2/rgrp.h | 2 +- fs/gfs2/super.c | 1 + fs/gfs2/trans.c | 8 +- 19 files changed, 317 insertions(+), 231 deletions(-)
Signature · 1 line
2.20.1
PATCH 1/11 gfs2: Clean up gfs2_is_{ordered, writeback}
From: Andreas Gruenbacher <[email protected]>
The gfs2_is_ordered and gfs2_is_writeback checks are weird in that they implicitly check for !gfs2_is_jdata. This makes understanding how to use those functions correctly a challenge. Clean this up by making gfs2_is_ordered and gfs2_is_writeback take a super block instead of an inode and by removing the implicit !gfs2_is_jdata checks. Update the callers accordingly.
--- fs/gfs2/aops.c | 10 +++++----- fs/gfs2/inode.h | 10 ++++------ fs/gfs2/log.h | 5 ++--- 3 files changed, 11 insertions(+), 14 deletions(-)
fs/gfs2/aops.c +5 -5
@@ -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 (); } -
fs/gfs2/inode.h +4 -6
@@ -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)
fs/gfs2/log.h +2 -3
@@ -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))
Signature · 1 line
2.20.1
PATCH 2/11 gfs2: Fix the gfs2_invalidatepage description
In reply to Bob PetersonFrom: Andreas Gruenbacher <[email protected]>
The comment incorrectly states that the function always returns 0.
--- fs/gfs2/aops.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/gfs2/aops.c +3 -3
@@ -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)
Signature · 1 line
2.20.1
PATCH 3/11 gfs2: add more timing info to journal recovery process
In reply to Bob PetersonFrom: Abhi Das <[email protected]>
Tells you how many milliseconds map_journal_extents and find_jhead take.
--- fs/gfs2/bmap.c | 8 ++++++-- fs/gfs2/recovery.c | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-)
fs/gfs2/bmap.c +6 -2
@@ -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"
@@ -2248,7 +2249,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 ;
@@ -2268,8 +2271,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:
fs/gfs2/recovery.c +2 -0
@@ -460,6 +460,8 @@ void gfs2_recover_func(struct work_struct *work)if (error) goto fail_gunlock_ji; t_jhd =ktime_get (); +fs_info (sdp,"jid=%u: Journal head lookup took %lldms\n" , jd->jd_jid, +ktime_ms_delta (t_jhd, t_jlck));if (!(head.lh_flags &GFS2_LOG_HEAD_UNMOUNT )) { fs_info(sdp, "jid=%u: Acquiring the transaction lock...\n",
Signature · 1 line
2.20.1
PATCH 4/11 gfs2: changes to gfs2_log_XXX_bio
In reply to Bob PetersonFrom: Abhi Das <[email protected]>
Change gfs2_log_XXX_bio family of functions so they can be used with different bios, not just sdp->sd_log_bio.
This patch also contains some clean up suggested by Andreas.
--- fs/gfs2/log.c | 4 +-- fs/gfs2/lops.c | 73 +++++++++++++++++++++++++++----------------------- fs/gfs2/lops.h | 2 +- 3 files changed, 42 insertions(+), 37 deletions(-)
fs/gfs2/log.c +2 -2
@@ -734,7 +734,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); }
@@ -811,7 +811,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 ,0 );if (sdp->sd_log_head != sdp->sd_log_flush_head) {log_flush_wait (sdp);
fs/gfs2/lops.c +39 -34
132 lines not on this page · raw message
fs/gfs2/lops.h +1 -1
@@ -30,7 +30,7 @@ extern u64 gfs2_log_bmap(struct gfs2_sbd *sdp);extern void gfs2_log_write (struct gfs2_sbd *sdp,struct page *page,unsigned size,unsigned offset,u64 blkno);extern void gfs2_log_write_page (struct gfs2_sbd *sdp,struct page *page); -extern void gfs2_log_flush_bio (struct gfs2_sbd *sdp,int op,int op_flags); +extern void gfs2_log_submit_bio (struct bio **biop,int op,int op_flags);extern void gfs2_pin (struct gfs2_sbd *sdp,struct buffer_head *bh);static inline unsigned int buf_limit (struct gfs2_sbd *sdp)
Signature · 1 line
2.20.1
PATCH 5/11 gfs2: add a helper function to get_log_header that can be used elsewhere
In reply to Bob PetersonFrom: Abhi Das <[email protected]>
Move and re-order the error checks and hash/crc computations into another function __get_log_header() so it can be used in scenarios where buffer_heads are not being used for the log header.
--- fs/gfs2/recovery.c | 53 ++++++++++++++++++++++++++++------------------ fs/gfs2/recovery.h | 3 +++ 2 files changed, 35 insertions(+), 21 deletions(-)
fs/gfs2/recovery.c +32 -21
@@ -120,6 +120,35 @@ void gfs2_revoke_clean(struct gfs2_jdesc *jd) } } +int __get_log_header (struct gfs2_sbd *sdp,const struct gfs2_log_header *lh, +unsigned int blkno,struct gfs2_log_header_host *head) +{ +u32 hash, crc; + +if (lh->lh_header.mh_magic !=cpu_to_be32 (GFS2_MAGIC ) || + lh->lh_header.mh_type !=cpu_to_be32 (GFS2_METATYPE_LH ) || + (blkno &&be32_to_cpu (lh->lh_blkno) != blkno)) +return 1 ; + + hash =crc32 (~0 , lh,LH_V1_SIZE -4 ); + hash = ~crc32_le_shift (hash,4 );/* assume lh_hash is zero */ + +if (be32_to_cpu (lh->lh_hash) != hash) +return 1 ; + + crc =crc32c (~0 , (void *)lh +LH_V1_SIZE +4 , + sdp->sd_sb.sb_bsize -LH_V1_SIZE -4 ); + +if ((lh->lh_crc !=0 &&be32_to_cpu (lh->lh_crc) != crc)) +return 1 ; + + head->lh_sequence =be64_to_cpu (lh->lh_sequence); + head->lh_flags =be32_to_cpu (lh->lh_flags); + head->lh_tail =be32_to_cpu (lh->lh_tail); + head->lh_blkno =be32_to_cpu (lh->lh_blkno); + +return 0 ; +}/** * get_log_header - read the log header for a given segment * @jd: the journal
@@ -137,36 +166,18 @@ void gfs2_revoke_clean(struct gfs2_jdesc *jd)static int get_log_header (struct gfs2_jdesc *jd,unsigned int blk,struct gfs2_log_header_host *head) { -struct gfs2_log_header *lh; +struct gfs2_sbd *sdp =GFS2_SB (jd->jd_inode);struct buffer_head *bh; -u32 hash, crc;int error; error =gfs2_replay_read_block (jd, blk, &bh);if (error)return error; - lh = (void *)bh->b_data; - - hash =crc32 (~0 , lh,LH_V1_SIZE -4 ); - hash = ~crc32_le_shift (hash,4 );/* assume lh_hash is zero */ - - crc =crc32c (~0 , (void *)lh +LH_V1_SIZE +4 , - bh->b_size -LH_V1_SIZE -4 ); - - error = lh->lh_header.mh_magic !=cpu_to_be32 (GFS2_MAGIC ) || - lh->lh_header.mh_type !=cpu_to_be32 (GFS2_METATYPE_LH ) || -be32_to_cpu (lh->lh_blkno) != blk || -be32_to_cpu (lh->lh_hash) != hash || - (lh->lh_crc !=0 &&be32_to_cpu (lh->lh_crc) != crc); + error =__get_log_header (sdp, (const struct gfs2_log_header *)bh->b_data, + blk, head);brelse (bh); -if (!error) { - head->lh_sequence =be64_to_cpu (lh->lh_sequence); - head->lh_flags =be32_to_cpu (lh->lh_flags); - head->lh_tail =be32_to_cpu (lh->lh_tail); - head->lh_blkno =be32_to_cpu (lh->lh_blkno); - }return error; }
fs/gfs2/recovery.h +3 -0
@@ -31,6 +31,9 @@ extern int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head);extern int gfs2_recover_journal (struct gfs2_jdesc *gfs2_jd,bool wait);extern void gfs2_recover_func (struct work_struct *work); +extern int __get_log_header (struct gfs2_sbd *sdp, +const struct gfs2_log_header *lh,unsigned int blkno, +struct gfs2_log_header_host *head);#endif /* __RECOVERY_DOT_H__ */
Signature · 1 line
2.20.1
PATCH 6/11 gfs2: read journal in large chunks to locate the head
In reply to Bob PetersonFrom: Abhi Das <[email protected]>
Use bio(s) to read in the journal sequentially in large chunks and locate the head of the journal.
This version addresses the issues Christoph pointed out w.r.t error handling and using deprecated API.
--- fs/gfs2/glops.c | 1 + fs/gfs2/log.c | 4 +- fs/gfs2/lops.c | 190 +++++++++++++++++++++++++++++++++++++++++-- fs/gfs2/lops.h | 4 +- fs/gfs2/ops_fstype.c | 1 + fs/gfs2/recovery.c | 123 ---------------------------- fs/gfs2/recovery.h | 2 - fs/gfs2/super.c | 1 + 8 files changed, 192 insertions(+), 134 deletions(-)
fs/gfs2/glops.c +1 -0
@@ -28,6 +28,7 @@#include "util.h" #include "trans.h" #include "dir.h" +#include "lops.h" struct workqueue_struct *gfs2_freeze_wq;
fs/gfs2/log.c +2 -2
@@ -734,7 +734,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_submit_bio (&sdp->sd_log_bio,REQ_OP_WRITE , op_flags); +gfs2_log_submit_bio (&sdp->sd_log_bio,REQ_OP_WRITE | op_flags);log_flush_wait (sdp); }
@@ -811,7 +811,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_submit_bio (&sdp->sd_log_bio,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);
fs/gfs2/lops.c +184 -6
231 lines not on this page · raw message
fs/gfs2/lops.h +3 -1
@@ -30,8 +30,10 @@ extern u64 gfs2_log_bmap(struct gfs2_sbd *sdp);extern void gfs2_log_write (struct gfs2_sbd *sdp,struct page *page,unsigned size,unsigned offset,u64 blkno);extern void gfs2_log_write_page (struct gfs2_sbd *sdp,struct page *page); -extern void gfs2_log_submit_bio (struct bio **biop,int op,int op_flags); +extern void gfs2_log_submit_bio (struct bio **biop,int opf);extern void gfs2_pin (struct gfs2_sbd *sdp,struct buffer_head *bh); +extern int gfs2_find_jhead (struct gfs2_jdesc *jd, +struct gfs2_log_header_host *head);static inline unsigned int buf_limit (struct gfs2_sbd *sdp) {
fs/gfs2/ops_fstype.c +1 -0
@@ -41,6 +41,7 @@#include "dir.h" #include "meta_io.h" #include "trace_gfs2.h" +#include "lops.h" #define DO 0#define UNDO 1
fs/gfs2/recovery.c +0 -123
129 lines not on this page · raw message
fs/gfs2/recovery.h +0 -2
@@ -27,8 +27,6 @@ extern int gfs2_revoke_add(struct gfs2_jdesc *jd, u64 blkno, unsigned int where)extern int gfs2_revoke_check (struct gfs2_jdesc *jd,u64 blkno,unsigned int where);extern void gfs2_revoke_clean (struct gfs2_jdesc *jd); -extern int gfs2_find_jhead (struct gfs2_jdesc *jd, -struct gfs2_log_header_host *head);extern int gfs2_recover_journal (struct gfs2_jdesc *gfs2_jd,bool wait);extern void gfs2_recover_func (struct work_struct *work); extern int __get_log_header(struct gfs2_sbd *sdp,
fs/gfs2/super.c +1 -0
@@ -45,6 +45,7 @@#include "util.h" #include "sys.h" #include "xattr.h" +#include "lops.h" #define args_neq (a1, a2, x) ((a1)->ar_##x != (a2)->ar_##x)
Signature · 1 line
2.20.1
PATCH 7/11 gfs2: Remove vestigial bd_ops
In reply to Bob PetersonField bd_ops was set but never used, so I removed it, and all code supporting it.
--- fs/gfs2/incore.h | 1 - fs/gfs2/log.c | 1 - fs/gfs2/trans.c | 8 +++----- 3 files changed, 3 insertions(+), 7 deletions(-)
fs/gfs2/incore.h +0 -1
@@ -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;
fs/gfs2/log.c +0 -1
@@ -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);
fs/gfs2/trans.c +3 -5
@@ -124,15 +124,13 @@ void gfs2_trans_end(struct gfs2_sbd *sdp) }static struct gfs2_bufdata *gfs2_alloc_bufdata (struct gfs2_glock *gl, -struct buffer_head *bh, -const struct gfs2_log_operations *lops) +struct buffer_head *bh) {struct gfs2_bufdata *bd; bd =kmem_cache_zalloc (gfs2_bufdata_cachep,GFP_NOFS | __GFP_NOFAIL); bd->bd_bh = bh; bd->bd_gl = gl; - bd->bd_ops = lops;INIT_LIST_HEAD (&bd->bd_list); bh->b_private = bd;return bd;
@@ -169,7 +167,7 @@ void gfs2_trans_add_data(struct gfs2_glock *gl, struct buffer_head *bh)gfs2_log_unlock (sdp);unlock_buffer (bh);if (bh->b_private ==NULL ) - bd =gfs2_alloc_bufdata (gl, bh, &gfs2_databuf_lops); + bd =gfs2_alloc_bufdata (gl, bh);else bd = bh->b_private;lock_buffer (bh);
@@ -210,7 +208,7 @@ void gfs2_trans_add_meta(struct gfs2_glock *gl, struct buffer_head *bh)unlock_buffer (bh);lock_page (bh->b_page);if (bh->b_private ==NULL ) - bd =gfs2_alloc_bufdata (gl, bh, &gfs2_buf_lops); + bd =gfs2_alloc_bufdata (gl, bh);else bd = bh->b_private;unlock_page (bh->b_page);
Signature · 1 line
2.20.1
PATCH 8/11 gfs2: Get rid of potential double-freeing in gfs2_create_inode
In reply to Bob PetersonFrom: Andreas Gruenbacher <[email protected]>
In gfs2_create_inode, after setting and releasing the acl / default_acl, the acl / default_acl pointers are not set to NULL as they should be. In that state, when the function reaches label fail_free_acls, gfs2_create_inode will try to release the same acls again.
Fix that by setting the pointers to NULL after releasing the acls. Slightly simplify the logic. Also, posix_acl_release checks for NULL already, so there is no need to duplicate those checks here.
--- fs/gfs2/inode.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
fs/gfs2/inode.c +9 -9
@@ -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)
@@ -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);
Signature · 1 line
2.20.1
PATCH 9/11 gfs2: Fix loop in gfs2_rbm_find
In reply to Bob PetersonFrom: Andreas Gruenbacher <[email protected]>
Fix the resource group wrap-around logic in gfs2_rbm_find that commit e579ed4f44 broke. The bug can lead to unnecessary repeated scanning of the same bitmaps; there is a risk that future changes will turn this into an endless loop.
--- fs/gfs2/rgrp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/gfs2/rgrp.c +1 -1
@@ -1780,9 +1780,9 @@ static int gfs2_rbm_find(struct gfs2_rbm *rbm, u8 state, u32 *minext, goto next_iter; }if (ret == -E2BIG ) { + n += rbm->bii - initial_bii; rbm->bii =0 ; rbm->offset =0 ; - n += (rbm->bii - initial_bii); goto res_covered_end_of_rgrp; }return ret;
Signature · 1 line
2.20.1
PATCH 10/11 gfs2: Dump nrpages for inodes and their glocks
In reply to Bob PetersonThis patch is based on an idea from Steve Whitehouse. The idea is to dump the number of pages for inodes in the glock dumps. The additional locking required me to drop const from quite a few places.
--- fs/gfs2/glock.c | 2 +- fs/gfs2/glock.h | 2 +- fs/gfs2/glops.c | 16 ++++++++++++---- fs/gfs2/incore.h | 2 +- fs/gfs2/rgrp.c | 2 +- fs/gfs2/rgrp.h | 2 +- 6 files changed, 17 insertions(+), 9 deletions(-)
fs/gfs2/glock.c +1 -1
@@ -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;
fs/gfs2/glock.h +1 -1
@@ -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, ...);
fs/gfs2/glops.c +12 -4
@@ -467,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); }/**
fs/gfs2/incore.h +1 -1
@@ -243,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;
fs/gfs2/rgrp.c +1 -1
@@ -2256,7 +2256,7 @@ static void rgblk_free(struct gfs2_sbd *sdp, struct gfs2_rgrpd *rgd,* */ -void gfs2_rgrp_dump (struct seq_file *seq,const struct gfs2_glock *gl) +void gfs2_rgrp_dump (struct seq_file *seq,struct gfs2_glock *gl) {struct gfs2_rgrpd *rgd = gl->gl_object;struct gfs2_blkreserv *trs;
fs/gfs2/rgrp.h +1 -1
@@ -72,7 +72,7 @@ extern void gfs2_rlist_add(struct gfs2_inode *ip, struct gfs2_rgrp_list *rlist,extern void gfs2_rlist_alloc (struct gfs2_rgrp_list *rlist);extern void gfs2_rlist_free (struct gfs2_rgrp_list *rlist);extern u64 gfs2_ri_total (struct gfs2_sbd *sdp); -extern void gfs2_rgrp_dump (struct seq_file *seq,const struct gfs2_glock *gl); +extern void gfs2_rgrp_dump (struct seq_file *seq,struct gfs2_glock *gl);extern int gfs2_rgrp_send_discards (struct gfs2_sbd *sdp,u64 offset,struct buffer_head *bh,const struct gfs2_bitmap *bi,unsigned minlen,u64 *ptrimmed);
Signature · 1 line
2.20.1
PATCH 11/11 gfs2: take jdata unstuff into account in do_grow
In reply to Bob PetersonBefore this patch, function do_grow would not reserve enough journal blocks in the transaction to unstuff jdata files while growing them. This patch adds the logic to add one more block if the file to grow is jdata.
--- fs/gfs2/bmap.c | 2 ++ 1 file changed, 2 insertions(+)
fs/gfs2/bmap.c +2 -0
@@ -2084,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)
Signature · 1 line
2.20.1