GFS2: Pre-pull patch posting
I'm guessing that the merge window opening might not be too far away now, and in any case, I won't have quite my normal internet access next week. So I'm pushing out the current GFS2 tree so that (I hope) there will be time to fix any issues.
Again, there are fewer patches here. A lot of them are fairly small too. The most noteable item deals with the meta filesystem which was in response to Al Viro's suggestions concerning a better way to structure that code. It certainly results in a much cleaner implementation, so thanks go to Al for pointing that out.
A couple of new features: I/O barrier support (needs no user configuration, see the patch for details) and UUID support (no code changes, its all userland but we reserve space in the super block, again details in the patch itself).
I know that I hardly need say, but please let me know if you have any comments :-)
Steve.
PATCH 1/12 GFS2: Fix debugfs glock file iterator
Due to an incorrect iterator, some glocks were being missed from the glock dumps obtained via debugfs. This patch fixes the problem and ensures that we don't miss any glocks in future.
fs/gfs2/glock.c +6 -5
@@ -1816,15 +1816,17 @@ restart:if (gl) { gi->gl =hlist_entry (gl->gl_list.next, struct gfs2_glock, gl_list); -if (gi->gl) -gfs2_glock_hold (gi->gl); + }else { + gi->gl =hlist_entry (gl_hash_table[gi->hash].hb_list.first, + struct gfs2_glock, gl_list); } +if (gi->gl) +gfs2_glock_hold (gi->gl);read_unlock (gl_lock_addr (gi->hash));if (gl)gfs2_glock_put (gl); -if (gl && gi->gl ==NULL ) - gi->hash++;while (gi->gl ==NULL ) { + gi->hash++;if (gi->hash >=GFS2_GL_HASH_SIZE )return 1 ;read_lock (gl_lock_addr (gi->hash));
@@ -1833,7 +1835,6 @@ restart:if (gi->gl)gfs2_glock_hold (gi->gl);read_unlock (gl_lock_addr (gi->hash)); - gi->hash++; }if (gi->sdp != gi->gl->gl_sbd)
Signature · 1 line
1.5.5.1
PATCH 2/12 GFS2: Fix metafs mounts
This patch is intended to fix the issues reported in bz #457798. Instead of having the metafs as a separate filesystem, it becomes a second root of gfs2. As a result it will appear as type gfs2 in /proc/mounts, but it is still possible (for backwards compatibility purposes) to mount it as type gfs2meta. A new mount flag "meta" is introduced so that its possible to tell the two cases apart in /proc/mounts.
As a result it becomes possible to mount type gfs2 with -o meta and get the same result as mounting type gfs2meta. So it is possible to mount just the metafs on its own. Currently if you do this, its then impossible to mount the "normal" root of the gfs2 filesystem without first unmounting the metafs root. I'm not sure if thats a feature or a bug :-)
Either way, this is a great improvement on the previous scheme and I've verified that it works ok with bind mounts on both the "normal" root and the metafs root in various combinations.
There were also a bunch of functions in super.c which didn't belong there, so this moves them into ops_fstype.c where they can be static. Hopefully the mount/umount sequence is now more obvious as a result.
fs/gfs2/incore.h +4 -3
@@ -400,6 +400,7 @@ struct gfs2_args {int ar_quota;/* off/account/on */ int ar_suiddir;/* suiddir support */ int ar_data;/* ordered/writeback */ +int ar_meta;/* mount metafs */ };struct gfs2_tune {
@@ -461,7 +462,6 @@ struct gfs2_sb_host {struct gfs2_sbd {struct super_block *sd_vfs; -struct super_block *sd_vfs_meta;struct kobject sd_kobj;unsigned long sd_flags;/* SDF_... */ struct gfs2_sb_host sd_sb;
@@ -499,7 +499,9 @@ struct gfs2_sbd {/* Inode Stuff */ -struct inode *sd_master_dir; +struct dentry *sd_master_dir; +struct dentry *sd_root_dir; +struct inode *sd_jindex;struct inode *sd_inum_inode;struct inode *sd_statfs_inode;
@@ -634,7 +636,6 @@ struct gfs2_sbd {/* Debugging crud */ unsigned long sd_last_warning; -struct vfsmount *sd_gfs2mnt;struct dentry *debugfs_dir;/* debugfs directory */ struct dentry *debugfs_dentry_glocks;/* for debugfs */ };
fs/gfs2/mount.c +7 -0
@@ -42,6 +42,7 @@ enum { Opt_nosuiddir, Opt_data_writeback, Opt_data_ordered, + Opt_meta, Opt_err, };
@@ -66,6 +67,7 @@ static match_table_t tokens = { {Opt_nosuiddir, "nosuiddir"}, {Opt_data_writeback, "data=writeback"}, {Opt_data_ordered, "data=ordered"}, + {Opt_meta, "meta"}, {Opt_err, NULL} };
@@ -239,6 +241,11 @@ int gfs2_mount_args(struct gfs2_sbd *sdp, char *data_arg, int remount)case Opt_data_ordered: args->ar_data =GFS2_DATA_ORDERED ;break ; +case Opt_meta: +if (remount && args->ar_meta !=1 ) + goto cant_remount; + args->ar_meta =1 ; +break ;case Opt_err:default :fs_info (sdp,"unknown option: %s\n" , o);
fs/gfs2/ops_fstype.c +389 -177
730 lines not on this page · raw message
fs/gfs2/ops_super.c +48 -9
111 lines not on this page · raw message
fs/gfs2/super.c +0 -340
352 lines not on this page · raw message
fs/gfs2/super.h +0 -6
@@ -12,11 +12,6 @@#include "incore.h" -void gfs2_tune_init (struct gfs2_tune *gt); - -int gfs2_check_sb (struct gfs2_sbd *sdp,struct gfs2_sb_host *sb,int silent); -int gfs2_read_sb (struct gfs2_sbd *sdp,struct gfs2_glock *gl,int silent); -int gfs2_read_super (struct gfs2_sbd *sdp,sector_t sector);void gfs2_lm_unmount (struct gfs2_sbd *sdp);static inline unsigned int gfs2_jindex_size (struct gfs2_sbd *sdp)
@@ -40,7 +35,6 @@ int gfs2_lookup_in_master_dir(struct gfs2_sbd *sdp, char *filename, struct gfs2_inode **ipp);int gfs2_make_fs_rw (struct gfs2_sbd *sdp); -int gfs2_make_fs_ro (struct gfs2_sbd *sdp);int gfs2_statfs_init (struct gfs2_sbd *sdp); void gfs2_statfs_change(struct gfs2_sbd *sdp,
Signature · 1 line
1.5.5.1
PATCH 3/12 GFS2: rm on multiple nodes causes panic
From: Bob Peterson <[email protected]>
This patch fixes a problem whereby simultaneous unlink, rmdir, rename and link operations (e.g. rm -fR *) from multiple nodes on the same GFS2 file system can cause kernel panics, hangs, and/or memory corruption. It also gets rid of all the non-rgrp calls to gfs2_glock_nq_m.
fs/gfs2/ops_inode.c +38 -18
@@ -159,9 +159,13 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,gfs2_holder_init (dip->i_gl,LM_ST_EXCLUSIVE ,0 , ghs);gfs2_holder_init (ip->i_gl,LM_ST_EXCLUSIVE ,0 , ghs +1 ); - error =gfs2_glock_nq_m (2 , ghs); + error =gfs2_glock_nq (ghs);/* parent */ if (error) - goto out; + goto out_parent; + + error =gfs2_glock_nq (ghs +1 );/* child */ +if (error) + goto out_child; error =gfs2_permission (dir,MAY_WRITE |MAY_EXEC );if (error)
@@ -245,8 +249,10 @@ out_alloc:if (alloc_required)gfs2_alloc_put (dip); out_gunlock: -gfs2_glock_dq_m (2 , ghs); -out: +gfs2_glock_dq (ghs +1 ); +out_child: +gfs2_glock_dq (ghs); +out_parent:gfs2_holder_uninit (ghs);gfs2_holder_uninit (ghs +1 );if (!error) {
@@ -302,7 +308,7 @@ static int gfs2_unlink(struct inode *dir, struct dentry *dentry) error =gfs2_unlink_ok (dip, &dentry->d_name, ip);if (error) - goto out_rgrp; + goto out_gunlock; error =gfs2_trans_begin (sdp,2 *RES_DINODE +RES_LEAF +RES_RG_BIT ,0 );if (error)
@@ -316,6 +322,7 @@ static int gfs2_unlink(struct inode *dir, struct dentry *dentry) out_end_trans:gfs2_trans_end (sdp); +out_gunlock:gfs2_glock_dq (ghs +2 ); out_rgrp:gfs2_holder_uninit (ghs +2 );
@@ -485,7 +492,6 @@ static int gfs2_rmdir(struct inode *dir, struct dentry *dentry)struct gfs2_holder ri_gh;int error; - error =gfs2_rindex_hold (sdp, &ri_gh);if (error)return error;
@@ -495,9 +501,17 @@ static int gfs2_rmdir(struct inode *dir, struct dentry *dentry) rgd =gfs2_blk2rgrpd (sdp, ip->i_no_addr);gfs2_holder_init (rgd->rd_gl,LM_ST_EXCLUSIVE ,0 , ghs +2 ); - error =gfs2_glock_nq_m (3 , ghs); + error =gfs2_glock_nq (ghs);/* parent */ if (error) - goto out; + goto out_parent; + + error =gfs2_glock_nq (ghs +1 );/* child */ +if (error) + goto out_child; + + error =gfs2_glock_nq (ghs +2 );/* rgrp */ +if (error) + goto out_rgrp; error =gfs2_unlink_ok (dip, &dentry->d_name, ip);if (error)
@@ -523,11 +537,15 @@ static int gfs2_rmdir(struct inode *dir, struct dentry *dentry)gfs2_trans_end (sdp); out_gunlock: -gfs2_glock_dq_m (3 , ghs); -out: -gfs2_holder_uninit (ghs); -gfs2_holder_uninit (ghs +1 ); +gfs2_glock_dq (ghs +2 ); +out_rgrp:gfs2_holder_uninit (ghs +2 ); +gfs2_glock_dq (ghs +1 ); +out_child: +gfs2_holder_uninit (ghs +1 ); +gfs2_glock_dq (ghs); +out_parent: +gfs2_holder_uninit (ghs);gfs2_glock_dq_uninit (&ri_gh);return error; }
@@ -639,9 +657,11 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,gfs2_holder_init (nrgd->rd_gl,LM_ST_EXCLUSIVE ,0 , ghs + num_gh++); } - error =gfs2_glock_nq_m (num_gh, ghs); -if (error) - goto out_uninit; +for (x =0 ; x < num_gh; x++) { + error =gfs2_glock_nq (ghs + x); +if (error) + goto out_gunlock; + }/* Check out the old directory */
@@ -804,10 +824,10 @@ out_alloc:if (alloc_required)gfs2_alloc_put (ndip); out_gunlock: -gfs2_glock_dq_m (num_gh, ghs); -out_uninit: -for (x =0 ; x < num_gh; x++) +while (x--) { +gfs2_glock_dq (ghs + x);gfs2_holder_uninit (ghs + x); + } out_gunlock_r:if (dir_rename)gfs2_glock_dq_uninit (&r_gh);
Signature · 1 line
1.5.5.1
PATCH 4/12 GFS2: Fix & clean up GFS2 rename
This patch fixes a locking issue in the rename code by ensuring that we hold the per sb rename lock over both directory and "other" renames which involve different parent directories.
At the same time, this moved the (only called from one place) function gfs2_ok_to_move into the file that its called from, so we can mark it static. This should make a code a bit easier to follow.
fs/gfs2/inode.c +0 -48
@@ -1140,54 +1140,6 @@ int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name,return 0 ; } -/* -* gfs2_ok_to_move - check if it's ok to move a directory to another directory -* @this: move this -* @to: to here -* -* Follow @to back to the root and make sure we don't encounter @this -* Assumes we already hold the rename lock. -* -* Returns: errno -*/ - -int gfs2_ok_to_move (struct gfs2_inode *this,struct gfs2_inode *to) -{ -struct inode *dir = &to->i_inode; -struct super_block *sb = dir->i_sb; -struct inode *tmp; -struct qstr dotdot; -int error =0 ; - -gfs2_str2qstr (&dotdot,".." ); - -igrab (dir); - -for (;;) { -if (dir == &this->i_inode) { - error = -EINVAL ; -break ; - } -if (dir == sb->s_root->d_inode) { - error =0 ; -break ; - } - - tmp =gfs2_lookupi (dir, &dotdot,1 ); -if (IS_ERR (tmp)) { - error =PTR_ERR (tmp); -break ; - } - -iput (dir); - dir = tmp; - } - -iput (dir); - -return error; -} -/** * gfs2_readlinki - return the contents of a symlink * @ip: the symlink's inode
fs/gfs2/inode.h +0 -1
@@ -91,7 +91,6 @@ int gfs2_rmdiri(struct gfs2_inode *dip, const struct qstr *name,int gfs2_unlink_ok (struct gfs2_inode *dip,const struct qstr *name,const struct gfs2_inode *ip);int gfs2_permission (struct inode *inode,int mask); -int gfs2_ok_to_move (struct gfs2_inode *this,struct gfs2_inode *to);int gfs2_readlinki (struct gfs2_inode *ip,char **buf,unsigned int *len);int gfs2_glock_nq_atime (struct gfs2_holder *gh);int gfs2_setattr_simple (struct gfs2_inode *ip,struct iattr *attr);
fs/gfs2/ops_inode.c +60 -11
99 lines not on this page · raw message
Signature · 1 line
1.5.5.1
PATCH 5/12 GFS2: Fix race relating to glock min-hold time
In the case that a request for a glock arrives right after the grant reply has arrived, it sometimes means that the gl_tstamp field hasn't been updated recently enough. The net result is that the min-hold time for the glock is ignored. If this happens often enough, it leads to poor performance.
This patch adds an additional test, so that if the reply pending bit is set on a glock, then it will select the maximum length of time for the min-hold time, rather than looking at gl_tstamp.
fs/gfs2/glock.c +2 -0
@@ -1265,6 +1265,8 @@ static void blocking_cb(struct gfs2_sbd *sdp, struct lm_lockname *name, holdtime = gl->gl_tchange + gl->gl_ops->go_min_hold_time;if (time_before (now, holdtime)) delay = holdtime - now; +if (test_bit (GLF_REPLY_PENDING , &gl->gl_flags)) + delay = gl->gl_ops->go_min_hold_time;spin_lock (&gl->gl_spin);handle_callback (gl, state,1 , delay);
Signature · 1 line
1.5.5.1
PATCH 6/12 GFS2: Use an IS_ERR test rather than a NULL test
From: Julien Brunel <[email protected]>
In case of error, the function gfs2_inode_lookup returns an ERR pointer, but never returns a NULL pointer. So a NULL test that necessarily comes after an IS_ERR test should be deleted, and a NULL test that may come after a call to this function should be strengthened by an IS_ERR test.
The semantic match that finds this problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// <smpl>
@match_bad_null_test@
expression x, E;
statement S1,S2;
@@
x = gfs2_inode_lookup(...)
... when != x = E
* if (x != NULL)
S1 else S2
// </smpl>
fs/gfs2/inode.c +1 -3
@@ -1033,13 +1033,11 @@ struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name,if (bh)brelse (bh); -if (!inode) -return ERR_PTR (-ENOMEM );return inode; fail_gunlock2:gfs2_glock_dq_uninit (ghs +1 ); -if (inode) +if (inode && !IS_ERR (inode))iput (inode); fail_gunlock:gfs2_glock_dq (ghs);
Signature · 1 line
1.5.5.1
PATCH 7/12 GFS2: Direct IO write at end of file error
From: Bob Peterson <[email protected]>
This patch fixes a problem whereby a direct_io write doesn't fall back to buffered write properly at end of file.
fs/gfs2/ops_address.c +1 -1
@@ -975,7 +975,7 @@ static int gfs2_ok_for_dio(struct gfs2_inode *ip, int rw, loff_t offset)if (gfs2_is_stuffed (ip))return 0 ; -if (offset >i_size_read (&ip->i_inode)) +if (offset >=i_size_read (&ip->i_inode))return 0 ;return 1 ; }
Signature · 1 line
1.5.5.1
PATCH 8/12 GFS2: GFS2 will panic if you misspell any mount options
From: Abhijith Das <[email protected]>
The gfs2 superblock pointer is NULL after a failed mount. When control eventually goes to gfs2_kill_sb, we dereference this NULL pointer. This patch ensures that the gfs2 superblock pointer is not NULL before being dereferenced in gfs2_kill_sb.
fs/gfs2/ops_fstype.c +9 -6
@@ -1237,14 +1237,17 @@ static int gfs2_get_sb_meta(struct file_system_type *fs_type, int flags,static void gfs2_kill_sb (struct super_block *sb) {struct gfs2_sbd *sdp = sb->s_fs_info; -gfs2_meta_syncfs (sdp); -dput (sdp->sd_root_dir); -dput (sdp->sd_master_dir); - sdp->sd_root_dir =NULL ; - sdp->sd_master_dir =NULL ; +if (sdp) { +gfs2_meta_syncfs (sdp); +dput (sdp->sd_root_dir); +dput (sdp->sd_master_dir); + sdp->sd_root_dir =NULL ; + sdp->sd_master_dir =NULL ; + }shrink_dcache_sb (sb);kill_block_super (sb); -gfs2_delete_debugfs_file (sdp); +if (sdp) +gfs2_delete_debugfs_file (sdp); }struct file_system_type gfs2_fs_type = {
Signature · 1 line
1.5.5.1
PATCH 9/12 GFS2: The war on bloat
The following patch shrinks the gfs2_args structure which is embedded in every GFS2 superblock. It cuts down the size of the options to a single unsigned int (the 13 bits of bitfields will be rounded up to that size by the compiler) from the current 11 unsigned ints. So on x86 thats 44 bytes shrinking to 4 bytes, in each and every GFS2 superblock.
fs/gfs2/incore.h +15 -15
@@ -386,21 +386,21 @@ struct gfs2_statfs_change_host {#define GFS2_DATA_ORDERED 2struct gfs2_args { -char ar_lockproto[GFS2_LOCKNAME_LEN ];/* Name of the Lock Protocol */ -char ar_locktable[GFS2_LOCKNAME_LEN ];/* Name of the Lock Table */ -char ar_hostdata[GFS2_LOCKNAME_LEN ];/* Host specific data */ -int ar_spectator;/* Don't get a journal because we're always RO */ -int ar_ignore_local_fs;/* Don't optimize even if local_fs is 1 */ -int ar_localflocks;/* Let the VFS do flock|fcntl locks for us */ -int ar_localcaching;/* Local-style caching (dangerous on multihost) */ -int ar_debug;/* Oops on errors instead of trying to be graceful */ -int ar_upgrade;/* Upgrade ondisk/multihost format */ -unsigned int ar_num_glockd;/* Number of glockd threads */ -int ar_posix_acl;/* Enable posix acls */ -int ar_quota;/* off/account/on */ -int ar_suiddir;/* suiddir support */ -int ar_data;/* ordered/writeback */ -int ar_meta;/* mount metafs */ +char ar_lockproto[GFS2_LOCKNAME_LEN ];/* Name of the Lock Protocol */ +char ar_locktable[GFS2_LOCKNAME_LEN ];/* Name of the Lock Table */ +char ar_hostdata[GFS2_LOCKNAME_LEN ];/* Host specific data */ +unsigned int ar_spectator:1 ;/* Don't get a journal */ +unsigned int ar_ignore_local_fs:1 ;/* Ignore optimisations */ +unsigned int ar_localflocks:1 ;/* Let the VFS do flock|fcntl */ +unsigned int ar_localcaching:1 ;/* Local caching */ +unsigned int ar_debug:1 ;/* Oops on errors */ +unsigned int ar_upgrade:1 ;/* Upgrade ondisk format */ +unsigned int ar_posix_acl:1 ;/* Enable posix acls */ +unsigned int ar_quota:2 ;/* off/account/on */ +unsigned int ar_suiddir:1 ;/* suiddir support */ +unsigned int ar_data:2 ;/* ordered/writeback */ +unsigned int ar_meta:1 ;/* mount metafs */ +unsigned int ar_num_glockd;/* Number of glockd threads */ };struct gfs2_tune {
Signature · 1 line
1.5.5.1
PATCH 10/12 GFS2: high time to take some time over atime
Until now, we've used the same scheme as GFS1 for atime. This has failed since atime is a per vfsmnt flag, not a per fs flag and as such the "noatime" flag was not getting passed down to the filesystems. This patch removes all the "special casing" around atime updates and we simply use the VFS's atime code.
The net result is that GFS2 will now support all the same atime related mount options of any other filesystem on a per-vfsmnt basis. We do lose the "lazy atime" updates, but we gain "relatime". We could add lazy atime to the VFS at a later date, if there is a requirement for that variant still - I suspect relatime will be enough.
Also we lose about 100 lines of code after this patch has been applied, and I have a suspicion that it will speed things up a bit, even when atime is "on". So it seems like a nice clean up as well.
From a user perspective, everything stays the same except the loss of the per-fs atime quantum tweekable (ought to be per-vfsmnt at the very least, and to be honest I don't think anybody ever used it) and that a number of options which were ignored before now work correctly.
Please let me know if you've got any comments. I'm pushing this out early so that you can all see what my plans are.
fs/gfs2/glock.c +0 -2
@@ -1580,8 +1580,6 @@ static const char *hflags2str(char *buf, unsigned flags, unsigned long iflags) *p++ ='a' ;if (flags &GL_EXACT ) *p++ ='E' ; -if (flags &GL_ATIME ) - *p++ ='a' ;if (flags &GL_NOCACHE ) *p++ ='c' ;if (test_bit (HIF_HOLDER , &iflags))
fs/gfs2/glock.h +0 -1
@@ -24,7 +24,6 @@#define GL_ASYNC 0x00000040#define GL_EXACT 0x00000080#define GL_SKIP 0x00000100 -#define GL_ATIME 0x00000200#define GL_NOCACHE 0x00000400#define GLR_TRYFAILED 13
fs/gfs2/incore.h +0 -2
@@ -420,7 +420,6 @@ struct gfs2_tune {unsigned int gt_quota_scale_den;/* Denominator */ unsigned int gt_quota_cache_secs;unsigned int gt_quota_quantum;/* Secs between syncs to quota file */ -unsigned int gt_atime_quantum;/* Min secs between atime updates */ unsigned int gt_new_files_jdata;unsigned int gt_max_readahead;/* Max bytes to read-ahead from disk */ unsigned int gt_stall_secs;/* Detects trouble! */
@@ -433,7 +432,6 @@ enum {SDF_JOURNAL_CHECKED =0 ,SDF_JOURNAL_LIVE =1 , SDF_SHUTDOWN = 2, - SDF_NOATIME = 3, };#define GFS2_FSNAME_LEN 256
fs/gfs2/inode.c +8 -99
137 lines not on this page · raw message
fs/gfs2/inode.h +0 -1
@@ -92,7 +92,6 @@ int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name, const struct gfs2_inode *ip);int gfs2_permission (struct inode *inode,int mask);int gfs2_readlinki (struct gfs2_inode *ip,char **buf,unsigned int *len); -int gfs2_glock_nq_atime (struct gfs2_holder *gh);int gfs2_setattr_simple (struct gfs2_inode *ip,struct iattr *attr);struct inode *gfs2_lookup_simple (struct inode *dip,const char *name);void gfs2_dinode_out (const struct gfs2_inode *ip,void *buf);
fs/gfs2/ops_address.c +8 -8
@@ -512,8 +512,8 @@ static int gfs2_readpage(struct file *file, struct page *page)int error;unlock_page (page); -gfs2_holder_init (ip->i_gl,LM_ST_SHARED ,GL_ATIME , &gh); - error =gfs2_glock_nq_atime (&gh); +gfs2_holder_init (ip->i_gl,LM_ST_SHARED ,0 , &gh); + error =gfs2_glock_nq (&gh);if (unlikely (error)) goto out; error =AOP_TRUNCATED_PAGE ;
@@ -594,8 +594,8 @@ static int gfs2_readpages(struct file *file, struct address_space *mapping,struct gfs2_holder gh;int ret; -gfs2_holder_init (ip->i_gl,LM_ST_SHARED ,GL_ATIME , &gh); - ret =gfs2_glock_nq_atime (&gh); +gfs2_holder_init (ip->i_gl,LM_ST_SHARED ,0 , &gh); + ret =gfs2_glock_nq (&gh);if (unlikely (ret)) goto out_uninit;if (!gfs2_is_stuffed (ip))
@@ -636,8 +636,8 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping,unsigned to = from + len;struct page *page; -gfs2_holder_init (ip->i_gl,LM_ST_EXCLUSIVE ,GL_ATIME , &ip->i_gh); - error =gfs2_glock_nq_atime (&ip->i_gh); +gfs2_holder_init (ip->i_gl,LM_ST_EXCLUSIVE ,0 , &ip->i_gh); + error =gfs2_glock_nq (&ip->i_gh);if (unlikely (error)) goto out_uninit;
@@ -1000,8 +1000,8 @@ static ssize_t gfs2_direct_IO(int rw, struct kiocb *iocb,* unfortunately have the option of only flushing a range like * the VFS does. */ -gfs2_holder_init (ip->i_gl,LM_ST_DEFERRED ,GL_ATIME , &gh); - rv =gfs2_glock_nq_atime (&gh); +gfs2_holder_init (ip->i_gl,LM_ST_DEFERRED ,0 , &gh); + rv =gfs2_glock_nq (&gh);if (rv)return rv; rv =gfs2_ok_for_dio (ip, rw, offset);
fs/gfs2/ops_file.c +8 -8
@@ -89,8 +89,8 @@ static int gfs2_readdir(struct file *file, void *dirent, filldir_t filldir)u64 offset = file->f_pos;int error; -gfs2_holder_init (dip->i_gl,LM_ST_SHARED ,GL_ATIME , &d_gh); - error =gfs2_glock_nq_atime (&d_gh); +gfs2_holder_init (dip->i_gl,LM_ST_SHARED ,0 , &d_gh); + error =gfs2_glock_nq (&d_gh);if (error) {gfs2_holder_uninit (&d_gh);return error;
@@ -153,8 +153,8 @@ static int gfs2_get_flags(struct file *filp, u32 __user *ptr)int error;u32 fsflags; -gfs2_holder_init (ip->i_gl,LM_ST_SHARED ,GL_ATIME , &gh); - error =gfs2_glock_nq_atime (&gh); +gfs2_holder_init (ip->i_gl,LM_ST_SHARED ,0 , &gh); + error =gfs2_glock_nq (&gh);if (error)return error;
@@ -351,8 +351,8 @@ static int gfs2_page_mkwrite(struct vm_area_struct *vma, struct page *page)struct gfs2_alloc *al;int ret; -gfs2_holder_init (ip->i_gl,LM_ST_EXCLUSIVE ,GL_ATIME , &gh); - ret =gfs2_glock_nq_atime (&gh); +gfs2_holder_init (ip->i_gl,LM_ST_EXCLUSIVE ,0 , &gh); + ret =gfs2_glock_nq (&gh);if (ret) goto out;
@@ -434,8 +434,8 @@ static int gfs2_mmap(struct file *file, struct vm_area_struct *vma)struct gfs2_holder i_gh;int error; -gfs2_holder_init (ip->i_gl,LM_ST_SHARED ,GL_ATIME , &i_gh); - error =gfs2_glock_nq_atime (&i_gh); +gfs2_holder_init (ip->i_gl,LM_ST_SHARED ,0 , &i_gh); + error =gfs2_glock_nq (&i_gh);if (error) {gfs2_holder_uninit (&i_gh);return error;
fs/gfs2/ops_fstype.c +5 -18
@@ -70,7 +70,6 @@ static void gfs2_tune_init(struct gfs2_tune *gt) gt->gt_quota_scale_den =1 ; gt->gt_quota_cache_secs =300 ; gt->gt_quota_quantum =60 ; - gt->gt_atime_quantum =3600 ; gt->gt_new_files_jdata =0 ; gt->gt_max_readahead =1 <<18 ; gt->gt_stall_secs =600 ;
@@ -135,22 +134,6 @@ static struct gfs2_sbd *init_sbd(struct super_block *sb)return sdp; } -static void init_vfs (struct super_block *sb,unsigned noatime) -{ -struct gfs2_sbd *sdp = sb->s_fs_info; - - sb->s_magic =GFS2_MAGIC ; - sb->s_op = &gfs2_super_ops; - sb->s_export_op = &gfs2_export_ops; - sb->s_time_gran =1 ; - sb->s_maxbytes =MAX_LFS_FILESIZE ; - -if (sb->s_flags & (MS_NOATIME |MS_NODIRATIME )) -set_bit (noatime, &sdp->sd_flags); - -/* Don't let the VFS update atimes. GFS2 handles this itself. */ - sb->s_flags |=MS_NOATIME |MS_NODIRATIME ; -}/** * gfs2_check_sb - Check superblock
@@ -1100,7 +1083,11 @@ static int fill_super(struct super_block *sb, void *data, int silent) goto fail; } -init_vfs (sb,SDF_NOATIME ); + sb->s_magic =GFS2_MAGIC ; + sb->s_op = &gfs2_super_ops; + sb->s_export_op = &gfs2_export_ops; + sb->s_time_gran =1 ; + sb->s_maxbytes =MAX_LFS_FILESIZE ;/* Set up the buffer cache and fill in some fake block size values to allow us to read-in the on-disk superblock. */
fs/gfs2/ops_super.c +36 -17
78 lines not on this page · raw message
fs/gfs2/sys.c +0 -11
@@ -269,14 +269,6 @@ ARGS_ATTR(quota, "%u\n");ARGS_ATTR (suiddir,"%d\n" );ARGS_ATTR (data,"%d\n" ); -/* one oddball doesn't fit the macro mold */ -static ssize_t noatime_show (struct gfs2_sbd *sdp,char *buf) -{ -return snprintf (buf,PAGE_SIZE ,"%d\n" , - !!test_bit (SDF_NOATIME , &sdp->sd_flags)); -} -static struct args_attr args_attr_noatime =__ATTR_RO (noatime); -static struct attribute *args_attrs[] = { &args_attr_lockproto.attr, &args_attr_locktable.attr,
@@ -292,7 +284,6 @@ static struct attribute *args_attrs[] = { &args_attr_quota.attr, &args_attr_suiddir.attr, &args_attr_data.attr, - &args_attr_noatime.attr, NULL, };
@@ -407,7 +398,6 @@ TUNE_ATTR(incore_log_blocks, 0);TUNE_ATTR (log_flush_secs,0 );TUNE_ATTR (quota_warn_period,0 );TUNE_ATTR (quota_quantum,0 ); -TUNE_ATTR (atime_quantum,0 );TUNE_ATTR (max_readahead,0 );TUNE_ATTR (complain_secs,0 );TUNE_ATTR (statfs_slow,0 );
@@ -427,7 +417,6 @@ static struct attribute *tune_attrs[] = { &tune_attr_log_flush_secs.attr, &tune_attr_quota_warn_period.attr, &tune_attr_quota_quantum.attr, - &tune_attr_atime_quantum.attr, &tune_attr_max_readahead.attr, &tune_attr_complain_secs.attr, &tune_attr_statfs_slow.attr,
Signature · 1 line
1.5.5.1
PATCH 11/12 GFS2: Add UUID to GFS2 sb
This patch adds a UUID to the GFS2 sb structure. This field is not actually referenced from kernel space at all, but is added for completeness and due to the userland tools which get their on-disk structure information from the gfs2_ondisk.h header file.
Since we have to be backwards compatible, we will assume that any GFS2 sb for which the UUID is all 0 does not have a UUID as such.
We should then be (after some userland changes) able to support the -U mount option. This addresses Fedora bugzilla #242689
include/linux/gfs2_ondisk.h +5 -1
@@ -118,7 +118,11 @@ struct gfs2_sb {char sb_lockproto[GFS2_LOCKNAME_LEN ];char sb_locktable[GFS2_LOCKNAME_LEN ]; -/* In gfs1, quota and license dinodes followed */ + +struct gfs2_inum __pad3;/* Was quota inode in gfs1 */ +struct gfs2_inum __pad4;/* Was licence inode in gfs1 */ +#define GFS2_HAS_UUID 1 +__u8 sb_uuid[16 ];/* The UUID, maybe 0 for backwards compat */ };/*
Signature · 1 line
1.5.5.1
PATCH 12/12 GFS2: Support for I/O barriers
This patch adds barrier support to GFS2. There is not a lot of change really... we just add the barrier flag when we write journal header blocks. If the underlying device refuses to support them, we fall back to the previous way of doing things (wait for the I/O and hope) since there is nothing else we can do. There is no user configuration, barriers will always be on unless the device refuses to support them. This seems a reasonable solution to me since this is a correctness issue.
fs/gfs2/incore.h +1 -0
@@ -432,6 +432,7 @@ enum {SDF_JOURNAL_CHECKED =0 ,SDF_JOURNAL_LIVE =1 ,SDF_SHUTDOWN =2 , + SDF_NOBARRIERS = 3, };#define GFS2_FSNAME_LEN 256
fs/gfs2/log.c +18 -3
@@ -18,6 +18,7 @@#include <linux/delay.h> #include <linux/kthread.h> #include <linux/freezer.h> +#include <linux/bio.h> #include "gfs2.h" #include "incore.h"
@@ -584,7 +585,6 @@ static void log_write_header(struct gfs2_sbd *sdp, u32 flags, int pull)memset (bh->b_data,0 , bh->b_size);set_buffer_uptodate (bh);clear_buffer_dirty (bh); -unlock_buffer (bh);gfs2_ail1_empty (sdp,0 ); tail =current_tail (sdp);
@@ -601,8 +601,23 @@ static void log_write_header(struct gfs2_sbd *sdp, u32 flags, int pull) hash =gfs2_disk_hash (bh->b_data,sizeof (struct gfs2_log_header )); lh->lh_hash =cpu_to_be32 (hash); -set_buffer_dirty (bh); -if (sync_dirty_buffer (bh)) + bh->b_end_io = end_buffer_write_sync; +if (test_bit (SDF_NOBARRIERS , &sdp->sd_flags)) + goto skip_barrier; +get_bh (bh); +submit_bh (WRITE_BARRIER | (1 <<BIO_RW_META ), bh); +wait_on_buffer (bh); +if (buffer_eopnotsupp (bh)) { +clear_buffer_eopnotsupp (bh); +set_buffer_uptodate (bh); +set_bit (SDF_NOBARRIERS , &sdp->sd_flags); +lock_buffer (bh); +skip_barrier: +get_bh (bh); +submit_bh (WRITE_SYNC | (1 <<BIO_RW_META ), bh); +wait_on_buffer (bh); + } +if (!buffer_uptodate (bh))gfs2_io_error_bh (sdp, bh);brelse (bh);
Signature · 1 line
1.5.5.1