Track metadata via the pagecache
From b9a77bfa8cfee4de5e0879e5b12b7a73f9bcc137 Mon Sep 17 00:00:00 2001
From: Steven Whitehouse <[email protected]>
Date: Tue, 11 Dec 2007 09:51:50 +0000
Subject: [PATCH] [GFS2] Track metadata via the pagecache
Rather than using the fact that we have a per-inode metadata address space, this patch changes the way we track metadata buffers so that we iterate over a range of pages, and in the invalidate case we check the buffers in that range match the glock which we are using. In the sync case, we short circuit that by just sync'ing everything (all metadata) between the two limits being tracked by the glock.
In the normal case, this is very efficient as all the metadata for an inode is concentrated in a single place.
This patch requires two new exports in order that we can sync and wait for a range of pages.
The reason for making this change is to prepare for removing the per-inode metadata address space and replacing it with a single address space for all metadata. That change is done in the next patch.
fs/gfs2/glock.c +1 -0
@@ -346,6 +346,7 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number, gl->gl_sbd = sdp; gl->gl_aspace =NULL ;INIT_DELAYED_WORK (&gl->gl_work, glock_work_func); + gl->gl_start = gl->gl_end = number;/* If this glock protects actual on-disk data or metadata blocks, create a VFS inode to manage the pages/buffers holding them. */
fs/gfs2/glops.c +110 -49
203 lines not on this page · raw message
fs/gfs2/glops.h +2 -0
@@ -22,4 +22,6 @@ extern const struct gfs2_glock_operations gfs2_nondisk_glops;extern const struct gfs2_glock_operations gfs2_quota_glops;extern const struct gfs2_glock_operations gfs2_journal_glops; +extern void gfs2_meta_inval (struct gfs2_glock *gl); +#endif /* __GLOPS_DOT_H__ */
fs/gfs2/incore.h +2 -1
@@ -249,6 +249,8 @@ struct gfs2_glock {struct list_head gl_ail_list;atomic_t gl_ail_count;struct delayed_work gl_work; +u64 gl_start; +u64 gl_end; };struct gfs2_alloc {
@@ -274,7 +276,6 @@ struct gfs2_alloc {enum {GIF_INVALID =0 ,GIF_QD_LOCKED =1 , -GIF_SW_PAGED =3 , };struct gfs2_dinode_host {
fs/gfs2/inode.c +0 -1
@@ -369,7 +369,6 @@ int gfs2_dinode_dealloc(struct gfs2_inode *ip)if (error) goto out_rg_gunlock; -set_bit (GLF_DIRTY , &ip->i_gl->gl_flags);set_bit (GLF_LFLUSH , &ip->i_gl->gl_flags);gfs2_free_di (rgd, ip);
fs/gfs2/lops.c +2 -17
@@ -311,18 +311,11 @@ static int buf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,static void buf_lo_after_scan (struct gfs2_jdesc *jd,int error,int pass) { -struct gfs2_inode *ip =GFS2_I (jd->jd_inode);struct gfs2_sbd *sdp =GFS2_SB (jd->jd_inode); -if (error) { -gfs2_meta_sync (ip->i_gl); -return ; - } -if (pass !=1 ) +if (error || pass !=1 )return ; -gfs2_meta_sync (ip->i_gl); -fs_info (sdp,"jid=%u: Replayed %u of %u blocks\n" , jd->jd_jid, sdp->sd_replayed_blocks, sdp->sd_found_blocks); }
@@ -709,19 +702,11 @@ static int databuf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,static void databuf_lo_after_scan (struct gfs2_jdesc *jd,int error,int pass) { -struct gfs2_inode *ip =GFS2_I (jd->jd_inode);struct gfs2_sbd *sdp =GFS2_SB (jd->jd_inode); -if (error) { -gfs2_meta_sync (ip->i_gl); -return ; - } -if (pass !=1 ) +if (error || pass !=1 )return ; -/* data sync? */ -gfs2_meta_sync (ip->i_gl); -fs_info (sdp,"jid=%u: Replayed %u of %u data blocks\n" , jd->jd_jid, sdp->sd_replayed_blocks, sdp->sd_found_blocks); }
fs/gfs2/meta_io.c +7 -39
58 lines not on this page · raw message
fs/gfs2/meta_io.h +0 -3
@@ -40,9 +40,6 @@ static inline void gfs2_buffer_copy_tail(struct buffer_head *to_bh,struct inode *gfs2_aspace_get (struct gfs2_sbd *sdp);void gfs2_aspace_put (struct inode *aspace); -void gfs2_meta_inval (struct gfs2_glock *gl); -void gfs2_meta_sync (struct gfs2_glock *gl); -struct buffer_head *gfs2_meta_new (struct gfs2_glock *gl,u64 blkno);int gfs2_meta_read (struct gfs2_glock *gl,u64 blkno,int flags,struct buffer_head **bhp);
fs/gfs2/ops_file.c +0 -1
@@ -359,7 +359,6 @@ static int gfs2_page_mkwrite(struct vm_area_struct *vma, struct page *page)if (ret) goto out; -set_bit (GIF_SW_PAGED , &ip->i_flags);gfs2_write_calc_reserv (ip,PAGE_CACHE_SIZE , &data_blocks, &ind_blocks); ret =gfs2_write_alloc_required (ip, pos,PAGE_CACHE_SIZE , &alloc_required);if (ret || !alloc_required)
fs/gfs2/recovery.c +6 -0
@@ -522,6 +522,12 @@ int gfs2_recover_journal(struct gfs2_jdesc *jd) error =foreach_descriptor (jd, head.lh_tail, head.lh_blkno, pass);lops_after_scan (jd, error, pass); +if (error || pass ==1 ) { +generic_osync_inode (jd->jd_inode, + jd->jd_inode->i_mapping, +OSYNC_DATA |OSYNC_METADATA ); +gfs2_meta_inval (GFS2_I (jd->jd_inode)->i_gl); + }if (error) goto fail_gunlock_tr; }
Signature · 1 line
1.5.1.2