aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/inode.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-11-10 17:11:00 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-10 17:11:00 -0500
commit8b5baa460b69c27389353eeff0dbe51dc695da60 (patch)
treeca98029be4e114b35f227ae8b2851351c3d489d1 /fs/gfs2/inode.c
parent6c86ae2928f9e4cbf0d5844f5fcfd549e3450b8c (diff)
parent2147dbfd059eb7fefcfd5934f74f25f0693d4a1f (diff)
Merge tag 'gfs2-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-3.0-nmw
Pull gfs2 updates from Steven Whitehouse: "The main feature of interest this time is quota updates. There are some clean ups and some patches to use the new generic lru list code. There is still plenty of scope for some further changes in due course - faster lookups of quota structures is very much on the todo list. Also, a start has been made towards the more tricky issue of using the generic lru code with glocks, but that will have to be completed in a subsequent merge window. The other, more minor feature, is that there have been a number of performance patches which relate to block allocation. In particular they will improve performance when the disk is nearly full" * tag 'gfs2-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-3.0-nmw: GFS2: Use generic list_lru for quota GFS2: Rename quota qd_lru_lock qd_lock GFS2: Use reflink for quota data cache GFS2: Use lockref for glocks GFS2: Protect quota sync generation GFS2: Inline qd_trylock into gfs2_quota_unlock GFS2: Make two similar quota code fragments into a function GFS2: Remove obsolete quota tunable GFS2: Move gfs2_icbit_munge into quota.c GFS2: Speed up starting point selection for block allocation GFS2: Add allocation parameters structure GFS2: Clean up reservation removal GFS2: fix dentry leaks GFS2: new function gfs2_rbm_incr GFS2: Introduce rbm field bii GFS2: Do not reset flags on active reservations GFS2: introduce bi_blocks for optimization GFS2: optimize rbm_from_block wrt bi_start GFS2: d_splice_alias() can't return error
Diffstat (limited to 'fs/gfs2/inode.c')
-rw-r--r--fs/gfs2/inode.c44
1 files changed, 26 insertions, 18 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index ced3257f06e8..109ce9325b76 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -379,6 +379,7 @@ static void munge_mode_uid_gid(const struct gfs2_inode *dip,
379static int alloc_dinode(struct gfs2_inode *ip, u32 flags) 379static int alloc_dinode(struct gfs2_inode *ip, u32 flags)
380{ 380{
381 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); 381 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
382 struct gfs2_alloc_parms ap = { .target = RES_DINODE, .aflags = flags, };
382 int error; 383 int error;
383 int dblocks = 1; 384 int dblocks = 1;
384 385
@@ -386,7 +387,7 @@ static int alloc_dinode(struct gfs2_inode *ip, u32 flags)
386 if (error) 387 if (error)
387 goto out; 388 goto out;
388 389
389 error = gfs2_inplace_reserve(ip, RES_DINODE, flags); 390 error = gfs2_inplace_reserve(ip, &ap);
390 if (error) 391 if (error)
391 goto out_quota; 392 goto out_quota;
392 393
@@ -472,6 +473,7 @@ static int link_dinode(struct gfs2_inode *dip, const struct qstr *name,
472 struct gfs2_inode *ip, int arq) 473 struct gfs2_inode *ip, int arq)
473{ 474{
474 struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); 475 struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode);
476 struct gfs2_alloc_parms ap = { .target = sdp->sd_max_dirres, };
475 int error; 477 int error;
476 478
477 if (arq) { 479 if (arq) {
@@ -479,7 +481,7 @@ static int link_dinode(struct gfs2_inode *dip, const struct qstr *name,
479 if (error) 481 if (error)
480 goto fail_quota_locks; 482 goto fail_quota_locks;
481 483
482 error = gfs2_inplace_reserve(dip, sdp->sd_max_dirres, 0); 484 error = gfs2_inplace_reserve(dip, &ap);
483 if (error) 485 if (error)
484 goto fail_quota_locks; 486 goto fail_quota_locks;
485 487
@@ -584,17 +586,17 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
584 if (!IS_ERR(inode)) { 586 if (!IS_ERR(inode)) {
585 d = d_splice_alias(inode, dentry); 587 d = d_splice_alias(inode, dentry);
586 error = 0; 588 error = 0;
587 if (file && !IS_ERR(d)) { 589 if (file) {
588 if (d == NULL) 590 if (S_ISREG(inode->i_mode)) {
589 d = dentry; 591 WARN_ON(d != NULL);
590 if (S_ISREG(inode->i_mode)) 592 error = finish_open(file, dentry, gfs2_open_common, opened);
591 error = finish_open(file, d, gfs2_open_common, opened); 593 } else {
592 else
593 error = finish_no_open(file, d); 594 error = finish_no_open(file, d);
595 }
596 } else {
597 dput(d);
594 } 598 }
595 gfs2_glock_dq_uninit(ghs); 599 gfs2_glock_dq_uninit(ghs);
596 if (IS_ERR(d))
597 return PTR_ERR(d);
598 return error; 600 return error;
599 } else if (error != -ENOENT) { 601 } else if (error != -ENOENT) {
600 goto fail_gunlock; 602 goto fail_gunlock;
@@ -713,7 +715,7 @@ fail_gunlock2:
713fail_free_inode: 715fail_free_inode:
714 if (ip->i_gl) 716 if (ip->i_gl)
715 gfs2_glock_put(ip->i_gl); 717 gfs2_glock_put(ip->i_gl);
716 gfs2_rs_delete(ip); 718 gfs2_rs_delete(ip, NULL);
717 free_inode_nonrcu(inode); 719 free_inode_nonrcu(inode);
718 inode = NULL; 720 inode = NULL;
719fail_gunlock: 721fail_gunlock:
@@ -781,8 +783,10 @@ static struct dentry *__gfs2_lookup(struct inode *dir, struct dentry *dentry,
781 error = finish_open(file, dentry, gfs2_open_common, opened); 783 error = finish_open(file, dentry, gfs2_open_common, opened);
782 784
783 gfs2_glock_dq_uninit(&gh); 785 gfs2_glock_dq_uninit(&gh);
784 if (error) 786 if (error) {
787 dput(d);
785 return ERR_PTR(error); 788 return ERR_PTR(error);
789 }
786 return d; 790 return d;
787} 791}
788 792
@@ -874,11 +878,12 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
874 error = 0; 878 error = 0;
875 879
876 if (alloc_required) { 880 if (alloc_required) {
881 struct gfs2_alloc_parms ap = { .target = sdp->sd_max_dirres, };
877 error = gfs2_quota_lock_check(dip); 882 error = gfs2_quota_lock_check(dip);
878 if (error) 883 if (error)
879 goto out_gunlock; 884 goto out_gunlock;
880 885
881 error = gfs2_inplace_reserve(dip, sdp->sd_max_dirres, 0); 886 error = gfs2_inplace_reserve(dip, &ap);
882 if (error) 887 if (error)
883 goto out_gunlock_q; 888 goto out_gunlock_q;
884 889
@@ -1163,14 +1168,16 @@ static int gfs2_atomic_open(struct inode *dir, struct dentry *dentry,
1163 d = __gfs2_lookup(dir, dentry, file, opened); 1168 d = __gfs2_lookup(dir, dentry, file, opened);
1164 if (IS_ERR(d)) 1169 if (IS_ERR(d))
1165 return PTR_ERR(d); 1170 return PTR_ERR(d);
1166 if (d == NULL) 1171 if (d != NULL)
1167 d = dentry; 1172 dentry = d;
1168 if (d->d_inode) { 1173 if (dentry->d_inode) {
1169 if (!(*opened & FILE_OPENED)) 1174 if (!(*opened & FILE_OPENED))
1170 return finish_no_open(file, d); 1175 return finish_no_open(file, dentry);
1176 dput(d);
1171 return 0; 1177 return 0;
1172 } 1178 }
1173 1179
1180 BUG_ON(d != NULL);
1174 if (!(flags & O_CREAT)) 1181 if (!(flags & O_CREAT))
1175 return -ENOENT; 1182 return -ENOENT;
1176 1183
@@ -1385,11 +1392,12 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
1385 goto out_gunlock; 1392 goto out_gunlock;
1386 1393
1387 if (alloc_required) { 1394 if (alloc_required) {
1395 struct gfs2_alloc_parms ap = { .target = sdp->sd_max_dirres, };
1388 error = gfs2_quota_lock_check(ndip); 1396 error = gfs2_quota_lock_check(ndip);
1389 if (error) 1397 if (error)
1390 goto out_gunlock; 1398 goto out_gunlock;
1391 1399
1392 error = gfs2_inplace_reserve(ndip, sdp->sd_max_dirres, 0); 1400 error = gfs2_inplace_reserve(ndip, &ap);
1393 if (error) 1401 if (error)
1394 goto out_gunlock_q; 1402 goto out_gunlock_q;
1395 1403