aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/gfs2/inode.c')
-rw-r--r--fs/gfs2/inode.c41
1 files changed, 24 insertions, 17 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 5f6dc32946cd..728d3169e7bd 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -31,7 +31,6 @@
31#include "log.h" 31#include "log.h"
32#include "meta_io.h" 32#include "meta_io.h"
33#include "ops_address.h" 33#include "ops_address.h"
34#include "ops_file.h"
35#include "ops_inode.h" 34#include "ops_inode.h"
36#include "quota.h" 35#include "quota.h"
37#include "rgrp.h" 36#include "rgrp.h"
@@ -132,15 +131,21 @@ static struct inode *gfs2_iget_skip(struct super_block *sb,
132 131
133void gfs2_set_iop(struct inode *inode) 132void gfs2_set_iop(struct inode *inode)
134{ 133{
134 struct gfs2_sbd *sdp = GFS2_SB(inode);
135 umode_t mode = inode->i_mode; 135 umode_t mode = inode->i_mode;
136 136
137 if (S_ISREG(mode)) { 137 if (S_ISREG(mode)) {
138 inode->i_op = &gfs2_file_iops; 138 inode->i_op = &gfs2_file_iops;
139 inode->i_fop = &gfs2_file_fops; 139 if (sdp->sd_args.ar_localflocks)
140 inode->i_mapping->a_ops = &gfs2_file_aops; 140 inode->i_fop = &gfs2_file_fops_nolock;
141 else
142 inode->i_fop = &gfs2_file_fops;
141 } else if (S_ISDIR(mode)) { 143 } else if (S_ISDIR(mode)) {
142 inode->i_op = &gfs2_dir_iops; 144 inode->i_op = &gfs2_dir_iops;
143 inode->i_fop = &gfs2_dir_fops; 145 if (sdp->sd_args.ar_localflocks)
146 inode->i_fop = &gfs2_dir_fops_nolock;
147 else
148 inode->i_fop = &gfs2_dir_fops;
144 } else if (S_ISLNK(mode)) { 149 } else if (S_ISLNK(mode)) {
145 inode->i_op = &gfs2_symlink_iops; 150 inode->i_op = &gfs2_symlink_iops;
146 } else { 151 } else {
@@ -291,12 +296,10 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)
291 di->di_entries = be32_to_cpu(str->di_entries); 296 di->di_entries = be32_to_cpu(str->di_entries);
292 297
293 di->di_eattr = be64_to_cpu(str->di_eattr); 298 di->di_eattr = be64_to_cpu(str->di_eattr);
294 return 0; 299 if (S_ISREG(ip->i_inode.i_mode))
295} 300 gfs2_set_aops(&ip->i_inode);
296 301
297static void gfs2_inode_bh(struct gfs2_inode *ip, struct buffer_head *bh) 302 return 0;
298{
299 ip->i_cache[0] = bh;
300} 303}
301 304
302/** 305/**
@@ -366,7 +369,8 @@ int gfs2_dinode_dealloc(struct gfs2_inode *ip)
366 if (error) 369 if (error)
367 goto out_rg_gunlock; 370 goto out_rg_gunlock;
368 371
369 gfs2_trans_add_gl(ip->i_gl); 372 set_bit(GLF_DIRTY, &ip->i_gl->gl_flags);
373 set_bit(GLF_LFLUSH, &ip->i_gl->gl_flags);
370 374
371 gfs2_free_di(rgd, ip); 375 gfs2_free_di(rgd, ip);
372 376
@@ -707,9 +711,10 @@ static int alloc_dinode(struct gfs2_inode *dip, u64 *no_addr, u64 *generation)
707 struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); 711 struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode);
708 int error; 712 int error;
709 713
710 gfs2_alloc_get(dip); 714 if (gfs2_alloc_get(dip) == NULL)
715 return -ENOMEM;
711 716
712 dip->i_alloc.al_requested = RES_DINODE; 717 dip->i_alloc->al_requested = RES_DINODE;
713 error = gfs2_inplace_reserve(dip); 718 error = gfs2_inplace_reserve(dip);
714 if (error) 719 if (error)
715 goto out; 720 goto out;
@@ -855,7 +860,7 @@ static int link_dinode(struct gfs2_inode *dip, const struct qstr *name,
855 860
856 error = alloc_required = gfs2_diradd_alloc_required(&dip->i_inode, name); 861 error = alloc_required = gfs2_diradd_alloc_required(&dip->i_inode, name);
857 if (alloc_required < 0) 862 if (alloc_required < 0)
858 goto fail; 863 goto fail_quota_locks;
859 if (alloc_required) { 864 if (alloc_required) {
860 error = gfs2_quota_check(dip, dip->i_inode.i_uid, dip->i_inode.i_gid); 865 error = gfs2_quota_check(dip, dip->i_inode.i_uid, dip->i_inode.i_gid);
861 if (error) 866 if (error)
@@ -896,7 +901,7 @@ fail_end_trans:
896 gfs2_trans_end(sdp); 901 gfs2_trans_end(sdp);
897 902
898fail_ipreserv: 903fail_ipreserv:
899 if (dip->i_alloc.al_rgd) 904 if (dip->i_alloc->al_rgd)
900 gfs2_inplace_release(dip); 905 gfs2_inplace_release(dip);
901 906
902fail_quota_locks: 907fail_quota_locks:
@@ -966,7 +971,7 @@ struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name,
966 struct gfs2_inum_host inum = { .no_addr = 0, .no_formal_ino = 0 }; 971 struct gfs2_inum_host inum = { .no_addr = 0, .no_formal_ino = 0 };
967 int error; 972 int error;
968 u64 generation; 973 u64 generation;
969 struct buffer_head *bh=NULL; 974 struct buffer_head *bh = NULL;
970 975
971 if (!name->len || name->len > GFS2_FNAMESIZE) 976 if (!name->len || name->len > GFS2_FNAMESIZE)
972 return ERR_PTR(-ENAMETOOLONG); 977 return ERR_PTR(-ENAMETOOLONG);
@@ -1003,8 +1008,6 @@ struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name,
1003 if (IS_ERR(inode)) 1008 if (IS_ERR(inode))
1004 goto fail_gunlock2; 1009 goto fail_gunlock2;
1005 1010
1006 gfs2_inode_bh(GFS2_I(inode), bh);
1007
1008 error = gfs2_inode_refresh(GFS2_I(inode)); 1011 error = gfs2_inode_refresh(GFS2_I(inode));
1009 if (error) 1012 if (error)
1010 goto fail_gunlock2; 1013 goto fail_gunlock2;
@@ -1021,6 +1024,8 @@ struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name,
1021 if (error) 1024 if (error)
1022 goto fail_gunlock2; 1025 goto fail_gunlock2;
1023 1026
1027 if (bh)
1028 brelse(bh);
1024 if (!inode) 1029 if (!inode)
1025 return ERR_PTR(-ENOMEM); 1030 return ERR_PTR(-ENOMEM);
1026 return inode; 1031 return inode;
@@ -1032,6 +1037,8 @@ fail_gunlock2:
1032fail_gunlock: 1037fail_gunlock:
1033 gfs2_glock_dq(ghs); 1038 gfs2_glock_dq(ghs);
1034fail: 1039fail:
1040 if (bh)
1041 brelse(bh);
1035 return ERR_PTR(error); 1042 return ERR_PTR(error);
1036} 1043}
1037 1044