public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Barry Naujok <bnaujok@sgi.com>
Cc: "xfs@oss.sgi.com" <xfs@oss.sgi.com>, xfs-dev <xfs-dev@sgi.com>
Subject: Re: [REVIEW #2] cleanup - remove bhv_vname_t
Date: Tue, 8 Apr 2008 04:51:53 -0400	[thread overview]
Message-ID: <20080408085153.GA19699@infradead.org> (raw)
In-Reply-To: <op.t897ipuu3jf8g2@pc-bnaujok.melbourne.sgi.com>

> --- kern_ci.orig/fs/xfs/xfs_dir2.h
> +++ kern_ci/fs/xfs/xfs_dir2.h
> @@ -60,6 +60,16 @@ typedef	__uint32_t	xfs_dir2_db_t;
>  typedef	xfs_off_t	xfs_dir2_off_t;
>
>  /*
> + * Counted string for file names.
> + */
> +struct xfs_name {
> +	const char	*name;
> +	int		len;
> +};
> +
> +extern struct xfs_name	xfs_name_dotdot;

I think these should be in a different header as they are used a lot
outside the low-level directory code.

> +static inline int
> +xfs_dir_check_canenter(uint resblks, struct xfs_trans *tp,
> +				struct xfs_inode *dp, struct xfs_name *name)
> +{
> +	if (resblks)
> +		return 0;
> +	return xfs_dir_canenter(tp, dp, name);;
> +}

Probably makes sense to have this out of line.


>  STATIC int
>  xfs_lock_for_rename(
> -	xfs_inode_t	*dp1,	/* old (source) directory inode */
> -	xfs_inode_t	*dp2,	/* new (target) directory inode */
> -	bhv_vname_t	*vname1,/* old entry name */
> -	bhv_vname_t	*vname2,/* new entry name */
> -	xfs_inode_t	**ipp1,	/* inode of old entry */
> -	xfs_inode_t	**ipp2,	/* inode of new entry, if it
> +	xfs_inode_t	*dp1,	/* in: old (source) directory inode */
> +	xfs_inode_t	*dp2,	/* in: new (target) directory inode */
> +	struct xfs_name	*name2,	/* in: new entry name */
> +	xfs_inode_t	**ipp1,	/* in/out: inode of old entry */
> +	xfs_inode_t	**ipp2,	/* out: inode of new entry, if it
>  				   already exists, NULL otherwise. */
> -	xfs_inode_t	**i_tab,/* array of inode returned, sorted */
> -	int		*num_inodes)  /* number of inodes in array */
> +	xfs_inode_t	**i_tab,/* out: array of inode returned, sorted */
> +	int		*num_inodes)  /* out: number of inodes in array */

This function needs some more love :)

If you follow the flow *ipp1 can never be zeroed out so just pass a
normal *ip1 pointer.  Similarly the loop to find *ipp2 to again
can be killed because we know it's there. New prototype should be
something like:

 STATIC int
 xfs_lock_for_rename(
+	xfs_inode_t	*dp1,	/* in: old (source) directory inode */
+	xfs_inode_t	*dp2,	/* in: new (target) directory inode */
+	xfs_inode_t	*ip1,	/* in: inode of old entry */
+	struct xfs_name	*name2,	/* in: new entry name */
+	xfs_inode_t	**ipp2,	/* out: inode of new entry, if it
  				   already exists, NULL otherwise. */
+	xfs_inode_t	**i_tab,/* out: array of inode returned, sorted */
+	int		*num_inodes)  /* out: number of inodes in array */

  reply	other threads:[~2008-04-08  8:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-08  7:38 [REVIEW #2] cleanup - remove bhv_vname_t Barry Naujok
2008-04-08  8:51 ` Christoph Hellwig [this message]
2008-04-08 10:48   ` Christoph Hellwig
2008-04-09  4:01   ` Barry Naujok

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=20080408085153.GA19699@infradead.org \
    --to=hch@infradead.org \
    --cc=bnaujok@sgi.com \
    --cc=xfs-dev@sgi.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox