aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/ops_inode.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2011-05-09 08:30:08 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2011-05-09 11:43:53 -0400
commit3d6ecb7d16fd4248fce58387a982a0756ad3fcc2 (patch)
treeb988b57c8a46fcfabe3738ccdb8982d67cd24c97 /fs/gfs2/ops_inode.c
parent855d23ce2665c56437bd88fa6a0d45b6713bd194 (diff)
GFS2: When adding a new dir entry, inc link count if it is a subdir
This adds an increment of the link count when we add a new directory entry, if that entry is itself a directory. This means that we no longer need separate code to perform this operation. Now that both adding and removing directory entries automatically update the parent directory's link count if required, that makes the code shorter and simpler than before. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/ops_inode.c')
-rw-r--r--fs/gfs2/ops_inode.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c
index 765da06c8f55..6b8c2bdb5a0c 100644
--- a/fs/gfs2/ops_inode.c
+++ b/fs/gfs2/ops_inode.c
@@ -235,7 +235,7 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
235 if (error) 235 if (error)
236 goto out_end_trans; 236 goto out_end_trans;
237 237
238 error = gfs2_dir_add(dir, &dentry->d_name, ip, IF2DT(inode->i_mode)); 238 error = gfs2_dir_add(dir, &dentry->d_name, ip);
239 if (error) 239 if (error)
240 goto out_brelse; 240 goto out_brelse;
241 241
@@ -554,9 +554,6 @@ static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, int mode)
554 brelse(dibh); 554 brelse(dibh);
555 } 555 }
556 556
557 error = gfs2_change_nlink(dip, +1);
558 gfs2_assert_withdraw(sdp, !error); /* dip already pinned */
559
560 gfs2_trans_end(sdp); 557 gfs2_trans_end(sdp);
561 if (dip->i_alloc->al_rgd) 558 if (dip->i_alloc->al_rgd)
562 gfs2_inplace_release(dip); 559 gfs2_inplace_release(dip);
@@ -857,10 +854,6 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
857 } 854 }
858 855
859 if (dir_rename) { 856 if (dir_rename) {
860 error = gfs2_change_nlink(ndip, +1);
861 if (error)
862 goto out_end_trans;
863
864 error = gfs2_dir_mvino(ip, &gfs2_qdotdot, ndip, DT_DIR); 857 error = gfs2_dir_mvino(ip, &gfs2_qdotdot, ndip, DT_DIR);
865 if (error) 858 if (error)
866 goto out_end_trans; 859 goto out_end_trans;
@@ -879,7 +872,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
879 if (error) 872 if (error)
880 goto out_end_trans; 873 goto out_end_trans;
881 874
882 error = gfs2_dir_add(ndir, &ndentry->d_name, ip, IF2DT(ip->i_inode.i_mode)); 875 error = gfs2_dir_add(ndir, &ndentry->d_name, ip);
883 if (error) 876 if (error)
884 goto out_end_trans; 877 goto out_end_trans;
885 878