public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Allison Henderson <allison.henderson@oracle.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 14/21] Add lock_flags to xfs_ialloc and xfs_dir_ialloc
Date: Mon, 7 May 2018 15:30:06 -0700	[thread overview]
Message-ID: <20180507223006.GH11261@magnolia> (raw)
In-Reply-To: <1525627494-12873-15-git-send-email-allison.henderson@oracle.com>

On Sun, May 06, 2018 at 10:24:47AM -0700, Allison Henderson wrote:
> Add lock_flags to  xfs_ialloc and xfs_dir_ialloc to control
> whick locks are released by xfs_trans_ijoin.  We will need this
> later in defered parent pointers
> 
> Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
> ---
>  fs/xfs/xfs_inode.c   | 17 +++++++++--------
>  fs/xfs/xfs_inode.h   |  2 +-
>  fs/xfs/xfs_qm.c      |  2 +-
>  fs/xfs/xfs_symlink.c |  2 +-
>  4 files changed, 12 insertions(+), 11 deletions(-)
> 
> diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
> index 5c291d2..2859a697 100644
> --- a/fs/xfs/xfs_inode.c
> +++ b/fs/xfs/xfs_inode.c
> @@ -766,7 +766,8 @@ xfs_ialloc(
>  	dev_t		rdev,
>  	prid_t		prid,
>  	xfs_buf_t	**ialloc_context,
> -	xfs_inode_t	**ipp)
> +	xfs_inode_t	**ipp,
> +	int		lock_flags)

Wait, what?

Oh, these are the locks we want *dropped* at the first _trans_commit
after this call returns, and for xfs_create we need to retain the ilock
while we roll the transaction(s) during _defer_finish; and for
everything else (create temp file, create quota inode, and symlink??) we
want the ilock dropped as soon as the transaction commits.

I dislike having this oddly named parameter, can we amend the comment to
say that the caller is responsible for unlocking the inode manually
(i.e. we're going to xfs_trans_ijoin(tp, ip, 0)) , and then change all
the callers to do the iunlock explicitly if they need to?

--D

>  {
>  	struct xfs_mount *mp = tp->t_mountp;
>  	xfs_ino_t	ino;
> @@ -942,7 +943,7 @@ xfs_ialloc(
>  	/*
>  	 * Log the new values stuffed into the inode.
>  	 */
> -	xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
> +	xfs_trans_ijoin(tp, ip, lock_flags);
>  	xfs_trans_log_inode(tp, ip, flags);
>  
>  	/* now that we have an i_mode we can setup the inode structure */
> @@ -972,8 +973,8 @@ xfs_dir_ialloc(
>  	xfs_nlink_t	nlink,
>  	dev_t		rdev,
>  	prid_t		prid,		/* project id */
> -	xfs_inode_t	**ipp)		/* pointer to inode; it will be
> -					   locked. */
> +	xfs_inode_t	**ipp,		/* pointer to inode; it will be locked. */
> +	int		lock_flags)
>  {
>  	xfs_trans_t	*tp;
>  	xfs_inode_t	*ip;
> @@ -1001,7 +1002,7 @@ xfs_dir_ialloc(
>  	 * the inode(s) that we've just allocated.
>  	 */
>  	code = xfs_ialloc(tp, dp, mode, nlink, rdev, prid, &ialloc_context,
> -			&ip);
> +			&ip, lock_flags);
>  
>  	/*
>  	 * Return an error if we were unable to allocate a new inode.
> @@ -1071,7 +1072,7 @@ xfs_dir_ialloc(
>  		 * this call should always succeed.
>  		 */
>  		code = xfs_ialloc(tp, dp, mode, nlink, rdev, prid,
> -				  &ialloc_context, &ip);
> +				  &ialloc_context, &ip, lock_flags);
>  
>  		/*
>  		 * If we get an error at this point, return to the caller
> @@ -1210,7 +1211,7 @@ xfs_create(
>  	 * entry pointing to them, but a directory also the "." entry
>  	 * pointing to itself.
>  	 */
> -	error = xfs_dir_ialloc(&tp, dp, mode, is_dir ? 2 : 1, rdev, prid, &ip);
> +	error = xfs_dir_ialloc(&tp, dp, mode, is_dir ? 2 : 1, rdev, prid, &ip, XFS_ILOCK_EXCL);
>  	if (error)
>  		goto out_trans_cancel;
>  
> @@ -1343,7 +1344,7 @@ xfs_create_tmpfile(
>  	if (error)
>  		goto out_trans_cancel;
>  
> -	error = xfs_dir_ialloc(&tp, dp, mode, 1, 0, prid, &ip);
> +	error = xfs_dir_ialloc(&tp, dp, mode, 1, 0, prid, &ip, XFS_ILOCK_EXCL);
>  	if (error)
>  		goto out_trans_cancel;
>  
> diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
> index 1eebc53..466f252 100644
> --- a/fs/xfs/xfs_inode.h
> +++ b/fs/xfs/xfs_inode.h
> @@ -431,7 +431,7 @@ xfs_extlen_t	xfs_get_cowextsz_hint(struct xfs_inode *ip);
>  
>  int		xfs_dir_ialloc(struct xfs_trans **, struct xfs_inode *, umode_t,
>  			       xfs_nlink_t, dev_t, prid_t,
> -			       struct xfs_inode **);
> +			       struct xfs_inode **, int lock_flags);
>  
>  /* from xfs_file.c */
>  enum xfs_prealloc_flags {
> diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
> index ec39ae2..3e68a52 100644
> --- a/fs/xfs/xfs_qm.c
> +++ b/fs/xfs/xfs_qm.c
> @@ -787,7 +787,7 @@ xfs_qm_qino_alloc(
>  		return error;
>  
>  	if (need_alloc) {
> -		error = xfs_dir_ialloc(&tp, NULL, S_IFREG, 1, 0, 0, ip);
> +		error = xfs_dir_ialloc(&tp, NULL, S_IFREG, 1, 0, 0, ip, XFS_ILOCK_EXCL);
>  		if (error) {
>  			xfs_trans_cancel(tp);
>  			return error;
> diff --git a/fs/xfs/xfs_symlink.c b/fs/xfs/xfs_symlink.c
> index b1d3301..ce8dbea 100644
> --- a/fs/xfs/xfs_symlink.c
> +++ b/fs/xfs/xfs_symlink.c
> @@ -264,7 +264,7 @@ xfs_symlink(
>  	 * Allocate an inode for the symlink.
>  	 */
>  	error = xfs_dir_ialloc(&tp, dp, S_IFLNK | (mode & ~S_IFMT), 1, 0,
> -			       prid, &ip);
> +			       prid, &ip, XFS_ILOCK_EXCL);
>  	if (error)
>  		goto out_trans_cancel;
>  
> -- 
> 2.7.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2018-05-07 22:30 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-06 17:24 [PATCH 00/21] Parent Pointers v6 Allison Henderson
2018-05-06 17:24 ` [PATCH 01/21] xfs: Move fs/xfs/xfs_attr.h to fs/xfs/libxfs/xfs_attr.h Allison Henderson
2018-05-07 23:39   ` Darrick J. Wong
2018-05-06 17:24 ` [PATCH 02/21] Add trans toggle to attr routines Allison Henderson
2018-05-07 23:52   ` Darrick J. Wong
2018-05-08 17:04     ` Allison Henderson
2018-05-06 17:24 ` [PATCH 03/21] xfs: Add attibute set and helper functions Allison Henderson
2018-05-07 23:36   ` Darrick J. Wong
2018-05-08  7:25     ` Amir Goldstein
2018-05-08 17:02       ` Allison Henderson
2018-05-08 17:01     ` Allison Henderson
2018-05-06 17:24 ` [PATCH 04/21] xfs: Add attibute remove " Allison Henderson
2018-05-07 23:21   ` Darrick J. Wong
2018-05-08  7:33   ` Amir Goldstein
2018-05-08 17:02     ` Allison Henderson
2018-05-08 17:14     ` Darrick J. Wong
2018-05-06 17:24 ` [PATCH 05/21] xfs: Set up infastructure for deferred attribute operations Allison Henderson
2018-05-07 23:19   ` Darrick J. Wong
2018-05-08 17:01     ` Allison Henderson
2018-05-08  9:55   ` Amir Goldstein
2018-05-06 17:24 ` [PATCH 06/21] xfs: Add xfs_attr_set_deferred and xfs_attr_remove_deferred Allison Henderson
2018-05-07 22:59   ` Darrick J. Wong
2018-05-08 17:01     ` Allison Henderson
2018-05-06 17:24 ` [PATCH 07/21] xfs: Remove all strlen calls in all xfs_attr_* functions for attr names Allison Henderson
2018-05-07 22:54   ` Darrick J. Wong
2018-05-08 17:00     ` Allison Henderson
2018-05-06 17:24 ` [PATCH 08/21] xfs: get directory offset when adding directory name Allison Henderson
2018-05-07 22:50   ` Darrick J. Wong
2018-05-06 17:24 ` [PATCH 09/21] xfs: get directory offset when removing " Allison Henderson
2018-05-07 22:48   ` Darrick J. Wong
2018-05-08 17:00     ` Allison Henderson
2018-05-06 17:24 ` [PATCH 10/21] xfs: get directory offset when replacing a " Allison Henderson
2018-05-07 22:45   ` Darrick J. Wong
2018-05-08 17:00     ` Allison Henderson
2018-05-06 17:24 ` [PATCH 11/21] xfs: add parent pointer support to attribute code Allison Henderson
2018-05-07 22:36   ` Darrick J. Wong
2018-05-06 17:24 ` [PATCH 12/21] xfs: define parent pointer xattr format Allison Henderson
2018-05-07 22:35   ` Darrick J. Wong
2018-05-08 17:00     ` Allison Henderson
2018-05-06 17:24 ` [PATCH 13/21] xfs: extent transaction reservations for parent attributes Allison Henderson
2018-05-07 22:34   ` Darrick J. Wong
2018-05-08 17:00     ` Allison Henderson
2018-05-06 17:24 ` [PATCH 14/21] Add lock_flags to xfs_ialloc and xfs_dir_ialloc Allison Henderson
2018-05-07 22:30   ` Darrick J. Wong [this message]
2018-05-08 16:59     ` Allison Henderson
2018-05-06 17:24 ` [PATCH 15/21] xfs: parent pointer attribute creation Allison Henderson
2018-05-07 22:19   ` Darrick J. Wong
2018-05-08 16:58     ` Allison Henderson
2018-05-06 17:24 ` [PATCH 16/21] xfs: add parent attributes to link Allison Henderson
2018-05-07 22:12   ` Darrick J. Wong
2018-05-08 16:58     ` Allison Henderson
2018-05-06 17:24 ` [PATCH 17/21] xfs: remove parent pointers in unlink Allison Henderson
2018-05-07 21:59   ` Darrick J. Wong
2018-05-08 16:58     ` Allison Henderson
2018-05-06 17:24 ` [PATCH 18/21] xfs: Add parent pointers to rename Allison Henderson
2018-05-07 21:52   ` Darrick J. Wong
2018-05-08 16:58     ` Allison Henderson
2018-05-08 10:04   ` Amir Goldstein
2018-05-06 17:24 ` [PATCH 19/21] xfs: Add the parent pointer support to the superblock version 5 Allison Henderson
2018-05-07 21:38   ` Darrick J. Wong
2018-05-08 16:58     ` Allison Henderson
2018-05-06 17:24 ` [PATCH 20/21] xfs: Add parent pointer ioctl Allison Henderson
2018-05-07 21:36   ` Darrick J. Wong
2018-05-08 10:24     ` Amir Goldstein
2018-05-08 10:25       ` Amir Goldstein
2018-05-08 16:57     ` Allison Henderson
2018-05-15 16:27   ` Catalin Iacob
2018-05-15 16:52     ` Allison Henderson
2018-05-06 17:24 ` [PATCH 21/21] xfs: Add delayed attributes error tag Allison Henderson
2018-05-07 20:57   ` Darrick J. Wong
2018-05-08  5:36 ` [PATCH 00/21] Parent Pointers v6 Amir Goldstein
2018-05-08 17:03   ` Allison Henderson

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=20180507223006.GH11261@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=allison.henderson@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox