All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: xfs@oss.sgi.com
Subject: [PATCH v3 3/4] xfs: replace on-stack xfs_trans_res with pointer in xfs_create()
Date: Tue, 15 Apr 2014 12:18:25 -0400	[thread overview]
Message-ID: <1397578706-5385-4-git-send-email-bfoster@redhat.com> (raw)
In-Reply-To: <1397578706-5385-1-git-send-email-bfoster@redhat.com>

There's no need to store a full struct xfs_trans_res on the stack in
xfs_create() and copy the fields. Use a pointer to the appropriate
structures embedded in the xfs_mount.

Signed-off-by: Brian Foster <bfoster@redhat.com>
---
 fs/xfs/xfs_inode.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 0e63c7d..f8a232a 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -1158,7 +1158,7 @@ xfs_create(
 	struct xfs_dquot	*udqp = NULL;
 	struct xfs_dquot	*gdqp = NULL;
 	struct xfs_dquot	*pdqp = NULL;
-	struct xfs_trans_res	tres;
+	struct xfs_trans_res	*tres;
 	uint			resblks;
 
 	trace_xfs_create(dp, name);
@@ -1181,13 +1181,11 @@ xfs_create(
 	if (is_dir) {
 		rdev = 0;
 		resblks = XFS_MKDIR_SPACE_RES(mp, name->len);
-		tres.tr_logres = M_RES(mp)->tr_mkdir.tr_logres;
-		tres.tr_logcount = XFS_MKDIR_LOG_COUNT;
+		tres = &M_RES(mp)->tr_mkdir;
 		tp = xfs_trans_alloc(mp, XFS_TRANS_MKDIR);
 	} else {
 		resblks = XFS_CREATE_SPACE_RES(mp, name->len);
-		tres.tr_logres = M_RES(mp)->tr_create.tr_logres;
-		tres.tr_logcount = XFS_CREATE_LOG_COUNT;
+		tres = &M_RES(mp)->tr_create;
 		tp = xfs_trans_alloc(mp, XFS_TRANS_CREATE);
 	}
 
@@ -1199,17 +1197,16 @@ xfs_create(
 	 * the case we'll drop the one we have and get a more
 	 * appropriate transaction later.
 	 */
-	tres.tr_logflags = XFS_TRANS_PERM_LOG_RES;
-	error = xfs_trans_reserve(tp, &tres, resblks, 0);
+	error = xfs_trans_reserve(tp, tres, resblks, 0);
 	if (error == ENOSPC) {
 		/* flush outstanding delalloc blocks and retry */
 		xfs_flush_inodes(mp);
-		error = xfs_trans_reserve(tp, &tres, resblks, 0);
+		error = xfs_trans_reserve(tp, tres, resblks, 0);
 	}
 	if (error == ENOSPC) {
 		/* No space at all so try a "no-allocation" reservation */
 		resblks = 0;
-		error = xfs_trans_reserve(tp, &tres, 0, 0);
+		error = xfs_trans_reserve(tp, tres, 0, 0);
 	}
 	if (error) {
 		cancel_flags = 0;
-- 
1.8.3.1

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  parent reply	other threads:[~2014-04-15 16:18 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-15 16:18 [PATCH v3 0/4] xfs: tmpfile fixes Brian Foster
2014-04-15 16:18 ` [PATCH v3 1/4] xfs: fix tmpfile/selinux ilock deadlock Brian Foster
2014-04-15 17:47   ` Christoph Hellwig
2014-04-15 16:18 ` [PATCH v3 2/4] xfs: initialize inode security on tmpfile creation Brian Foster
2014-04-15 17:50   ` Christoph Hellwig
2014-04-15 17:50     ` Christoph Hellwig
2014-04-15 20:04     ` Stephen Smalley
2014-04-15 20:16       ` Stephen Smalley
2014-04-15 20:22       ` Christoph Hellwig
2014-04-15 20:22         ` Christoph Hellwig
2014-04-15 20:21         ` Stephen Smalley
2014-04-16 12:51           ` Stephen Smalley
2014-04-16 14:14             ` Christoph Hellwig
2014-04-16 14:14               ` Christoph Hellwig
2014-04-16 14:14               ` Stephen Smalley
2014-04-16 14:14                 ` Stephen Smalley
2014-04-15 16:18 ` Brian Foster [this message]
2014-04-15 17:50   ` [PATCH v3 3/4] xfs: replace on-stack xfs_trans_res with pointer in xfs_create() Christoph Hellwig
2014-04-15 16:18 ` [PATCH v3 4/4] xfs: fold xfs_create_tmpfile() into xfs_create() Brian Foster
2014-04-15 17:51   ` Christoph Hellwig
2014-04-15 21:59 ` [PATCH v3 0/4] xfs: tmpfile fixes Dave Chinner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1397578706-5385-4-git-send-email-bfoster@redhat.com \
    --to=bfoster@redhat.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.