public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] xfs: tiny xfs_setattr_mode cleanup
@ 2013-11-18 13:10 Christoph Hellwig
  2013-11-18 13:10 ` [PATCH 2/2] xfs: add xfs_setattr_time Christoph Hellwig
  2013-11-18 13:52 ` [PATCH 1/2] xfs: tiny xfs_setattr_mode cleanup Brian Foster
  0 siblings, 2 replies; 4+ messages in thread
From: Christoph Hellwig @ 2013-11-18 13:10 UTC (permalink / raw)
  To: xfs

Remove the pointless tp argument, and properly align the local variable
declarations.

Signed-off-by: Christoph Hellwig <hch@lst.de>

---
 fs/xfs/xfs_iops.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Index: linux/fs/xfs/xfs_iops.c
===================================================================
--- linux.orig/fs/xfs/xfs_iops.c	2013-11-14 17:58:06.612700222 +0100
+++ linux/fs/xfs/xfs_iops.c	2013-11-18 11:54:46.083792257 +0100
@@ -459,14 +459,12 @@ xfs_vn_getattr(
 
 static void
 xfs_setattr_mode(
-	struct xfs_trans	*tp,
 	struct xfs_inode	*ip,
 	struct iattr		*iattr)
 {
-	struct inode	*inode = VFS_I(ip);
-	umode_t		mode = iattr->ia_mode;
+	struct inode		*inode = VFS_I(ip);
+	umode_t			mode = iattr->ia_mode;
 
-	ASSERT(tp);
 	ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
 
 	ip->i_d.di_mode &= S_IFMT;
@@ -633,7 +631,7 @@ xfs_setattr_nonsize(
 	 * Change file access modes.
 	 */
 	if (mask & ATTR_MODE)
-		xfs_setattr_mode(tp, ip, iattr);
+		xfs_setattr_mode(ip, iattr);
 
 	/*
 	 * Change file access or modified times.
@@ -871,7 +869,7 @@ xfs_setattr_size(
 	 * Change file access modes.
 	 */
 	if (mask & ATTR_MODE)
-		xfs_setattr_mode(tp, ip, iattr);
+		xfs_setattr_mode(ip, iattr);
 
 	if (mask & ATTR_CTIME) {
 		inode->i_ctime = iattr->ia_ctime;

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] xfs: add xfs_setattr_time
  2013-11-18 13:10 [PATCH 1/2] xfs: tiny xfs_setattr_mode cleanup Christoph Hellwig
@ 2013-11-18 13:10 ` Christoph Hellwig
  2013-11-18 13:53   ` Brian Foster
  2013-11-18 13:52 ` [PATCH 1/2] xfs: tiny xfs_setattr_mode cleanup Brian Foster
  1 sibling, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2013-11-18 13:10 UTC (permalink / raw)
  To: xfs

Split out a xfs_setattr_time helper to share code between truncate and
regular setattr similar to xfs_setattr_mode.  I might also have another
caller growing for this in the near future.

Signed-off-by: Christoph Hellwig <hch@lst.de>

---
 fs/xfs/xfs_iops.c |   66 ++++++++++++++++++++++++------------------------------
 1 file changed, 30 insertions(+), 36 deletions(-)

Index: linux/fs/xfs/xfs_iops.c
===================================================================
--- linux.orig/fs/xfs/xfs_iops.c	2013-11-18 11:54:46.083792257 +0100
+++ linux/fs/xfs/xfs_iops.c	2013-11-18 11:55:34.891791256 +0100
@@ -474,6 +474,32 @@ xfs_setattr_mode(
 	inode->i_mode |= mode & ~S_IFMT;
 }
 
+static void
+xfs_setattr_time(
+	struct xfs_inode	*ip,
+	struct iattr		*iattr)
+{
+	struct inode		*inode = VFS_I(ip);
+
+	ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
+
+	if (iattr->ia_valid & ATTR_ATIME) {
+		inode->i_atime = iattr->ia_atime;
+		ip->i_d.di_atime.t_sec = iattr->ia_atime.tv_sec;
+		ip->i_d.di_atime.t_nsec = iattr->ia_atime.tv_nsec;
+	}
+	if (iattr->ia_valid & ATTR_CTIME) {
+		inode->i_ctime = iattr->ia_ctime;
+		ip->i_d.di_ctime.t_sec = iattr->ia_ctime.tv_sec;
+		ip->i_d.di_ctime.t_nsec = iattr->ia_ctime.tv_nsec;
+	}
+	if (iattr->ia_valid & ATTR_MTIME) {
+		inode->i_mtime = iattr->ia_mtime;
+		ip->i_d.di_mtime.t_sec = iattr->ia_mtime.tv_sec;
+		ip->i_d.di_mtime.t_nsec = iattr->ia_mtime.tv_nsec;
+	}
+}
+
 int
 xfs_setattr_nonsize(
 	struct xfs_inode	*ip,
@@ -627,30 +653,10 @@ xfs_setattr_nonsize(
 		}
 	}
 
-	/*
-	 * Change file access modes.
-	 */
 	if (mask & ATTR_MODE)
 		xfs_setattr_mode(ip, iattr);
-
-	/*
-	 * Change file access or modified times.
-	 */
-	if (mask & ATTR_ATIME) {
-		inode->i_atime = iattr->ia_atime;
-		ip->i_d.di_atime.t_sec = iattr->ia_atime.tv_sec;
-		ip->i_d.di_atime.t_nsec = iattr->ia_atime.tv_nsec;
-	}
-	if (mask & ATTR_CTIME) {
-		inode->i_ctime = iattr->ia_ctime;
-		ip->i_d.di_ctime.t_sec = iattr->ia_ctime.tv_sec;
-		ip->i_d.di_ctime.t_nsec = iattr->ia_ctime.tv_nsec;
-	}
-	if (mask & ATTR_MTIME) {
-		inode->i_mtime = iattr->ia_mtime;
-		ip->i_d.di_mtime.t_sec = iattr->ia_mtime.tv_sec;
-		ip->i_d.di_mtime.t_nsec = iattr->ia_mtime.tv_nsec;
-	}
+	if (mask & (ATTR_ATIME|ATTR_CTIME|ATTR_MTIME))
+		xfs_setattr_time(ip, iattr);
 
 	xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
 
@@ -865,22 +871,10 @@ xfs_setattr_size(
 		xfs_inode_clear_eofblocks_tag(ip);
 	}
 
-	/*
-	 * Change file access modes.
-	 */
 	if (mask & ATTR_MODE)
 		xfs_setattr_mode(ip, iattr);
-
-	if (mask & ATTR_CTIME) {
-		inode->i_ctime = iattr->ia_ctime;
-		ip->i_d.di_ctime.t_sec = iattr->ia_ctime.tv_sec;
-		ip->i_d.di_ctime.t_nsec = iattr->ia_ctime.tv_nsec;
-	}
-	if (mask & ATTR_MTIME) {
-		inode->i_mtime = iattr->ia_mtime;
-		ip->i_d.di_mtime.t_sec = iattr->ia_mtime.tv_sec;
-		ip->i_d.di_mtime.t_nsec = iattr->ia_mtime.tv_nsec;
-	}
+	if (mask & (ATTR_ATIME|ATTR_CTIME|ATTR_MTIME))
+		xfs_setattr_time(ip, iattr);
 
 	xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
 

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] xfs: tiny xfs_setattr_mode cleanup
  2013-11-18 13:10 [PATCH 1/2] xfs: tiny xfs_setattr_mode cleanup Christoph Hellwig
  2013-11-18 13:10 ` [PATCH 2/2] xfs: add xfs_setattr_time Christoph Hellwig
@ 2013-11-18 13:52 ` Brian Foster
  1 sibling, 0 replies; 4+ messages in thread
From: Brian Foster @ 2013-11-18 13:52 UTC (permalink / raw)
  To: xfs

On 11/18/2013 08:10 AM, Christoph Hellwig wrote:
> Remove the pointless tp argument, and properly align the local variable
> declarations.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> 
> ---

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  fs/xfs/xfs_iops.c |   10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> Index: linux/fs/xfs/xfs_iops.c
> ===================================================================
> --- linux.orig/fs/xfs/xfs_iops.c	2013-11-14 17:58:06.612700222 +0100
> +++ linux/fs/xfs/xfs_iops.c	2013-11-18 11:54:46.083792257 +0100
> @@ -459,14 +459,12 @@ xfs_vn_getattr(
>  
>  static void
>  xfs_setattr_mode(
> -	struct xfs_trans	*tp,
>  	struct xfs_inode	*ip,
>  	struct iattr		*iattr)
>  {
> -	struct inode	*inode = VFS_I(ip);
> -	umode_t		mode = iattr->ia_mode;
> +	struct inode		*inode = VFS_I(ip);
> +	umode_t			mode = iattr->ia_mode;
>  
> -	ASSERT(tp);
>  	ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
>  
>  	ip->i_d.di_mode &= S_IFMT;
> @@ -633,7 +631,7 @@ xfs_setattr_nonsize(
>  	 * Change file access modes.
>  	 */
>  	if (mask & ATTR_MODE)
> -		xfs_setattr_mode(tp, ip, iattr);
> +		xfs_setattr_mode(ip, iattr);
>  
>  	/*
>  	 * Change file access or modified times.
> @@ -871,7 +869,7 @@ xfs_setattr_size(
>  	 * Change file access modes.
>  	 */
>  	if (mask & ATTR_MODE)
> -		xfs_setattr_mode(tp, ip, iattr);
> +		xfs_setattr_mode(ip, iattr);
>  
>  	if (mask & ATTR_CTIME) {
>  		inode->i_ctime = iattr->ia_ctime;
> 
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
> 

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] xfs: add xfs_setattr_time
  2013-11-18 13:10 ` [PATCH 2/2] xfs: add xfs_setattr_time Christoph Hellwig
@ 2013-11-18 13:53   ` Brian Foster
  0 siblings, 0 replies; 4+ messages in thread
From: Brian Foster @ 2013-11-18 13:53 UTC (permalink / raw)
  To: xfs

On 11/18/2013 08:10 AM, Christoph Hellwig wrote:
> Split out a xfs_setattr_time helper to share code between truncate and
> regular setattr similar to xfs_setattr_mode.  I might also have another
> caller growing for this in the near future.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> 
> ---

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  fs/xfs/xfs_iops.c |   66 ++++++++++++++++++++++++------------------------------
>  1 file changed, 30 insertions(+), 36 deletions(-)
> 
> Index: linux/fs/xfs/xfs_iops.c
> ===================================================================
> --- linux.orig/fs/xfs/xfs_iops.c	2013-11-18 11:54:46.083792257 +0100
> +++ linux/fs/xfs/xfs_iops.c	2013-11-18 11:55:34.891791256 +0100
> @@ -474,6 +474,32 @@ xfs_setattr_mode(
>  	inode->i_mode |= mode & ~S_IFMT;
>  }
>  
> +static void
> +xfs_setattr_time(
> +	struct xfs_inode	*ip,
> +	struct iattr		*iattr)
> +{
> +	struct inode		*inode = VFS_I(ip);
> +
> +	ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
> +
> +	if (iattr->ia_valid & ATTR_ATIME) {
> +		inode->i_atime = iattr->ia_atime;
> +		ip->i_d.di_atime.t_sec = iattr->ia_atime.tv_sec;
> +		ip->i_d.di_atime.t_nsec = iattr->ia_atime.tv_nsec;
> +	}
> +	if (iattr->ia_valid & ATTR_CTIME) {
> +		inode->i_ctime = iattr->ia_ctime;
> +		ip->i_d.di_ctime.t_sec = iattr->ia_ctime.tv_sec;
> +		ip->i_d.di_ctime.t_nsec = iattr->ia_ctime.tv_nsec;
> +	}
> +	if (iattr->ia_valid & ATTR_MTIME) {
> +		inode->i_mtime = iattr->ia_mtime;
> +		ip->i_d.di_mtime.t_sec = iattr->ia_mtime.tv_sec;
> +		ip->i_d.di_mtime.t_nsec = iattr->ia_mtime.tv_nsec;
> +	}
> +}
> +
>  int
>  xfs_setattr_nonsize(
>  	struct xfs_inode	*ip,
> @@ -627,30 +653,10 @@ xfs_setattr_nonsize(
>  		}
>  	}
>  
> -	/*
> -	 * Change file access modes.
> -	 */
>  	if (mask & ATTR_MODE)
>  		xfs_setattr_mode(ip, iattr);
> -
> -	/*
> -	 * Change file access or modified times.
> -	 */
> -	if (mask & ATTR_ATIME) {
> -		inode->i_atime = iattr->ia_atime;
> -		ip->i_d.di_atime.t_sec = iattr->ia_atime.tv_sec;
> -		ip->i_d.di_atime.t_nsec = iattr->ia_atime.tv_nsec;
> -	}
> -	if (mask & ATTR_CTIME) {
> -		inode->i_ctime = iattr->ia_ctime;
> -		ip->i_d.di_ctime.t_sec = iattr->ia_ctime.tv_sec;
> -		ip->i_d.di_ctime.t_nsec = iattr->ia_ctime.tv_nsec;
> -	}
> -	if (mask & ATTR_MTIME) {
> -		inode->i_mtime = iattr->ia_mtime;
> -		ip->i_d.di_mtime.t_sec = iattr->ia_mtime.tv_sec;
> -		ip->i_d.di_mtime.t_nsec = iattr->ia_mtime.tv_nsec;
> -	}
> +	if (mask & (ATTR_ATIME|ATTR_CTIME|ATTR_MTIME))
> +		xfs_setattr_time(ip, iattr);
>  
>  	xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
>  
> @@ -865,22 +871,10 @@ xfs_setattr_size(
>  		xfs_inode_clear_eofblocks_tag(ip);
>  	}
>  
> -	/*
> -	 * Change file access modes.
> -	 */
>  	if (mask & ATTR_MODE)
>  		xfs_setattr_mode(ip, iattr);
> -
> -	if (mask & ATTR_CTIME) {
> -		inode->i_ctime = iattr->ia_ctime;
> -		ip->i_d.di_ctime.t_sec = iattr->ia_ctime.tv_sec;
> -		ip->i_d.di_ctime.t_nsec = iattr->ia_ctime.tv_nsec;
> -	}
> -	if (mask & ATTR_MTIME) {
> -		inode->i_mtime = iattr->ia_mtime;
> -		ip->i_d.di_mtime.t_sec = iattr->ia_mtime.tv_sec;
> -		ip->i_d.di_mtime.t_nsec = iattr->ia_mtime.tv_nsec;
> -	}
> +	if (mask & (ATTR_ATIME|ATTR_CTIME|ATTR_MTIME))
> +		xfs_setattr_time(ip, iattr);
>  
>  	xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
>  
> 
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
> 

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-11-18 13:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-18 13:10 [PATCH 1/2] xfs: tiny xfs_setattr_mode cleanup Christoph Hellwig
2013-11-18 13:10 ` [PATCH 2/2] xfs: add xfs_setattr_time Christoph Hellwig
2013-11-18 13:53   ` Brian Foster
2013-11-18 13:52 ` [PATCH 1/2] xfs: tiny xfs_setattr_mode cleanup Brian Foster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox