All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/17] 2.6.30 queue
@ 2009-01-26  7:31 Christoph Hellwig
  2009-01-26  7:31 ` [PATCH 01/17] xfs: cleanup error handling in xfs_mountfs: Christoph Hellwig
                   ` (17 more replies)
  0 siblings, 18 replies; 50+ messages in thread
From: Christoph Hellwig @ 2009-01-26  7:31 UTC (permalink / raw)
  To: xfs

Various misc small fixes and cleanups for 2.6.30.

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

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

* [PATCH 01/17] xfs: cleanup error handling in xfs_mountfs:
  2009-01-26  7:31 [PATCH 00/17] 2.6.30 queue Christoph Hellwig
@ 2009-01-26  7:31 ` Christoph Hellwig
  2009-01-26 21:39   ` Felix Blyakher
  2009-01-26  7:31 ` [PATCH 02/17] xfs: make sure to free the real-time inodes in the mount error path Christoph Hellwig
                   ` (16 subsequent siblings)
  17 siblings, 1 reply; 50+ messages in thread
From: Christoph Hellwig @ 2009-01-26  7:31 UTC (permalink / raw)
  To: xfs

[-- Attachment #1: xfs-cleanup-xfs_mountfs --]
[-- Type: text/plain, Size: 5623 bytes --]

Clean up the error handling in xfs_mountfs.  Use readable goto label names,
simplify the uuid handling and other error conditions.


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

Index: xfs/fs/xfs/xfs_mount.c
===================================================================
--- xfs.orig/fs/xfs/xfs_mount.c	2009-01-24 18:02:18.279779227 +0100
+++ xfs/fs/xfs/xfs_mount.c	2009-01-24 18:02:20.240779188 +0100
@@ -886,8 +886,6 @@ xfs_check_sizes(xfs_mount_t *mp)
 }
 
 /*
- * xfs_mountfs
- *
  * This function does the following on an initial mount of a file system:
  *	- reads the superblock from disk and init the mount struct
  *	- if we're a 32-bit kernel, do a size check on the superblock
@@ -905,7 +903,6 @@ xfs_mountfs(
 	xfs_inode_t	*rip;
 	__uint64_t	resblks;
 	uint		quotamount, quotaflags;
-	int		uuid_mounted = 0;
 	int		error = 0;
 
 	xfs_mount_common(mp, sbp);
@@ -960,7 +957,7 @@ xfs_mountfs(
 	 */
 	error = xfs_update_alignment(mp);
 	if (error)
-		goto error1;
+		goto out;
 
 	xfs_alloc_compute_maxlevels(mp);
 	xfs_bmap_compute_maxlevels(mp, XFS_DATA_FORK);
@@ -977,12 +974,11 @@ xfs_mountfs(
 	 * since a single partition filesystem is identical to a single
 	 * partition volume/filesystem.
 	 */
-	if ((mp->m_flags & XFS_MOUNT_NOUUID) == 0) {
+	if (!(mp->m_flags & XFS_MOUNT_NOUUID)) {
 		if (xfs_uuid_mount(mp)) {
 			error = XFS_ERROR(EINVAL);
-			goto error1;
+			goto out;
 		}
-		uuid_mounted=1;
 	}
 
 	/*
@@ -1007,7 +1003,7 @@ xfs_mountfs(
 	 */
 	error = xfs_check_sizes(mp);
 	if (error)
-		goto error1;
+		goto out_remove_uuid;
 
 	/*
 	 * Initialize realtime fields in the mount structure
@@ -1015,7 +1011,7 @@ xfs_mountfs(
 	error = xfs_rtmount_init(mp);
 	if (error) {
 		cmn_err(CE_WARN, "XFS: RT mount failed");
-		goto error1;
+		goto out_remove_uuid;
 	}
 
 	/*
@@ -1045,26 +1041,26 @@ xfs_mountfs(
 	mp->m_perag = kmem_zalloc(sbp->sb_agcount * sizeof(xfs_perag_t),
 				  KM_MAYFAIL);
 	if (!mp->m_perag)
-		goto error1;
+		goto out_remove_uuid;
 
 	mp->m_maxagi = xfs_initialize_perag(mp, sbp->sb_agcount);
 
+	if (!sbp->sb_logblocks) {
+		cmn_err(CE_WARN, "XFS: no log defined");
+		XFS_ERROR_REPORT("xfs_mountfs", XFS_ERRLEVEL_LOW, mp);
+		error = XFS_ERROR(EFSCORRUPTED);
+		goto out_free_perag;
+	}
+
 	/*
 	 * log's mount-time initialization. Perform 1st part recovery if needed
 	 */
-	if (likely(sbp->sb_logblocks > 0)) {	/* check for volume case */
-		error = xfs_log_mount(mp, mp->m_logdev_targp,
-				      XFS_FSB_TO_DADDR(mp, sbp->sb_logstart),
-				      XFS_FSB_TO_BB(mp, sbp->sb_logblocks));
-		if (error) {
-			cmn_err(CE_WARN, "XFS: log mount failed");
-			goto error2;
-		}
-	} else {	/* No log has been defined */
-		cmn_err(CE_WARN, "XFS: no log defined");
-		XFS_ERROR_REPORT("xfs_mountfs_int(1)", XFS_ERRLEVEL_LOW, mp);
-		error = XFS_ERROR(EFSCORRUPTED);
-		goto error2;
+	error = xfs_log_mount(mp, mp->m_logdev_targp,
+			      XFS_FSB_TO_DADDR(mp, sbp->sb_logstart),
+			      XFS_FSB_TO_BB(mp, sbp->sb_logblocks));
+	if (error) {
+		cmn_err(CE_WARN, "XFS: log mount failed");
+		goto out_free_perag;
 	}
 
 	/*
@@ -1086,15 +1082,14 @@ xfs_mountfs(
 	 * If we are currently making the filesystem, the initialisation will
 	 * fail as the perag data is in an undefined state.
 	 */
-
 	if (xfs_sb_version_haslazysbcount(&mp->m_sb) &&
 	    !XFS_LAST_UNMOUNT_WAS_CLEAN(mp) &&
 	     !mp->m_sb.sb_inprogress) {
 		error = xfs_initialize_perag_data(mp, sbp->sb_agcount);
-		if (error) {
-			goto error2;
-		}
+		if (error)
+			goto out_free_perag;
 	}
+
 	/*
 	 * Get and sanity-check the root inode.
 	 * Save the pointer to it in the mount structure.
@@ -1102,7 +1097,7 @@ xfs_mountfs(
 	error = xfs_iget(mp, NULL, sbp->sb_rootino, 0, XFS_ILOCK_EXCL, &rip, 0);
 	if (error) {
 		cmn_err(CE_WARN, "XFS: failed to read root inode");
-		goto error3;
+		goto out_log_dealloc;
 	}
 
 	ASSERT(rip != NULL);
@@ -1116,7 +1111,7 @@ xfs_mountfs(
 		XFS_ERROR_REPORT("xfs_mountfs_int(2)", XFS_ERRLEVEL_LOW,
 				 mp);
 		error = XFS_ERROR(EFSCORRUPTED);
-		goto error4;
+		goto out_rele_rip;
 	}
 	mp->m_rootip = rip;	/* save it */
 
@@ -1131,7 +1126,7 @@ xfs_mountfs(
 		 * Free up the root inode.
 		 */
 		cmn_err(CE_WARN, "XFS: failed to read RT inodes");
-		goto error4;
+		goto out_rele_rip;
 	}
 
 	/*
@@ -1143,7 +1138,7 @@ xfs_mountfs(
 		error = xfs_mount_log_sb(mp, mp->m_update_flags);
 		if (error) {
 			cmn_err(CE_WARN, "XFS: failed to write sb changes");
-			goto error4;
+			goto out_rele_rip;
 		}
 	}
 
@@ -1152,7 +1147,7 @@ xfs_mountfs(
 	 */
 	error = XFS_QM_INIT(mp, &quotamount, &quotaflags);
 	if (error)
-		goto error4;
+		goto out_rele_rip;
 
 	/*
 	 * Finish recovering the file system.  This part needed to be
@@ -1162,7 +1157,7 @@ xfs_mountfs(
 	error = xfs_log_mount_finish(mp);
 	if (error) {
 		cmn_err(CE_WARN, "XFS: log mount finish failed");
-		goto error4;
+		goto out_rele_rip;
 	}
 
 	/*
@@ -1170,7 +1165,7 @@ xfs_mountfs(
 	 */
 	error = XFS_QM_MOUNT(mp, quotamount, quotaflags);
 	if (error)
-		goto error4;
+		goto out_rele_rip;
 
 	/*
 	 * Now we are mounted, reserve a small amount of unused space for
@@ -1194,18 +1189,16 @@ xfs_mountfs(
 
 	return 0;
 
- error4:
-	/*
-	 * Free up the root inode.
-	 */
+ out_rele_rip:
 	IRELE(rip);
- error3:
+ out_log_dealloc:
 	xfs_log_unmount_dealloc(mp);
- error2:
+ out_free_perag:
 	xfs_free_perag(mp);
- error1:
-	if (uuid_mounted)
+ out_remove_uuid:
+	if (!(mp->m_flags & XFS_MOUNT_NOUUID))
 		uuid_table_remove(&mp->m_sb.sb_uuid);
+ out:
 	return error;
 }
 

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

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

* [PATCH 02/17] xfs: make sure to free the real-time inodes in the mount error path
  2009-01-26  7:31 [PATCH 00/17] 2.6.30 queue Christoph Hellwig
  2009-01-26  7:31 ` [PATCH 01/17] xfs: cleanup error handling in xfs_mountfs: Christoph Hellwig
@ 2009-01-26  7:31 ` Christoph Hellwig
  2009-01-26 22:02   ` Felix Blyakher
  2009-01-28 20:24   ` Martin Steigerwald
  2009-01-26  7:31 ` [PATCH 03/17] xfs: cleanup handling in xfs_swap_extents Christoph Hellwig
                   ` (15 subsequent siblings)
  17 siblings, 2 replies; 50+ messages in thread
From: Christoph Hellwig @ 2009-01-26  7:31 UTC (permalink / raw)
  To: xfs

[-- Attachment #1: xfs-free-rtinodes --]
[-- Type: text/plain, Size: 3235 bytes --]

When mount failes after allocating the real-time inodes we currently leak
them.  Add a new helper to free the real-time inodes which can be used by
both the mount and unmount path.


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

Index: xfs/fs/xfs/xfs_rtalloc.c
===================================================================
--- xfs.orig/fs/xfs/xfs_rtalloc.c	2009-01-24 18:02:17.458778944 +0100
+++ xfs/fs/xfs/xfs_rtalloc.c	2009-01-24 18:04:16.922779103 +0100
@@ -2288,6 +2288,16 @@ xfs_rtmount_inodes(
 	return 0;
 }
 
+void
+xfs_rtunmount_inodes(
+	struct xfs_mount	*mp)
+{
+	if (mp->m_rbmip)
+		IRELE(mp->m_rbmip);
+	if (mp->m_rsumip)
+		IRELE(mp->m_rsumip);
+}
+
 /*
  * Pick an extent for allocation at the start of a new realtime file.
  * Use the sequence number stored in the atime field of the bitmap inode.
Index: xfs/fs/xfs/xfs_rtalloc.h
===================================================================
--- xfs.orig/fs/xfs/xfs_rtalloc.h	2009-01-24 18:02:17.462779035 +0100
+++ xfs/fs/xfs/xfs_rtalloc.h	2009-01-24 18:04:16.929904172 +0100
@@ -108,6 +108,9 @@ xfs_rtfree_extent(
 int					/* error */
 xfs_rtmount_init(
 	struct xfs_mount	*mp);	/* file system mount structure */
+void
+xfs_rtunmount_inodes(
+	struct xfs_mount	*mp);
 
 /*
  * Get the bitmap and summary inodes into the mount structure
@@ -146,6 +149,7 @@ xfs_growfs_rt(
 # define xfs_growfs_rt(mp,in)                           (ENOSYS)
 # define xfs_rtmount_init(m)    (((mp)->m_sb.sb_rblocks == 0)? 0 : (ENOSYS))
 # define xfs_rtmount_inodes(m)  (((mp)->m_sb.sb_rblocks == 0)? 0 : (ENOSYS))
+# define xfs_rtunmount_inodes(m)
 #endif	/* CONFIG_XFS_RT */
 
 #endif	/* __KERNEL__ */
Index: xfs/fs/xfs/xfs_mount.c
===================================================================
--- xfs.orig/fs/xfs/xfs_mount.c	2009-01-24 18:02:20.240779188 +0100
+++ xfs/fs/xfs/xfs_mount.c	2009-01-24 18:04:16.931903659 +0100
@@ -1138,7 +1138,7 @@ xfs_mountfs(
 		error = xfs_mount_log_sb(mp, mp->m_update_flags);
 		if (error) {
 			cmn_err(CE_WARN, "XFS: failed to write sb changes");
-			goto out_rele_rip;
+			goto out_rtunmount;
 		}
 	}
 
@@ -1147,7 +1147,7 @@ xfs_mountfs(
 	 */
 	error = XFS_QM_INIT(mp, &quotamount, &quotaflags);
 	if (error)
-		goto out_rele_rip;
+		goto out_rtunmount;
 
 	/*
 	 * Finish recovering the file system.  This part needed to be
@@ -1157,7 +1157,7 @@ xfs_mountfs(
 	error = xfs_log_mount_finish(mp);
 	if (error) {
 		cmn_err(CE_WARN, "XFS: log mount finish failed");
-		goto out_rele_rip;
+		goto out_rtunmount;
 	}
 
 	/*
@@ -1165,7 +1165,7 @@ xfs_mountfs(
 	 */
 	error = XFS_QM_MOUNT(mp, quotamount, quotaflags);
 	if (error)
-		goto out_rele_rip;
+		goto out_rtunmount;
 
 	/*
 	 * Now we are mounted, reserve a small amount of unused space for
@@ -1189,6 +1189,8 @@ xfs_mountfs(
 
 	return 0;
 
+ out_rtunmount:
+	xfs_rtunmount_inodes(mp);
  out_rele_rip:
 	IRELE(rip);
  out_log_dealloc:
@@ -1219,10 +1221,7 @@ xfs_unmountfs(
 	 */
 	XFS_QM_UNMOUNT(mp);
 
-	if (mp->m_rbmip)
-		IRELE(mp->m_rbmip);
-	if (mp->m_rsumip)
-		IRELE(mp->m_rsumip);
+	xfs_rtunmount_inodes(mp);
 	IRELE(mp->m_rootip);
 
 	/*

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

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

* [PATCH 03/17] xfs: cleanup handling in xfs_swap_extents
  2009-01-26  7:31 [PATCH 00/17] 2.6.30 queue Christoph Hellwig
  2009-01-26  7:31 ` [PATCH 01/17] xfs: cleanup error handling in xfs_mountfs: Christoph Hellwig
  2009-01-26  7:31 ` [PATCH 02/17] xfs: make sure to free the real-time inodes in the mount error path Christoph Hellwig
@ 2009-01-26  7:31 ` Christoph Hellwig
  2009-01-26  7:55   ` Christoph Hellwig
                     ` (2 more replies)
  2009-01-26  7:31 ` [PATCH 04/17] xfs: tiny cleanup for xfs_link Christoph Hellwig
                   ` (14 subsequent siblings)
  17 siblings, 3 replies; 50+ messages in thread
From: Christoph Hellwig @ 2009-01-26  7:31 UTC (permalink / raw)
  To: xfs

[-- Attachment #1: xfs-cleanup-swapext --]
[-- Type: text/plain, Size: 5021 bytes --]

Use multiple lables for proper error unwinding and get rid of some now
superflous variables.


Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Reviewed-by: Christoph Hellwig <hch@lst.de>

Index: xfs/fs/xfs/xfs_dfrag.c
===================================================================
--- xfs.orig/fs/xfs/xfs_dfrag.c	2008-12-19 15:02:54.003908425 +0100
+++ xfs/fs/xfs/xfs_dfrag.c	2008-12-22 15:59:55.013247371 +0100
@@ -126,19 +126,17 @@ xfs_swap_extents(
 	xfs_bstat_t	*sbp = &sxp->sx_stat;
 	xfs_ifork_t	*tempifp, *ifp, *tifp;
 	int		ilf_fields, tilf_fields;
-	static uint	lock_flags = XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL;
 	int		error = 0;
 	int		aforkblks = 0;
 	int		taforkblks = 0;
 	__uint64_t	tmp;
-	char		locked = 0;
 
 	mp = ip->i_mount;
 
 	tempifp = kmem_alloc(sizeof(xfs_ifork_t), KM_MAYFAIL);
 	if (!tempifp) {
 		error = XFS_ERROR(ENOMEM);
-		goto error0;
+		goto out;
 	}
 
 	sbp = &sxp->sx_stat;
@@ -151,25 +149,24 @@ xfs_swap_extents(
 	 */
 	xfs_lock_two_inodes(ip, tip, XFS_IOLOCK_EXCL);
 	xfs_lock_two_inodes(ip, tip, XFS_ILOCK_EXCL);
-	locked = 1;
 
 	/* Verify that both files have the same format */
 	if ((ip->i_d.di_mode & S_IFMT) != (tip->i_d.di_mode & S_IFMT)) {
 		error = XFS_ERROR(EINVAL);
-		goto error0;
+		goto out_unlock;
 	}
 
 	/* Verify both files are either real-time or non-realtime */
 	if (XFS_IS_REALTIME_INODE(ip) != XFS_IS_REALTIME_INODE(tip)) {
 		error = XFS_ERROR(EINVAL);
-		goto error0;
+		goto out_unlock;
 	}
 
 	/* Should never get a local format */
 	if (ip->i_d.di_format == XFS_DINODE_FMT_LOCAL ||
 	    tip->i_d.di_format == XFS_DINODE_FMT_LOCAL) {
 		error = XFS_ERROR(EINVAL);
-		goto error0;
+		goto out_unlock;
 	}
 
 	if (VN_CACHED(VFS_I(tip)) != 0) {
@@ -177,13 +174,13 @@ xfs_swap_extents(
 		error = xfs_flushinval_pages(tip, 0, -1,
 				FI_REMAPF_LOCKED);
 		if (error)
-			goto error0;
+			goto out_unlock;
 	}
 
 	/* Verify O_DIRECT for ftmp */
 	if (VN_CACHED(VFS_I(tip)) != 0) {
 		error = XFS_ERROR(EINVAL);
-		goto error0;
+		goto out_unlock;
 	}
 
 	/* Verify all data are being swapped */
@@ -191,7 +188,7 @@ xfs_swap_extents(
 	    sxp->sx_length != ip->i_d.di_size ||
 	    sxp->sx_length != tip->i_d.di_size) {
 		error = XFS_ERROR(EFAULT);
-		goto error0;
+		goto out_unlock;
 	}
 
 	/*
@@ -201,7 +198,7 @@ xfs_swap_extents(
 	 */
 	if ( XFS_IFORK_Q(ip) != XFS_IFORK_Q(tip) ) {
 		error = XFS_ERROR(EINVAL);
-		goto error0;
+		goto out_unlock;
 	}
 
 	/*
@@ -216,7 +213,7 @@ xfs_swap_extents(
 	    (sbp->bs_mtime.tv_sec != ip->i_d.di_mtime.t_sec) ||
 	    (sbp->bs_mtime.tv_nsec != ip->i_d.di_mtime.t_nsec)) {
 		error = XFS_ERROR(EBUSY);
-		goto error0;
+		goto out_unlock;
 	}
 
 	/* We need to fail if the file is memory mapped.  Once we have tossed
@@ -227,7 +224,7 @@ xfs_swap_extents(
 	 */
 	if (VN_MAPPED(VFS_I(ip))) {
 		error = XFS_ERROR(EBUSY);
-		goto error0;
+		goto out_unlock;
 	}
 
 	xfs_iunlock(ip, XFS_ILOCK_EXCL);
@@ -250,8 +247,7 @@ xfs_swap_extents(
 		xfs_iunlock(ip,  XFS_IOLOCK_EXCL);
 		xfs_iunlock(tip, XFS_IOLOCK_EXCL);
 		xfs_trans_cancel(tp, 0);
-		locked = 0;
-		goto error0;
+		goto out;
 	}
 	xfs_lock_two_inodes(ip, tip, XFS_ILOCK_EXCL);
 
@@ -261,19 +257,15 @@ xfs_swap_extents(
 	if ( ((XFS_IFORK_Q(ip) != 0) && (ip->i_d.di_anextents > 0)) &&
 	     (ip->i_d.di_aformat != XFS_DINODE_FMT_LOCAL)) {
 		error = xfs_bmap_count_blocks(tp, ip, XFS_ATTR_FORK, &aforkblks);
-		if (error) {
-			xfs_trans_cancel(tp, 0);
-			goto error0;
-		}
+		if (error)
+			goto out_trans_cancel;
 	}
 	if ( ((XFS_IFORK_Q(tip) != 0) && (tip->i_d.di_anextents > 0)) &&
 	     (tip->i_d.di_aformat != XFS_DINODE_FMT_LOCAL)) {
 		error = xfs_bmap_count_blocks(tp, tip, XFS_ATTR_FORK,
 			&taforkblks);
-		if (error) {
-			xfs_trans_cancel(tp, 0);
-			goto error0;
-		}
+		if (error)
+			goto out_trans_cancel;
 	}
 
 	/*
@@ -340,10 +332,10 @@ xfs_swap_extents(
 
 
 	IHOLD(ip);
-	xfs_trans_ijoin(tp, ip, lock_flags);
+	xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);
 
 	IHOLD(tip);
-	xfs_trans_ijoin(tp, tip, lock_flags);
+	xfs_trans_ijoin(tp, tip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);
 
 	xfs_trans_log_inode(tp, ip,  ilf_fields);
 	xfs_trans_log_inode(tp, tip, tilf_fields);
@@ -352,19 +344,19 @@ xfs_swap_extents(
 	 * If this is a synchronous mount, make sure that the
 	 * transaction goes to disk before returning to the user.
 	 */
-	if (mp->m_flags & XFS_MOUNT_WSYNC) {
+	if (mp->m_flags & XFS_MOUNT_WSYNC)
 		xfs_trans_set_sync(tp);
-	}
 
 	error = xfs_trans_commit(tp, XFS_TRANS_SWAPEXT);
-	locked = 0;
 
- error0:
-	if (locked) {
-		xfs_iunlock(ip,  lock_flags);
-		xfs_iunlock(tip, lock_flags);
-	}
-	if (tempifp != NULL)
-		kmem_free(tempifp);
+out_unlock:
+	xfs_iunlock(ip,  XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);
+	xfs_iunlock(tip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);
+out:
+	kmem_free(tempifp);
 	return error;
+
+out_trans_cancel:
+	xfs_trans_cancel(tp, 0);
+	goto out_unlock;
 }

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

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

* [PATCH 04/17] xfs: tiny cleanup for xfs_link
  2009-01-26  7:31 [PATCH 00/17] 2.6.30 queue Christoph Hellwig
                   ` (2 preceding siblings ...)
  2009-01-26  7:31 ` [PATCH 03/17] xfs: cleanup handling in xfs_swap_extents Christoph Hellwig
@ 2009-01-26  7:31 ` Christoph Hellwig
  2009-01-26 22:23   ` Felix Blyakher
  2009-01-26  7:31 ` [PATCH 05/17] xfs: remove unused XFS_MOUNT_ILOCK/XFS_MOUNT_IUNLOCK Christoph Hellwig
                   ` (13 subsequent siblings)
  17 siblings, 1 reply; 50+ messages in thread
From: Christoph Hellwig @ 2009-01-26  7:31 UTC (permalink / raw)
  To: xfs

[-- Attachment #1: xfs-cleanup-xfs_link --]
[-- Type: text/plain, Size: 983 bytes --]

The source and target inodes are guaranteed to never be the same by the VFS,
so no need to check for that (and we would get into bad trouble later anyway
if that were the case).  Also clean up the error handling to use two gotos
instead of nested conditions.


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

Index: xfs-dev/fs/xfs/xfs_vnodeops.c
===================================================================
--- xfs-dev.orig/fs/xfs/xfs_vnodeops.c	2008-12-01 12:56:22.000000000 +0100
+++ xfs-dev/fs/xfs/xfs_vnodeops.c	2008-12-01 12:56:43.000000000 +0100
@@ -2027,8 +2027,10 @@ xfs_link(
 	/* Return through std_return after this point. */
 
 	error = XFS_QM_DQATTACH(mp, sip, 0);
-	if (!error && sip != tdp)
-		error = XFS_QM_DQATTACH(mp, tdp, 0);
+	if (error)
+		goto std_return;
+
+	error = XFS_QM_DQATTACH(mp, tdp, 0);
 	if (error)
 		goto std_return;
 

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

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

* [PATCH 05/17] xfs: remove unused XFS_MOUNT_ILOCK/XFS_MOUNT_IUNLOCK
  2009-01-26  7:31 [PATCH 00/17] 2.6.30 queue Christoph Hellwig
                   ` (3 preceding siblings ...)
  2009-01-26  7:31 ` [PATCH 04/17] xfs: tiny cleanup for xfs_link Christoph Hellwig
@ 2009-01-26  7:31 ` Christoph Hellwig
  2009-01-26 23:43   ` Felix Blyakher
  2009-01-26  7:31 ` [PATCH 06/17] xfs: remove iclog calculation special cases Christoph Hellwig
                   ` (12 subsequent siblings)
  17 siblings, 1 reply; 50+ messages in thread
From: Christoph Hellwig @ 2009-01-26  7:31 UTC (permalink / raw)
  To: xfs

[-- Attachment #1: xfs-kill-XFS_MOUNT_ILOCK --]
[-- Type: text/plain, Size: 880 bytes --]

These aren't only unused but also reference a lock that doesn't exist anymore.


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

Index: xfs/fs/xfs/xfs_mount.h
===================================================================
--- xfs.orig/fs/xfs/xfs_mount.h	2009-01-21 21:03:27.866294994 +0100
+++ xfs/fs/xfs/xfs_mount.h	2009-01-24 18:13:41.777903750 +0100
@@ -500,9 +500,6 @@ typedef struct xfs_mod_sb {
 	int64_t		msb_delta;	/* Change to make to specified field */
 } xfs_mod_sb_t;
 
-#define	XFS_MOUNT_ILOCK(mp)	mutex_lock(&((mp)->m_ilock))
-#define	XFS_MOUNT_IUNLOCK(mp)	mutex_unlock(&((mp)->m_ilock))
-
 extern int	xfs_log_sbcount(xfs_mount_t *, uint);
 extern int	xfs_mountfs(xfs_mount_t *mp);
 extern void	xfs_mountfs_check_barriers(xfs_mount_t *mp);

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

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

* [PATCH 06/17] xfs: remove iclog calculation special cases
  2009-01-26  7:31 [PATCH 00/17] 2.6.30 queue Christoph Hellwig
                   ` (4 preceding siblings ...)
  2009-01-26  7:31 ` [PATCH 05/17] xfs: remove unused XFS_MOUNT_ILOCK/XFS_MOUNT_IUNLOCK Christoph Hellwig
@ 2009-01-26  7:31 ` Christoph Hellwig
  2009-02-09  2:15   ` Dave Chinner
  2009-01-26  7:31 ` [PATCH 07/17] xfs: remove superflous inobt macros Christoph Hellwig
                   ` (11 subsequent siblings)
  17 siblings, 1 reply; 50+ messages in thread
From: Christoph Hellwig @ 2009-01-26  7:31 UTC (permalink / raw)
  To: xfs

[-- Attachment #1: xfs-iclogs-calculation --]
[-- Type: text/plain, Size: 1607 bytes --]

Our default has been to always use 8 32KB log buffers for a while now, so
remove the special casing for larger block size filesystem to use the same
or even lower number of buffers.

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

Index: xfs/fs/xfs/xfs_log.c
===================================================================
--- xfs.orig/fs/xfs/xfs_log.c	2009-01-21 21:03:27.862294904 +0100
+++ xfs/fs/xfs/xfs_log.c	2009-01-24 18:15:18.336779335 +0100
@@ -1164,32 +1164,8 @@ xlog_get_iclog_buffer_size(xfs_mount_t	*
 	log->l_iclog_hsize = BBSIZE;
 	log->l_iclog_heads = 1;
 
-	/*
-	 * For 16KB, we use 3 32KB buffers.  For 32KB block sizes, we use
-	 * 4 32KB buffers.  For 64KB block sizes, we use 8 32KB buffers.
-	 */
-	if (mp->m_sb.sb_blocksize >= 16*1024) {
-		log->l_iclog_size = XLOG_BIG_RECORD_BSIZE;
-		log->l_iclog_size_log = XLOG_BIG_RECORD_BSHIFT;
-		if (mp->m_logbufs <= 0) {
-			switch (mp->m_sb.sb_blocksize) {
-			    case 16*1024:			/* 16 KB */
-				log->l_iclog_bufs = 3;
-				break;
-			    case 32*1024:			/* 32 KB */
-				log->l_iclog_bufs = 4;
-				break;
-			    case 64*1024:			/* 64 KB */
-				log->l_iclog_bufs = 8;
-				break;
-			    default:
-				xlog_panic("XFS: Invalid blocksize");
-				break;
-			}
-		}
-	}
-
-done:	/* are we being asked to make the sizes selected above visible? */
+done:
+	/* are we being asked to make the sizes selected above visible? */
 	if (mp->m_logbufs == 0)
 		mp->m_logbufs = log->l_iclog_bufs;
 	if (mp->m_logbsize == 0)

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

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

* [PATCH 07/17] xfs: remove superflous inobt macros
  2009-01-26  7:31 [PATCH 00/17] 2.6.30 queue Christoph Hellwig
                   ` (5 preceding siblings ...)
  2009-01-26  7:31 ` [PATCH 06/17] xfs: remove iclog calculation special cases Christoph Hellwig
@ 2009-01-26  7:31 ` Christoph Hellwig
  2009-02-09  2:16   ` Dave Chinner
  2009-01-26  7:31 ` [PATCH 08/17] xfs: remove uchar_t/ushort_t/uint_t/ulong_t types Christoph Hellwig
                   ` (10 subsequent siblings)
  17 siblings, 1 reply; 50+ messages in thread
From: Christoph Hellwig @ 2009-01-26  7:31 UTC (permalink / raw)
  To: xfs

[-- Attachment #1: xfs-inobt-kill-macros --]
[-- Type: text/plain, Size: 6904 bytes --]

xfs_ialloc_btree.h has a a cuple of macros that only obsfucate the code
but don't provide any abstraction benefits.  This patches removes those
and cleans up the reamaining defintions up a little.


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

Index: xfs/fs/xfs/xfs_ialloc.c
===================================================================
--- xfs.orig/fs/xfs/xfs_ialloc.c	2009-01-21 21:03:27.855294780 +0100
+++ xfs/fs/xfs/xfs_ialloc.c	2009-01-24 18:32:57.973428715 +0100
@@ -230,7 +230,7 @@ xfs_ialloc_ag_alloc(
 		args.minalignslop = xfs_ialloc_cluster_alignment(&args) - 1;
 
 		/* Allow space for the inode btree to split. */
-		args.minleft = XFS_IN_MAXLEVELS(args.mp) - 1;
+		args.minleft = args.mp->m_in_maxlevels - 1;
 		if ((error = xfs_alloc_vextent(&args)))
 			return error;
 	} else
@@ -270,7 +270,7 @@ xfs_ialloc_ag_alloc(
 		/*
 		 * Allow space for the inode btree to split.
 		 */
-		args.minleft = XFS_IN_MAXLEVELS(args.mp) - 1;
+		args.minleft = args.mp->m_in_maxlevels - 1;
 		if ((error = xfs_alloc_vextent(&args)))
 			return error;
 	}
@@ -943,7 +943,7 @@ nextag:
 	ASSERT((XFS_AGINO_TO_OFFSET(mp, rec.ir_startino) %
 				   XFS_INODES_PER_CHUNK) == 0);
 	ino = XFS_AGINO_TO_INO(mp, agno, rec.ir_startino + offset);
-	XFS_INOBT_CLR_FREE(&rec, offset);
+	rec.ir_free &= ~XFS_INOBT_MASK(offset);
 	rec.ir_freecount--;
 	if ((error = xfs_inobt_update(cur, rec.ir_startino, rec.ir_freecount,
 			rec.ir_free)))
@@ -1105,11 +1105,11 @@ xfs_difree(
 	 */
 	off = agino - rec.ir_startino;
 	ASSERT(off >= 0 && off < XFS_INODES_PER_CHUNK);
-	ASSERT(!XFS_INOBT_IS_FREE(&rec, off));
+	ASSERT(!(rec.ir_free & XFS_INOBT_MASK(off)));
 	/*
 	 * Mark the inode free & increment the count.
 	 */
-	XFS_INOBT_SET_FREE(&rec, off);
+	rec.ir_free |= XFS_INOBT_MASK(off);
 	rec.ir_freecount++;
 
 	/*
Index: xfs/fs/xfs/xfs_ialloc_btree.h
===================================================================
--- xfs.orig/fs/xfs/xfs_ialloc_btree.h	2009-01-21 21:03:27.856294768 +0100
+++ xfs/fs/xfs/xfs_ialloc_btree.h	2009-01-24 18:37:45.158596049 +0100
@@ -32,14 +32,14 @@ struct xfs_mount;
 #define	XFS_IBT_MAGIC	0x49414254	/* 'IABT' */
 
 typedef	__uint64_t	xfs_inofree_t;
-#define	XFS_INODES_PER_CHUNK	(NBBY * sizeof(xfs_inofree_t))
+#define	XFS_INODES_PER_CHUNK		(NBBY * sizeof(xfs_inofree_t))
 #define	XFS_INODES_PER_CHUNK_LOG	(XFS_NBBYLOG + 3)
-#define	XFS_INOBT_ALL_FREE	((xfs_inofree_t)-1)
+#define	XFS_INOBT_ALL_FREE		((xfs_inofree_t)-1)
+#define	XFS_INOBT_MASK(i)		((xfs_inofree_t)1 << (i))
 
 static inline xfs_inofree_t xfs_inobt_maskn(int i, int n)
 {
-	return (((n) >= XFS_INODES_PER_CHUNK ? \
-		(xfs_inofree_t)0 : ((xfs_inofree_t)1 << (n))) - 1) << (i);
+	return ((n >= XFS_INODES_PER_CHUNK ? 0 : XFS_INOBT_MASK(n)) - 1) << i;
 }
 
 /*
@@ -69,20 +69,6 @@ typedef struct xfs_inobt_key {
 typedef __be32 xfs_inobt_ptr_t;
 
 /*
- * Bit manipulations for ir_free.
- */
-#define	XFS_INOBT_MASK(i)		((xfs_inofree_t)1 << (i))
-#define	XFS_INOBT_IS_FREE(rp,i)		\
-		(((rp)->ir_free & XFS_INOBT_MASK(i)) != 0)
-#define	XFS_INOBT_SET_FREE(rp,i)	((rp)->ir_free |= XFS_INOBT_MASK(i))
-#define	XFS_INOBT_CLR_FREE(rp,i)	((rp)->ir_free &= ~XFS_INOBT_MASK(i))
-
-/*
- * Maximum number of inode btree levels.
- */
-#define	XFS_IN_MAXLEVELS(mp)		((mp)->m_in_maxlevels)
-
-/*
  * block numbers in the AG.
  */
 #define	XFS_IBT_BLOCK(mp)		((xfs_agblock_t)(XFS_CNT_BLOCK(mp) + 1))
Index: xfs/fs/xfs/xfs_mount.h
===================================================================
--- xfs.orig/fs/xfs/xfs_mount.h	2009-01-24 18:13:41.777903750 +0100
+++ xfs/fs/xfs/xfs_mount.h	2009-01-24 18:32:57.980458591 +0100
@@ -273,7 +273,7 @@ typedef struct xfs_mount {
 	uint			m_inobt_mnr[2];	/* min inobt btree records */
 	uint			m_ag_maxlevels;	/* XFS_AG_MAXLEVELS */
 	uint			m_bm_maxlevels[2]; /* XFS_BM_MAXLEVELS */
-	uint			m_in_maxlevels;	/* XFS_IN_MAXLEVELS */
+	uint			m_in_maxlevels;	/* max inobt btree levels. */
 	struct xfs_perag	*m_perag;	/* per-ag accounting info */
 	struct rw_semaphore	m_peraglock;	/* lock for m_perag (pointer) */
 	struct mutex		m_growlock;	/* growfs mutex */
Index: xfs/fs/xfs/xfs_trans.h
===================================================================
--- xfs.orig/fs/xfs/xfs_trans.h	2009-01-21 21:03:27.869295167 +0100
+++ xfs/fs/xfs/xfs_trans.h	2009-01-24 18:32:57.981428687 +0100
@@ -343,7 +343,7 @@ xfs_lic_desc_to_chunk(xfs_log_item_desc_
 	  (128 * (9 + XFS_ALLOCFREE_LOG_COUNT(mp, 4))) + \
 	  (128 * 5) + \
 	  XFS_ALLOCFREE_LOG_RES(mp, 1) + \
-	   (128 * (2 + XFS_IALLOC_BLOCKS(mp) + XFS_IN_MAXLEVELS(mp) + \
+	   (128 * (2 + XFS_IALLOC_BLOCKS(mp) + (mp)->m_in_maxlevels + \
 	    XFS_ALLOCFREE_LOG_COUNT(mp, 1))))))
 
 #define	XFS_ITRUNCATE_LOG_RES(mp)   ((mp)->m_reservations.tr_itruncate)
@@ -449,9 +449,9 @@ xfs_lic_desc_to_chunk(xfs_log_item_desc_
 	  (128 * (4 + XFS_DIROP_LOG_COUNT(mp)))), \
 	 (2 * (mp)->m_sb.sb_sectsize + \
 	  XFS_FSB_TO_B((mp), XFS_IALLOC_BLOCKS((mp))) + \
-	  XFS_FSB_TO_B((mp), XFS_IN_MAXLEVELS(mp)) + \
+	  XFS_FSB_TO_B((mp), (mp)->m_in_maxlevels) + \
 	  XFS_ALLOCFREE_LOG_RES(mp, 1) + \
-	  (128 * (2 + XFS_IALLOC_BLOCKS(mp) + XFS_IN_MAXLEVELS(mp) + \
+	  (128 * (2 + XFS_IALLOC_BLOCKS(mp) + (mp)->m_in_maxlevels + \
 	   XFS_ALLOCFREE_LOG_COUNT(mp, 1))))))
 
 #define	XFS_SYMLINK_LOG_RES(mp)	((mp)->m_reservations.tr_symlink)
@@ -481,9 +481,9 @@ xfs_lic_desc_to_chunk(xfs_log_item_desc_
 	  (128 * (3 + XFS_DIROP_LOG_COUNT(mp)))), \
 	 (3 * (mp)->m_sb.sb_sectsize + \
 	  XFS_FSB_TO_B((mp), XFS_IALLOC_BLOCKS((mp))) + \
-	  XFS_FSB_TO_B((mp), XFS_IN_MAXLEVELS(mp)) + \
+	  XFS_FSB_TO_B((mp), (mp)->m_in_maxlevels) + \
 	  XFS_ALLOCFREE_LOG_RES(mp, 1) + \
-	  (128 * (2 + XFS_IALLOC_BLOCKS(mp) + XFS_IN_MAXLEVELS(mp) + \
+	  (128 * (2 + XFS_IALLOC_BLOCKS(mp) + (mp)->m_in_maxlevels + \
 	   XFS_ALLOCFREE_LOG_COUNT(mp, 1))))))
 
 #define	XFS_CREATE_LOG_RES(mp)	((mp)->m_reservations.tr_create)
@@ -513,7 +513,7 @@ xfs_lic_desc_to_chunk(xfs_log_item_desc_
 	 MAX((__uint16_t)XFS_FSB_TO_B((mp), 1), XFS_INODE_CLUSTER_SIZE(mp)) + \
 	 (128 * 5) + \
 	  XFS_ALLOCFREE_LOG_RES(mp, 1) + \
-	  (128 * (2 + XFS_IALLOC_BLOCKS(mp) + XFS_IN_MAXLEVELS(mp) + \
+	  (128 * (2 + XFS_IALLOC_BLOCKS(mp) + (mp)->m_in_maxlevels + \
 	   XFS_ALLOCFREE_LOG_COUNT(mp, 1))))
 
 
Index: xfs/fs/xfs/xfs_trans_space.h
===================================================================
--- xfs.orig/fs/xfs/xfs_trans_space.h	2009-01-21 21:03:27.870294945 +0100
+++ xfs/fs/xfs/xfs_trans_space.h	2009-01-24 18:32:57.982461290 +0100
@@ -47,7 +47,7 @@
 #define	XFS_DIRREMOVE_SPACE_RES(mp)	\
 	XFS_DAREMOVE_SPACE_RES(mp, XFS_DATA_FORK)
 #define	XFS_IALLOC_SPACE_RES(mp)	\
-	(XFS_IALLOC_BLOCKS(mp) + XFS_IN_MAXLEVELS(mp)-1)
+	(XFS_IALLOC_BLOCKS(mp) + (mp)->m_in_maxlevels - 1)
 
 /*
  * Space reservation values for various transactions.

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

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

* [PATCH 08/17] xfs: remove uchar_t/ushort_t/uint_t/ulong_t types
  2009-01-26  7:31 [PATCH 00/17] 2.6.30 queue Christoph Hellwig
                   ` (6 preceding siblings ...)
  2009-01-26  7:31 ` [PATCH 07/17] xfs: remove superflous inobt macros Christoph Hellwig
@ 2009-01-26  7:31 ` Christoph Hellwig
  2009-02-09  2:18   ` Dave Chinner
  2009-01-26  7:31 ` [PATCH 09/17] xfs: cleanup xfs_find_handle Christoph Hellwig
                   ` (9 subsequent siblings)
  17 siblings, 1 reply; 50+ messages in thread
From: Christoph Hellwig @ 2009-01-26  7:31 UTC (permalink / raw)
  To: xfs

[-- Attachment #1: xfs-kill-ufoo_t-types --]
[-- Type: text/plain, Size: 4983 bytes --]

Just another set of types obsfucating the code, remove them.


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

Index: xfs/fs/xfs/linux-2.6/xfs_super.c
===================================================================
--- xfs.orig/fs/xfs/linux-2.6/xfs_super.c	2009-01-24 17:58:57.163785983 +0100
+++ xfs/fs/xfs/linux-2.6/xfs_super.c	2009-01-25 06:19:23.173491868 +0100
@@ -180,7 +180,7 @@ xfs_parseargs(
 	int			dswidth = 0;
 	int			iosize = 0;
 	int			dmapi_implies_ikeep = 1;
-	uchar_t			iosizelog = 0;
+	__uint8_t		iosizelog = 0;
 
 	/*
 	 * Copy binary VFS mount flags we are interested in.
Index: xfs/fs/xfs/xfs_ag.h
===================================================================
--- xfs.orig/fs/xfs/xfs_ag.h	2009-01-21 21:03:27.838294778 +0100
+++ xfs/fs/xfs/xfs_ag.h	2009-01-24 18:40:10.116428891 +0100
@@ -223,8 +223,8 @@ typedef struct xfs_perag
 		be32_to_cpu((a)->agf_levels[XFS_BTNUM_CNTi]), mp))
 #define	XFS_MIN_FREELIST_PAG(pag,mp)	\
 	(XFS_MIN_FREELIST_RAW(		\
-		(uint_t)(pag)->pagf_levels[XFS_BTNUM_BNOi], \
-		(uint_t)(pag)->pagf_levels[XFS_BTNUM_CNTi], mp))
+		(unsigned int)(pag)->pagf_levels[XFS_BTNUM_BNOi], \
+		(unsigned int)(pag)->pagf_levels[XFS_BTNUM_CNTi], mp))
 
 #define XFS_AGB_TO_FSB(mp,agno,agbno)	\
 	(((xfs_fsblock_t)(agno) << (mp)->m_sb.sb_agblklog) | (agbno))
Index: xfs/fs/xfs/xfs_da_btree.c
===================================================================
--- xfs.orig/fs/xfs/xfs_da_btree.c	2009-01-24 18:13:02.655903952 +0100
+++ xfs/fs/xfs/xfs_da_btree.c	2009-01-24 18:40:10.117429298 +0100
@@ -1503,7 +1503,7 @@ xfs_da_path_shift(xfs_da_state_t *state,
  * This is implemented with some source-level loop unrolling.
  */
 xfs_dahash_t
-xfs_da_hashname(const uchar_t *name, int namelen)
+xfs_da_hashname(const __uint8_t *name, int namelen)
 {
 	xfs_dahash_t hash;
 
Index: xfs/fs/xfs/xfs_da_btree.h
===================================================================
--- xfs.orig/fs/xfs/xfs_da_btree.h	2009-01-21 21:03:27.847295087 +0100
+++ xfs/fs/xfs/xfs_da_btree.h	2009-01-24 18:40:10.118428797 +0100
@@ -91,9 +91,9 @@ enum xfs_dacmp {
  * Structure to ease passing around component names.
  */
 typedef struct xfs_da_args {
-	const uchar_t	*name;		/* string (maybe not NULL terminated) */
+	const __uint8_t	*name;		/* string (maybe not NULL terminated) */
 	int		namelen;	/* length of string (maybe no NULL) */
-	uchar_t		*value;		/* set of bytes (maybe contain NULLs) */
+	__uint8_t	*value;		/* set of bytes (maybe contain NULLs) */
 	int		valuelen;	/* length of value */
 	int		flags;		/* argument flags (eg: ATTR_NOCREATE) */
 	xfs_dahash_t	hashval;	/* hash value of name */
@@ -251,7 +251,7 @@ xfs_daddr_t	xfs_da_reada_buf(struct xfs_
 int	xfs_da_shrink_inode(xfs_da_args_t *args, xfs_dablk_t dead_blkno,
 					  xfs_dabuf_t *dead_buf);
 
-uint xfs_da_hashname(const uchar_t *name_string, int name_length);
+uint xfs_da_hashname(const __uint8_t *name_string, int name_length);
 enum xfs_dacmp xfs_da_compname(struct xfs_da_args *args,
 				const char *name, int len);
 
Index: xfs/fs/xfs/xfs_log_priv.h
===================================================================
--- xfs.orig/fs/xfs/xfs_log_priv.h	2009-01-21 21:03:27.863295380 +0100
+++ xfs/fs/xfs/xfs_log_priv.h	2009-01-24 18:40:10.118428797 +0100
@@ -359,7 +359,7 @@ typedef struct xlog_in_core {
 	int			ic_size;
 	int			ic_offset;
 	int			ic_bwritecnt;
-	ushort_t		ic_state;
+	unsigned short		ic_state;
 	char			*ic_datap;	/* pointer to iclog data */
 #ifdef XFS_LOG_TRACE
 	struct ktrace		*ic_trace;
Index: xfs/fs/xfs/xfs_log_recover.c
===================================================================
--- xfs.orig/fs/xfs/xfs_log_recover.c	2009-01-21 21:03:27.864295019 +0100
+++ xfs/fs/xfs/xfs_log_recover.c	2009-01-25 06:19:48.044397387 +0100
@@ -192,11 +192,11 @@ xlog_header_check_dump(
 
 	cmn_err(CE_DEBUG, "%s:  SB : uuid = ", __func__);
 	for (b = 0; b < 16; b++)
-		cmn_err(CE_DEBUG, "%02x", ((uchar_t *)&mp->m_sb.sb_uuid)[b]);
+		cmn_err(CE_DEBUG, "%02x", ((__uint8_t *)&mp->m_sb.sb_uuid)[b]);
 	cmn_err(CE_DEBUG, ", fmt = %d\n", XLOG_FMT);
 	cmn_err(CE_DEBUG, "    log : uuid = ");
 	for (b = 0; b < 16; b++)
-		cmn_err(CE_DEBUG, "%02x",((uchar_t *)&head->h_fs_uuid)[b]);
+		cmn_err(CE_DEBUG, "%02x", ((__uint8_t *)&head->h_fs_uuid)[b]);
 	cmn_err(CE_DEBUG, ", fmt = %d\n", be32_to_cpu(head->h_fmt));
 }
 #else
Index: xfs/fs/xfs/xfs_types.h
===================================================================
--- xfs.orig/fs/xfs/xfs_types.h	2009-01-22 00:54:49.351809660 +0100
+++ xfs/fs/xfs/xfs_types.h	2009-01-24 18:40:10.120456918 +0100
@@ -21,14 +21,6 @@
 #ifdef __KERNEL__
 
 /*
- * POSIX Extensions
- */
-typedef unsigned char		uchar_t;
-typedef unsigned short		ushort_t;
-typedef unsigned int		uint_t;
-typedef unsigned long		ulong_t;
-
-/*
  * Additional type declarations for XFS
  */
 typedef signed char		__int8_t;

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

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

* [PATCH 09/17] xfs: cleanup xfs_find_handle
  2009-01-26  7:31 [PATCH 00/17] 2.6.30 queue Christoph Hellwig
                   ` (7 preceding siblings ...)
  2009-01-26  7:31 ` [PATCH 08/17] xfs: remove uchar_t/ushort_t/uint_t/ulong_t types Christoph Hellwig
@ 2009-01-26  7:31 ` Christoph Hellwig
  2009-02-06  5:20   ` Felix Blyakher
  2009-01-26  7:31 ` [PATCH 10/17] xfs: factor out attr fork reset handling Christoph Hellwig
                   ` (8 subsequent siblings)
  17 siblings, 1 reply; 50+ messages in thread
From: Christoph Hellwig @ 2009-01-26  7:31 UTC (permalink / raw)
  To: xfs

[-- Attachment #1: xfs-cleanup-xfs_find_handle --]
[-- Type: text/plain, Size: 3839 bytes --]

Remove the superflous igrab by keeping a reference on the path/file all the
time and clean up various bits of surrounding code.


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

Index: xfs/fs/xfs/linux-2.6/xfs_ioctl.c
===================================================================
--- xfs.orig/fs/xfs/linux-2.6/xfs_ioctl.c	2009-01-21 21:03:27.828295110 +0100
+++ xfs/fs/xfs/linux-2.6/xfs_ioctl.c	2009-01-24 18:41:24.547427865 +0100
@@ -78,92 +78,74 @@ xfs_find_handle(
 	int			hsize;
 	xfs_handle_t		handle;
 	struct inode		*inode;
+	struct file		*file = NULL;
+	struct path		path;
+	int			error;
+	struct xfs_inode	*ip;
 
-	memset((char *)&handle, 0, sizeof(handle));
-
-	switch (cmd) {
-	case XFS_IOC_PATH_TO_FSHANDLE:
-	case XFS_IOC_PATH_TO_HANDLE: {
-		struct path path;
-		int error = user_lpath((const char __user *)hreq->path, &path);
+	if (cmd == XFS_IOC_FD_TO_HANDLE) {
+		file = fget(hreq->fd);
+		if (!file)
+			return -EBADF;
+		inode = file->f_path.dentry->d_inode;
+	} else {
+		error = user_lpath((const char __user *)hreq->path, &path);
 		if (error)
 			return error;
-
-		ASSERT(path.dentry);
-		ASSERT(path.dentry->d_inode);
-		inode = igrab(path.dentry->d_inode);
-		path_put(&path);
-		break;
+		inode = path.dentry->d_inode;
 	}
+	ip = XFS_I(inode);
 
-	case XFS_IOC_FD_TO_HANDLE: {
-		struct file	*file;
-
-		file = fget(hreq->fd);
-		if (!file)
-		    return -EBADF;
+	/*
+	 * We can only generate handles for inodes residing on a XFS filesystem,
+	 * and only for regular files, directories or symbolic links.
+	 */
+	error = -EINVAL;
+	if (inode->i_sb->s_magic != XFS_SB_MAGIC)
+		goto out_put;
 
-		ASSERT(file->f_path.dentry);
-		ASSERT(file->f_path.dentry->d_inode);
-		inode = igrab(file->f_path.dentry->d_inode);
-		fput(file);
-		break;
-	}
+	error = -EBADF;
+	if (!S_ISREG(inode->i_mode) &&
+	    !S_ISDIR(inode->i_mode) &&
+	    !S_ISLNK(inode->i_mode))
+		goto out_put;
 
-	default:
-		ASSERT(0);
-		return -XFS_ERROR(EINVAL);
-	}
 
-	if (inode->i_sb->s_magic != XFS_SB_MAGIC) {
-		/* we're not in XFS anymore, Toto */
-		iput(inode);
-		return -XFS_ERROR(EINVAL);
-	}
+	memcpy(&handle.ha_fsid, ip->i_mount->m_fixedfsid, sizeof(xfs_fsid_t));
 
-	switch (inode->i_mode & S_IFMT) {
-	case S_IFREG:
-	case S_IFDIR:
-	case S_IFLNK:
-		break;
-	default:
-		iput(inode);
-		return -XFS_ERROR(EBADF);
-	}
-
-	/* now we can grab the fsid */
-	memcpy(&handle.ha_fsid, XFS_I(inode)->i_mount->m_fixedfsid,
-			sizeof(xfs_fsid_t));
-	hsize = sizeof(xfs_fsid_t);
-
-	if (cmd != XFS_IOC_PATH_TO_FSHANDLE) {
-		xfs_inode_t	*ip = XFS_I(inode);
+	if (cmd == XFS_IOC_PATH_TO_FSHANDLE) {
+		/*
+		 * This handle only contains an fsid, zero the rest.
+		 */
+		memset(&handle.ha_fid, 0, sizeof(handle.ha_fid));
+		hsize = sizeof(xfs_fsid_t);
+	} else {
 		int		lock_mode;
 
-		/* need to get access to the xfs_inode to read the generation */
 		lock_mode = xfs_ilock_map_shared(ip);
-
-		/* fill in fid section of handle from inode */
 		handle.ha_fid.fid_len = sizeof(xfs_fid_t) -
 					sizeof(handle.ha_fid.fid_len);
 		handle.ha_fid.fid_pad = 0;
 		handle.ha_fid.fid_gen = ip->i_d.di_gen;
 		handle.ha_fid.fid_ino = ip->i_ino;
-
 		xfs_iunlock_map_shared(ip, lock_mode);
 
 		hsize = XFS_HSIZE(handle);
 	}
 
-	/* now copy our handle into the user buffer & write out the size */
+	error = -EFAULT;
 	if (copy_to_user(hreq->ohandle, &handle, hsize) ||
-	    copy_to_user(hreq->ohandlen, &hsize, sizeof(__s32))) {
-		iput(inode);
-		return -XFS_ERROR(EFAULT);
-	}
+	    copy_to_user(hreq->ohandlen, &hsize, sizeof(__s32)))
+		goto out_put;
 
-	iput(inode);
-	return 0;
+	error = 0;
+
+ out_put:
+	if (cmd == XFS_IOC_FD_TO_HANDLE)
+		fput(file);
+	else
+		path_put(&path);
+	return error;
 }
 
 /*

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

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

* [PATCH 10/17] xfs: factor out attr fork reset handling
  2009-01-26  7:31 [PATCH 00/17] 2.6.30 queue Christoph Hellwig
                   ` (8 preceding siblings ...)
  2009-01-26  7:31 ` [PATCH 09/17] xfs: cleanup xfs_find_handle Christoph Hellwig
@ 2009-01-26  7:31 ` Christoph Hellwig
  2009-01-27 16:53   ` Felix Blyakher
  2009-01-26  7:31 ` [PATCH 11/17] xfs: merge xfs_inode_flush into xfs_fs_write_inode Christoph Hellwig
                   ` (7 subsequent siblings)
  17 siblings, 1 reply; 50+ messages in thread
From: Christoph Hellwig @ 2009-01-26  7:31 UTC (permalink / raw)
  To: xfs

[-- Attachment #1: xfs-factor-attr-delete-code --]
[-- Type: text/plain, Size: 3016 bytes --]

We currently duplicate code to reset the attribute fork after the last
attribute has been deleted.  Factor this out into a small helper.


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

Index: xfs/fs/xfs/xfs_attr_leaf.c
===================================================================
--- xfs.orig/fs/xfs/xfs_attr_leaf.c	2008-12-27 18:07:05.485688220 +0100
+++ xfs/fs/xfs/xfs_attr_leaf.c	2008-12-27 18:20:09.770563952 +0100
@@ -298,6 +298,26 @@ xfs_attr_shortform_add(xfs_da_args_t *ar
 }
 
 /*
+ * After the last attribute is removed revert to original inode format,
+ * making all literal area available to the data fork once more.
+ */
+STATIC void
+xfs_attr_fork_reset(
+	struct xfs_inode	*ip,
+	struct xfs_trans	*tp)
+{
+	xfs_idestroy_fork(ip, XFS_ATTR_FORK);
+	ip->i_d.di_forkoff = 0;
+	ip->i_d.di_aformat = XFS_DINODE_FMT_EXTENTS;
+
+	ASSERT(ip->i_d.di_anextents == 0);
+	ASSERT(ip->i_afp == NULL);
+
+	ip->i_df.if_ext_max = XFS_IFORK_DSIZE(ip) / sizeof(xfs_bmbt_rec_t);
+	xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
+}
+
+/*
  * Remove an attribute from the shortform attribute list structure.
  */
 int
@@ -344,22 +364,10 @@ xfs_attr_shortform_remove(xfs_da_args_t 
 	 */
 	totsize -= size;
 	if (totsize == sizeof(xfs_attr_sf_hdr_t) &&
-				!(args->op_flags & XFS_DA_OP_ADDNAME) &&
-				(mp->m_flags & XFS_MOUNT_ATTR2) &&
-				(dp->i_d.di_format != XFS_DINODE_FMT_BTREE)) {
-		/*
-		 * Last attribute now removed, revert to original
-		 * inode format making all literal area available
-		 * to the data fork once more.
-		 */
-		xfs_idestroy_fork(dp, XFS_ATTR_FORK);
-		dp->i_d.di_forkoff = 0;
-		dp->i_d.di_aformat = XFS_DINODE_FMT_EXTENTS;
-		ASSERT(dp->i_d.di_anextents == 0);
-		ASSERT(dp->i_afp == NULL);
-		dp->i_df.if_ext_max =
-			XFS_IFORK_DSIZE(dp) / (uint)sizeof(xfs_bmbt_rec_t);
-		xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE);
+	    (mp->m_flags & XFS_MOUNT_ATTR2) &&
+	    (dp->i_d.di_format != XFS_DINODE_FMT_BTREE) &&
+	    !(args->op_flags & XFS_DA_OP_ADDNAME)) {
+		xfs_attr_fork_reset(dp, args->trans);
 	} else {
 		xfs_idata_realloc(dp, -size, XFS_ATTR_FORK);
 		dp->i_d.di_forkoff = xfs_attr_shortform_bytesfit(dp, totsize);
@@ -786,20 +794,7 @@ xfs_attr_leaf_to_shortform(xfs_dabuf_t *
 	if (forkoff == -1) {
 		ASSERT(dp->i_mount->m_flags & XFS_MOUNT_ATTR2);
 		ASSERT(dp->i_d.di_format != XFS_DINODE_FMT_BTREE);
-
-		/*
-		 * Last attribute was removed, revert to original
-		 * inode format making all literal area available
-		 * to the data fork once more.
-		 */
-		xfs_idestroy_fork(dp, XFS_ATTR_FORK);
-		dp->i_d.di_forkoff = 0;
-		dp->i_d.di_aformat = XFS_DINODE_FMT_EXTENTS;
-		ASSERT(dp->i_d.di_anextents == 0);
-		ASSERT(dp->i_afp == NULL);
-		dp->i_df.if_ext_max =
-			XFS_IFORK_DSIZE(dp) / (uint)sizeof(xfs_bmbt_rec_t);
-		xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE);
+		xfs_attr_fork_reset(dp, args->trans);
 		goto out;
 	}
 

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

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

* [PATCH 11/17] xfs: merge xfs_inode_flush into xfs_fs_write_inode
  2009-01-26  7:31 [PATCH 00/17] 2.6.30 queue Christoph Hellwig
                   ` (9 preceding siblings ...)
  2009-01-26  7:31 ` [PATCH 10/17] xfs: factor out attr fork reset handling Christoph Hellwig
@ 2009-01-26  7:31 ` Christoph Hellwig
  2009-01-27 17:37   ` Felix Blyakher
                     ` (2 more replies)
  2009-01-26  7:31 ` [PATCH 12/17] xfs: merge xfs_mkdir into xfs_create Christoph Hellwig
                   ` (6 subsequent siblings)
  17 siblings, 3 replies; 50+ messages in thread
From: Christoph Hellwig @ 2009-01-26  7:31 UTC (permalink / raw)
  To: xfs

[-- Attachment #1: xfs-kill-xfs_inode_flush --]
[-- Type: text/plain, Size: 4686 bytes --]

Spliting the task for a VFS-induced inode flush into two functions doesn't
make any sense, so merge the two functions dealing with it.


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

Index: xfs/fs/xfs/linux-2.6/xfs_super.c
===================================================================
--- xfs.orig/fs/xfs/linux-2.6/xfs_super.c	2009-01-24 18:40:10.116428891 +0100
+++ xfs/fs/xfs/linux-2.6/xfs_super.c	2009-01-24 18:50:29.764553115 +0100
@@ -990,26 +990,57 @@ xfs_fs_write_inode(
 	int			sync)
 {
 	struct xfs_inode	*ip = XFS_I(inode);
+	struct xfs_mount	*mp = ip->i_mount;
 	int			error = 0;
-	int			flags = 0;
 
 	xfs_itrace_entry(ip);
+
+	if (XFS_FORCED_SHUTDOWN(mp))
+		return XFS_ERROR(EIO);
+
 	if (sync) {
 		error = xfs_wait_on_pages(ip, 0, -1);
 		if (error)
-			goto out_error;
-		flags |= FLUSH_SYNC;
+			goto out;
+	}
+
+	/*
+	 * Bypass inodes which have already been cleaned by
+	 * the inode flush clustering code inside xfs_iflush
+	 */
+	if (xfs_inode_clean(ip))
+		goto out;
+
+	/*
+	 * We make this non-blocking if the inode is contended, return
+	 * EAGAIN to indicate to the caller that they did not succeed.
+	 * This prevents the flush path from blocking on inodes inside
+	 * another operation right now, they get caught later by xfs_sync.
+	 */
+	if (sync) {
+		xfs_ilock(ip, XFS_ILOCK_SHARED);
+		xfs_iflock(ip);
+
+		error = xfs_iflush(ip, XFS_IFLUSH_SYNC);
+	} else {
+		error = EAGAIN;
+		if (!xfs_ilock_nowait(ip, XFS_ILOCK_SHARED))
+			goto out;
+		if (xfs_ipincount(ip) || !xfs_iflock_nowait(ip))
+			goto out_unlock;
+
+		error = xfs_iflush(ip, XFS_IFLUSH_ASYNC_NOBLOCK);
 	}
-	error = xfs_inode_flush(ip, flags);
 
-out_error:
+ out_unlock:
+	xfs_iunlock(ip, XFS_ILOCK_SHARED);
+ out:
 	/*
 	 * if we failed to write out the inode then mark
 	 * it dirty again so we'll try again later.
 	 */
 	if (error)
 		xfs_mark_inode_dirty_sync(ip);
-
 	return -error;
 }
 
Index: xfs/fs/xfs/linux-2.6/xfs_vnode.h
===================================================================
--- xfs.orig/fs/xfs/linux-2.6/xfs_vnode.h	2009-01-21 21:03:27.831294794 +0100
+++ xfs/fs/xfs/linux-2.6/xfs_vnode.h	2009-01-24 18:50:29.764553115 +0100
@@ -41,11 +41,6 @@ struct attrlist_cursor_kern;
 #define IO_INVIS	0x00020		/* don't update inode timestamps */
 
 /*
- * Flags for xfs_inode_flush
- */
-#define FLUSH_SYNC		1	/* wait for flush to complete	*/
-
-/*
  * Flush/Invalidate options for vop_toss/flush/flushinval_pages.
  */
 #define FI_NONE			0	/* none */
Index: xfs/fs/xfs/xfs_vnodeops.c
===================================================================
--- xfs.orig/fs/xfs/xfs_vnodeops.c	2009-01-24 18:50:11.826428845 +0100
+++ xfs/fs/xfs/xfs_vnodeops.c	2009-01-24 18:50:29.767553567 +0100
@@ -2589,51 +2589,6 @@ std_return:
 }
 
 int
-xfs_inode_flush(
-	xfs_inode_t	*ip,
-	int		flags)
-{
-	xfs_mount_t	*mp = ip->i_mount;
-	int		error = 0;
-
-	if (XFS_FORCED_SHUTDOWN(mp))
-		return XFS_ERROR(EIO);
-
-	/*
-	 * Bypass inodes which have already been cleaned by
-	 * the inode flush clustering code inside xfs_iflush
-	 */
-	if (xfs_inode_clean(ip))
-		return 0;
-
-	/*
-	 * We make this non-blocking if the inode is contended,
-	 * return EAGAIN to indicate to the caller that they
-	 * did not succeed. This prevents the flush path from
-	 * blocking on inodes inside another operation right
-	 * now, they get caught later by xfs_sync.
-	 */
-	if (flags & FLUSH_SYNC) {
-		xfs_ilock(ip, XFS_ILOCK_SHARED);
-		xfs_iflock(ip);
-	} else if (xfs_ilock_nowait(ip, XFS_ILOCK_SHARED)) {
-		if (xfs_ipincount(ip) || !xfs_iflock_nowait(ip)) {
-			xfs_iunlock(ip, XFS_ILOCK_SHARED);
-			return EAGAIN;
-		}
-	} else {
-		return EAGAIN;
-	}
-
-	error = xfs_iflush(ip, (flags & FLUSH_SYNC) ? XFS_IFLUSH_SYNC
-						    : XFS_IFLUSH_ASYNC_NOBLOCK);
-	xfs_iunlock(ip, XFS_ILOCK_SHARED);
-
-	return error;
-}
-
-
-int
 xfs_set_dmattrs(
 	xfs_inode_t     *ip,
 	u_int		evmask,
Index: xfs/fs/xfs/xfs_vnodeops.h
===================================================================
--- xfs.orig/fs/xfs/xfs_vnodeops.h	2009-01-24 18:50:11.832429121 +0100
+++ xfs/fs/xfs/xfs_vnodeops.h	2009-01-24 18:50:40.648430311 +0100
@@ -38,7 +38,6 @@ int xfs_readdir(struct xfs_inode	*dp, vo
 int xfs_symlink(struct xfs_inode *dp, struct xfs_name *link_name,
 		const char *target_path, mode_t mode, struct xfs_inode **ipp,
 		cred_t *credp);
-int xfs_inode_flush(struct xfs_inode *ip, int flags);
 int xfs_set_dmattrs(struct xfs_inode *ip, u_int evmask, u_int16_t state);
 int xfs_reclaim(struct xfs_inode *ip);
 int xfs_change_file_space(struct xfs_inode *ip, int cmd,

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

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

* [PATCH 12/17] xfs: merge xfs_mkdir into xfs_create
  2009-01-26  7:31 [PATCH 00/17] 2.6.30 queue Christoph Hellwig
                   ` (10 preceding siblings ...)
  2009-01-26  7:31 ` [PATCH 11/17] xfs: merge xfs_inode_flush into xfs_fs_write_inode Christoph Hellwig
@ 2009-01-26  7:31 ` Christoph Hellwig
  2009-02-09  2:28   ` Dave Chinner
  2009-01-26  7:31 ` [PATCH 13/17] xfs: get rid of indirections in the quotaops implementation Christoph Hellwig
                   ` (5 subsequent siblings)
  17 siblings, 1 reply; 50+ messages in thread
From: Christoph Hellwig @ 2009-01-26  7:31 UTC (permalink / raw)
  To: xfs

[-- Attachment #1: xfs-merge-create --]
[-- Type: text/plain, Size: 14592 bytes --]

xfs_create and xfs_mkdir only have minor differences, so merge both of them
into a sigle function.  While we're at it also make the error handling code
more straight-forward.


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

Index: xfs/fs/xfs/linux-2.6/xfs_iops.c
===================================================================
--- xfs.orig/fs/xfs/linux-2.6/xfs_iops.c	2008-12-30 09:39:10.540493481 +0100
+++ xfs/fs/xfs/linux-2.6/xfs_iops.c	2008-12-30 09:39:58.643618532 +0100
@@ -211,8 +211,13 @@ xfs_vn_mknod(
 	 * Irix uses Missed'em'V split, but doesn't want to see
 	 * the upper 5 bits of (14bit) major.
 	 */
-	if (unlikely(!sysv_valid_dev(rdev) || MAJOR(rdev) & ~0x1ff))
-		return -EINVAL;
+	if (S_ISCHR(mode) || S_ISBLK(mode)) {
+		if (unlikely(!sysv_valid_dev(rdev) || MAJOR(rdev) & ~0x1ff))
+			return -EINVAL;
+		rdev = sysv_encode_dev(rdev);
+	} else {
+		rdev = 0;
+	}
 
 	if (test_default_acl && test_default_acl(dir)) {
 		if (!_ACL_ALLOC(default_acl)) {
@@ -224,28 +229,11 @@ xfs_vn_mknod(
 		}
 	}
 
-	xfs_dentry_to_name(&name, dentry);
-
 	if (IS_POSIXACL(dir) && !default_acl)
 		mode &= ~current->fs->umask;
 
-	switch (mode & S_IFMT) {
-	case S_IFCHR:
-	case S_IFBLK:
-	case S_IFIFO:
-	case S_IFSOCK:
-		rdev = sysv_encode_dev(rdev);
-	case S_IFREG:
-		error = xfs_create(XFS_I(dir), &name, mode, rdev, &ip, NULL);
-		break;
-	case S_IFDIR:
-		error = xfs_mkdir(XFS_I(dir), &name, mode, &ip, NULL);
-		break;
-	default:
-		error = EINVAL;
-		break;
-	}
-
+	xfs_dentry_to_name(&name, dentry);
+	error = xfs_create(XFS_I(dir), &name, mode, rdev, &ip, NULL);
 	if (unlikely(error))
 		goto out_free_acl;
 
Index: xfs/fs/xfs/xfs_vnodeops.c
===================================================================
--- xfs.orig/fs/xfs/xfs_vnodeops.c	2008-12-30 09:39:53.860619009 +0100
+++ xfs/fs/xfs/xfs_vnodeops.c	2008-12-30 09:39:58.648648223 +0100
@@ -1387,23 +1387,28 @@ xfs_create(
 	xfs_inode_t		**ipp,
 	cred_t			*credp)
 {
-	xfs_mount_t		*mp = dp->i_mount;
-	xfs_inode_t		*ip;
-	xfs_trans_t		*tp;
+	int			is_dir = S_ISDIR(mode);
+	struct xfs_mount	*mp = dp->i_mount;
+	struct xfs_inode	*ip = NULL;
+	struct xfs_trans	*tp = NULL;
 	int			error;
 	xfs_bmap_free_t		free_list;
 	xfs_fsblock_t		first_block;
 	boolean_t		unlock_dp_on_error = B_FALSE;
-	int			dm_event_sent = 0;
 	uint			cancel_flags;
 	int			committed;
 	xfs_prid_t		prid;
-	struct xfs_dquot	*udqp, *gdqp;
+	struct xfs_dquot	*udqp = NULL;
+	struct xfs_dquot	*gdqp = NULL;
 	uint			resblks;
+	uint			log_res;
+	uint			log_count;
 
-	ASSERT(!*ipp);
 	xfs_itrace_entry(dp);
 
+	if (XFS_FORCED_SHUTDOWN(mp))
+		return XFS_ERROR(EIO);
+
 	if (DM_EVENT_ENABLED(dp, DM_EVENT_CREATE)) {
 		error = XFS_SEND_NAMESP(mp, DM_EVENT_CREATE,
 				dp, DM_RIGHT_NULL, NULL,
@@ -1412,84 +1417,97 @@ xfs_create(
 
 		if (error)
 			return error;
-		dm_event_sent = 1;
 	}
 
-	if (XFS_FORCED_SHUTDOWN(mp))
-		return XFS_ERROR(EIO);
-
-	/* Return through std_return after this point. */
-
-	udqp = gdqp = NULL;
 	if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)
 		prid = dp->i_d.di_projid;
 	else
-		prid = (xfs_prid_t)dfltprid;
+		prid = dfltprid;
 
 	/*
 	 * Make sure that we have allocated dquot(s) on disk.
 	 */
 	error = XFS_QM_DQVOPALLOC(mp, dp,
 			current_fsuid(), current_fsgid(), prid,
-			XFS_QMOPT_QUOTALL|XFS_QMOPT_INHERIT, &udqp, &gdqp);
+			XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, &udqp, &gdqp);
 	if (error)
 		goto std_return;
 
-	ip = NULL;
+	if (is_dir) {
+		rdev = 0;
+		resblks = XFS_MKDIR_SPACE_RES(mp, name->len);
+		log_res = XFS_MKDIR_LOG_RES(mp);
+		log_count = XFS_MKDIR_LOG_COUNT;
+		tp = xfs_trans_alloc(mp, XFS_TRANS_MKDIR);
+	} else {
+		resblks = XFS_CREATE_SPACE_RES(mp, name->len);
+		log_res = XFS_CREATE_LOG_RES(mp);
+		log_count = XFS_CREATE_LOG_COUNT;
+		tp = xfs_trans_alloc(mp, XFS_TRANS_CREATE);
+	}
 
-	tp = xfs_trans_alloc(mp, XFS_TRANS_CREATE);
 	cancel_flags = XFS_TRANS_RELEASE_LOG_RES;
-	resblks = XFS_CREATE_SPACE_RES(mp, name->len);
+
 	/*
 	 * Initially assume that the file does not exist and
 	 * reserve the resources for that case.  If that is not
 	 * the case we'll drop the one we have and get a more
 	 * appropriate transaction later.
 	 */
-	error = xfs_trans_reserve(tp, resblks, XFS_CREATE_LOG_RES(mp), 0,
-			XFS_TRANS_PERM_LOG_RES, XFS_CREATE_LOG_COUNT);
+	error = xfs_trans_reserve(tp, resblks, log_res, 0,
+			XFS_TRANS_PERM_LOG_RES, log_count);
 	if (error == ENOSPC) {
 		resblks = 0;
-		error = xfs_trans_reserve(tp, 0, XFS_CREATE_LOG_RES(mp), 0,
-				XFS_TRANS_PERM_LOG_RES, XFS_CREATE_LOG_COUNT);
+		error = xfs_trans_reserve(tp, 0, log_res, 0,
+				XFS_TRANS_PERM_LOG_RES, log_count);
 	}
 	if (error) {
 		cancel_flags = 0;
-		goto error_return;
+		goto out_trans_cancel;
 	}
 
 	xfs_ilock(dp, XFS_ILOCK_EXCL | XFS_ILOCK_PARENT);
 	unlock_dp_on_error = B_TRUE;
 
-	xfs_bmap_init(&free_list, &first_block);
+	/*
+	 * Check for directory link count overflow.
+	 */
+	if (is_dir && dp->i_d.di_nlink >= XFS_MAXLINK) {
+		error = XFS_ERROR(EMLINK);
+		goto out_trans_cancel;
+	}
 
-	ASSERT(ip == NULL);
+	xfs_bmap_init(&free_list, &first_block);
 
 	/*
 	 * Reserve disk quota and the inode.
 	 */
 	error = XFS_TRANS_RESERVE_QUOTA(mp, tp, udqp, gdqp, resblks, 1, 0);
 	if (error)
-		goto error_return;
+		goto out_trans_cancel;
 
 	error = xfs_dir_canenter(tp, dp, name, resblks);
 	if (error)
-		goto error_return;
-	error = xfs_dir_ialloc(&tp, dp, mode, 1,
-			rdev, credp, prid, resblks > 0,
-			&ip, &committed);
+		goto out_trans_cancel;
+
+	/*
+	 * A newly created regular or special file just has one directory
+	 * 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, credp,
+			       prid, resblks > 0, &ip, &committed);
 	if (error) {
 		if (error == ENOSPC)
-			goto error_return;
-		goto abort_return;
+			goto out_trans_cancel;
+		goto out_trans_abort;
 	}
-	xfs_itrace_ref(ip);
 
 	/*
 	 * At this point, we've gotten a newly allocated inode.
 	 * It is locked (and joined to the transaction).
 	 */
-
+	xfs_itrace_ref(ip);
 	ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
 
 	/*
@@ -1508,19 +1526,28 @@ xfs_create(
 					resblks - XFS_IALLOC_SPACE_RES(mp) : 0);
 	if (error) {
 		ASSERT(error != ENOSPC);
-		goto abort_return;
+		goto out_trans_abort;
 	}
 	xfs_ichgtime(dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
 	xfs_trans_log_inode(tp, dp, XFS_ILOG_CORE);
 
+	if (is_dir) {
+		error = xfs_dir_init(tp, ip, dp);
+		if (error)
+			goto out_bmap_cancel;
+
+		error = xfs_bumplink(tp, dp);
+		if (error)
+			goto out_bmap_cancel;
+	}
+
 	/*
 	 * If this is a synchronous mount, make sure that the
 	 * create transaction goes to disk before returning to
 	 * the user.
 	 */
-	if (mp->m_flags & (XFS_MOUNT_WSYNC|XFS_MOUNT_DIRSYNC)) {
+	if (mp->m_flags & (XFS_MOUNT_WSYNC|XFS_MOUNT_DIRSYNC))
 		xfs_trans_set_sync(tp);
-	}
 
 	/*
 	 * Attach the dquot(s) to the inodes and modify them incore.
@@ -1537,16 +1564,13 @@ xfs_create(
 	IHOLD(ip);
 
 	error = xfs_bmap_finish(&tp, &free_list, &committed);
-	if (error) {
-		xfs_bmap_cancel(&free_list);
-		goto abort_rele;
-	}
+	if (error)
+		goto out_abort_rele;
 
 	error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES);
 	if (error) {
 		IRELE(ip);
-		tp = NULL;
-		goto error_return;
+		goto out_dqrele;
 	}
 
 	XFS_QM_DQRELE(mp, udqp);
@@ -1555,26 +1579,22 @@ xfs_create(
 	*ipp = ip;
 
 	/* Fallthrough to std_return with error = 0  */
-
-std_return:
-	if ((*ipp || (error != 0 && dm_event_sent != 0)) &&
-	    DM_EVENT_ENABLED(dp, DM_EVENT_POSTCREATE)) {
-		(void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTCREATE,
-			dp, DM_RIGHT_NULL,
-			*ipp ? ip : NULL,
-			DM_RIGHT_NULL, name->name, NULL,
-			mode, error, 0);
+ std_return:
+	if (DM_EVENT_ENABLED(dp, DM_EVENT_POSTCREATE)) {
+		XFS_SEND_NAMESP(mp, DM_EVENT_POSTCREATE, dp, DM_RIGHT_NULL,
+				ip, DM_RIGHT_NULL, name->name, NULL, mode,
+				error, 0);
 	}
+
 	return error;
 
- abort_return:
+ out_bmap_cancel:
+	xfs_bmap_cancel(&free_list);
+ out_trans_abort:
 	cancel_flags |= XFS_TRANS_ABORT;
-	/* FALLTHROUGH */
-
- error_return:
-	if (tp != NULL)
-		xfs_trans_cancel(tp, cancel_flags);
-
+ out_trans_cancel:
+	xfs_trans_cancel(tp, cancel_flags);
+ out_dqrele:
 	XFS_QM_DQRELE(mp, udqp);
 	XFS_QM_DQRELE(mp, gdqp);
 
@@ -1583,20 +1603,18 @@ std_return:
 
 	goto std_return;
 
- abort_rele:
+ out_abort_rele:
 	/*
 	 * Wait until after the current transaction is aborted to
 	 * release the inode.  This prevents recursive transactions
 	 * and deadlocks from xfs_inactive.
 	 */
+	xfs_bmap_cancel(&free_list);
 	cancel_flags |= XFS_TRANS_ABORT;
 	xfs_trans_cancel(tp, cancel_flags);
 	IRELE(ip);
-
-	XFS_QM_DQRELE(mp, udqp);
-	XFS_QM_DQRELE(mp, gdqp);
-
-	goto std_return;
+	unlock_dp_on_error = B_FALSE;
+	goto out_dqrele;
 }
 
 #ifdef DEBUG
@@ -2112,209 +2130,6 @@ std_return:
 	goto std_return;
 }
 
-
-int
-xfs_mkdir(
-	xfs_inode_t             *dp,
-	struct xfs_name		*dir_name,
-	mode_t			mode,
-	xfs_inode_t		**ipp,
-	cred_t			*credp)
-{
-	xfs_mount_t		*mp = dp->i_mount;
-	xfs_inode_t		*cdp;	/* inode of created dir */
-	xfs_trans_t		*tp;
-	int			cancel_flags;
-	int			error;
-	int			committed;
-	xfs_bmap_free_t         free_list;
-	xfs_fsblock_t           first_block;
-	boolean_t		unlock_dp_on_error = B_FALSE;
-	boolean_t		created = B_FALSE;
-	int			dm_event_sent = 0;
-	xfs_prid_t		prid;
-	struct xfs_dquot	*udqp, *gdqp;
-	uint			resblks;
-
-	if (XFS_FORCED_SHUTDOWN(mp))
-		return XFS_ERROR(EIO);
-
-	tp = NULL;
-
-	if (DM_EVENT_ENABLED(dp, DM_EVENT_CREATE)) {
-		error = XFS_SEND_NAMESP(mp, DM_EVENT_CREATE,
-					dp, DM_RIGHT_NULL, NULL,
-					DM_RIGHT_NULL, dir_name->name, NULL,
-					mode, 0, 0);
-		if (error)
-			return error;
-		dm_event_sent = 1;
-	}
-
-	/* Return through std_return after this point. */
-
-	xfs_itrace_entry(dp);
-
-	mp = dp->i_mount;
-	udqp = gdqp = NULL;
-	if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)
-		prid = dp->i_d.di_projid;
-	else
-		prid = (xfs_prid_t)dfltprid;
-
-	/*
-	 * Make sure that we have allocated dquot(s) on disk.
-	 */
-	error = XFS_QM_DQVOPALLOC(mp, dp,
-			current_fsuid(), current_fsgid(), prid,
-			XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, &udqp, &gdqp);
-	if (error)
-		goto std_return;
-
-	tp = xfs_trans_alloc(mp, XFS_TRANS_MKDIR);
-	cancel_flags = XFS_TRANS_RELEASE_LOG_RES;
-	resblks = XFS_MKDIR_SPACE_RES(mp, dir_name->len);
-	error = xfs_trans_reserve(tp, resblks, XFS_MKDIR_LOG_RES(mp), 0,
-				  XFS_TRANS_PERM_LOG_RES, XFS_MKDIR_LOG_COUNT);
-	if (error == ENOSPC) {
-		resblks = 0;
-		error = xfs_trans_reserve(tp, 0, XFS_MKDIR_LOG_RES(mp), 0,
-					  XFS_TRANS_PERM_LOG_RES,
-					  XFS_MKDIR_LOG_COUNT);
-	}
-	if (error) {
-		cancel_flags = 0;
-		goto error_return;
-	}
-
-	xfs_ilock(dp, XFS_ILOCK_EXCL | XFS_ILOCK_PARENT);
-	unlock_dp_on_error = B_TRUE;
-
-	/*
-	 * Check for directory link count overflow.
-	 */
-	if (dp->i_d.di_nlink >= XFS_MAXLINK) {
-		error = XFS_ERROR(EMLINK);
-		goto error_return;
-	}
-
-	/*
-	 * Reserve disk quota and the inode.
-	 */
-	error = XFS_TRANS_RESERVE_QUOTA(mp, tp, udqp, gdqp, resblks, 1, 0);
-	if (error)
-		goto error_return;
-
-	error = xfs_dir_canenter(tp, dp, dir_name, resblks);
-	if (error)
-		goto error_return;
-	/*
-	 * create the directory inode.
-	 */
-	error = xfs_dir_ialloc(&tp, dp, mode, 2,
-			0, credp, prid, resblks > 0,
-		&cdp, NULL);
-	if (error) {
-		if (error == ENOSPC)
-			goto error_return;
-		goto abort_return;
-	}
-	xfs_itrace_ref(cdp);
-
-	/*
-	 * Now we add the directory inode to the transaction.
-	 * We waited until now since xfs_dir_ialloc might start
-	 * a new transaction.  Had we joined the transaction
-	 * earlier, the locks might have gotten released. An error
-	 * from here on will result in the transaction cancel
-	 * unlocking dp so don't do it explicitly in the error path.
-	 */
-	IHOLD(dp);
-	xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL);
-	unlock_dp_on_error = B_FALSE;
-
-	xfs_bmap_init(&free_list, &first_block);
-
-	error = xfs_dir_createname(tp, dp, dir_name, cdp->i_ino,
-					&first_block, &free_list, resblks ?
-					resblks - XFS_IALLOC_SPACE_RES(mp) : 0);
-	if (error) {
-		ASSERT(error != ENOSPC);
-		goto error1;
-	}
-	xfs_ichgtime(dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
-
-	error = xfs_dir_init(tp, cdp, dp);
-	if (error)
-		goto error2;
-
-	error = xfs_bumplink(tp, dp);
-	if (error)
-		goto error2;
-
-	created = B_TRUE;
-
-	*ipp = cdp;
-	IHOLD(cdp);
-
-	/*
-	 * Attach the dquots to the new inode and modify the icount incore.
-	 */
-	XFS_QM_DQVOPCREATE(mp, tp, cdp, udqp, gdqp);
-
-	/*
-	 * If this is a synchronous mount, make sure that the
-	 * mkdir transaction goes to disk before returning to
-	 * the user.
-	 */
-	if (mp->m_flags & (XFS_MOUNT_WSYNC|XFS_MOUNT_DIRSYNC)) {
-		xfs_trans_set_sync(tp);
-	}
-
-	error = xfs_bmap_finish(&tp, &free_list, &committed);
-	if (error) {
-		IRELE(cdp);
-		goto error2;
-	}
-
-	error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES);
-	XFS_QM_DQRELE(mp, udqp);
-	XFS_QM_DQRELE(mp, gdqp);
-	if (error) {
-		IRELE(cdp);
-	}
-
-	/* Fall through to std_return with error = 0 or errno from
-	 * xfs_trans_commit. */
-
-std_return:
-	if ((created || (error != 0 && dm_event_sent != 0)) &&
-	    DM_EVENT_ENABLED(dp, DM_EVENT_POSTCREATE)) {
-		(void) XFS_SEND_NAMESP(mp, DM_EVENT_POSTCREATE,
-					dp, DM_RIGHT_NULL,
-					created ? cdp : NULL,
-					DM_RIGHT_NULL,
-					dir_name->name, NULL,
-					mode, error, 0);
-	}
-	return error;
-
- error2:
- error1:
-	xfs_bmap_cancel(&free_list);
- abort_return:
-	cancel_flags |= XFS_TRANS_ABORT;
- error_return:
-	xfs_trans_cancel(tp, cancel_flags);
-	XFS_QM_DQRELE(mp, udqp);
-	XFS_QM_DQRELE(mp, gdqp);
-
-	if (unlock_dp_on_error)
-		xfs_iunlock(dp, XFS_ILOCK_EXCL);
-
-	goto std_return;
-}
-
 int
 xfs_symlink(
 	xfs_inode_t		*dp,
Index: xfs/fs/xfs/xfs_vnodeops.h
===================================================================
--- xfs.orig/fs/xfs/xfs_vnodeops.h	2008-12-30 09:40:04.508493447 +0100
+++ xfs/fs/xfs/xfs_vnodeops.h	2008-12-30 09:40:24.893621257 +0100
@@ -31,8 +31,6 @@ int xfs_remove(struct xfs_inode *dp, str
 		struct xfs_inode *ip);
 int xfs_link(struct xfs_inode *tdp, struct xfs_inode *sip,
 		struct xfs_name *target_name);
-int xfs_mkdir(struct xfs_inode *dp, struct xfs_name *dir_name,
-		mode_t mode, struct xfs_inode **ipp, cred_t *credp);
 int xfs_readdir(struct xfs_inode	*dp, void *dirent, size_t bufsize,
 		       xfs_off_t *offset, filldir_t filldir);
 int xfs_symlink(struct xfs_inode *dp, struct xfs_name *link_name,

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

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

* [PATCH 13/17] xfs: get rid of indirections in the quotaops implementation
  2009-01-26  7:31 [PATCH 00/17] 2.6.30 queue Christoph Hellwig
                   ` (11 preceding siblings ...)
  2009-01-26  7:31 ` [PATCH 12/17] xfs: merge xfs_mkdir into xfs_create Christoph Hellwig
@ 2009-01-26  7:31 ` Christoph Hellwig
  2009-02-09  2:41   ` Dave Chinner
  2009-05-13  8:11   ` Christoph Hellwig
  2009-01-26  7:31 ` [PATCH 14/17] xfs: remove the unused XFS_QMOPT_DQLOCK flag Christoph Hellwig
                   ` (4 subsequent siblings)
  17 siblings, 2 replies; 50+ messages in thread
From: Christoph Hellwig @ 2009-01-26  7:31 UTC (permalink / raw)
  To: xfs

[-- Attachment #1: xfs-implement-quota-ops-directly --]
[-- Type: text/plain, Size: 20665 bytes --]

Currently we call from the nicely abstracted linux quotaops into a ugly
multiplexer just to split the calls out at the same boundary again.
Rewrite the quota ops handling to remove that obfucation.


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

Index: xfs/fs/xfs/linux-2.6/xfs_super.c
===================================================================
--- xfs.orig/fs/xfs/linux-2.6/xfs_super.c	2009-01-24 18:50:29.764553115 +0100
+++ xfs/fs/xfs/linux-2.6/xfs_super.c	2009-01-24 18:52:52.180428678 +0100
@@ -68,7 +68,6 @@
 #include <linux/freezer.h>
 #include <linux/parser.h>
 
-static struct quotactl_ops xfs_quotactl_operations;
 static struct super_operations xfs_super_operations;
 static kmem_zone_t *xfs_ioend_zone;
 mempool_t *xfs_ioend_pool;
@@ -1333,57 +1332,6 @@ xfs_fs_show_options(
 	return -xfs_showargs(XFS_M(mnt->mnt_sb), m);
 }
 
-STATIC int
-xfs_fs_quotasync(
-	struct super_block	*sb,
-	int			type)
-{
-	return -XFS_QM_QUOTACTL(XFS_M(sb), Q_XQUOTASYNC, 0, NULL);
-}
-
-STATIC int
-xfs_fs_getxstate(
-	struct super_block	*sb,
-	struct fs_quota_stat	*fqs)
-{
-	return -XFS_QM_QUOTACTL(XFS_M(sb), Q_XGETQSTAT, 0, (caddr_t)fqs);
-}
-
-STATIC int
-xfs_fs_setxstate(
-	struct super_block	*sb,
-	unsigned int		flags,
-	int			op)
-{
-	return -XFS_QM_QUOTACTL(XFS_M(sb), op, 0, (caddr_t)&flags);
-}
-
-STATIC int
-xfs_fs_getxquota(
-	struct super_block	*sb,
-	int			type,
-	qid_t			id,
-	struct fs_disk_quota	*fdq)
-{
-	return -XFS_QM_QUOTACTL(XFS_M(sb),
-				 (type == USRQUOTA) ? Q_XGETQUOTA :
-				  ((type == GRPQUOTA) ? Q_XGETGQUOTA :
-				   Q_XGETPQUOTA), id, (caddr_t)fdq);
-}
-
-STATIC int
-xfs_fs_setxquota(
-	struct super_block	*sb,
-	int			type,
-	qid_t			id,
-	struct fs_disk_quota	*fdq)
-{
-	return -XFS_QM_QUOTACTL(XFS_M(sb),
-				 (type == USRQUOTA) ? Q_XSETQLIM :
-				  ((type == GRPQUOTA) ? Q_XSETGQLIM :
-				   Q_XSETPQLIM), id, (caddr_t)fdq);
-}
-
 /*
  * This function fills in xfs_mount_t fields based on mount args.
  * Note: the superblock _has_ now been read in.
@@ -1466,7 +1414,9 @@ xfs_fs_fill_super(
 	sb_min_blocksize(sb, BBSIZE);
 	sb->s_xattr = xfs_xattr_handlers;
 	sb->s_export_op = &xfs_export_operations;
+#ifdef CONFIG_XFS_QUOTA
 	sb->s_qcop = &xfs_quotactl_operations;
+#endif
 	sb->s_op = &xfs_super_operations;
 
 	error = xfs_dmops_get(mp);
@@ -1609,14 +1559,6 @@ static struct super_operations xfs_super
 	.show_options		= xfs_fs_show_options,
 };
 
-static struct quotactl_ops xfs_quotactl_operations = {
-	.quota_sync		= xfs_fs_quotasync,
-	.get_xstate		= xfs_fs_getxstate,
-	.set_xstate		= xfs_fs_setxstate,
-	.get_xquota		= xfs_fs_getxquota,
-	.set_xquota		= xfs_fs_setxquota,
-};
-
 static struct file_system_type xfs_fs_type = {
 	.owner			= THIS_MODULE,
 	.name			= "xfs",
Index: xfs/fs/xfs/Makefile
===================================================================
--- xfs.orig/fs/xfs/Makefile	2009-01-21 21:03:27.824295159 +0100
+++ xfs/fs/xfs/Makefile	2009-01-24 18:52:52.184428210 +0100
@@ -33,6 +33,7 @@ xfs-$(CONFIG_XFS_QUOTA)		+= $(addprefix 
 				   xfs_qm_syscalls.o \
 				   xfs_qm_bhv.o \
 				   xfs_qm.o)
+xfs-$(CONFIG_XFS_QUOTA)		+= linux-2.6/xfs_quotaops.o
 
 ifeq ($(CONFIG_XFS_QUOTA),y)
 xfs-$(CONFIG_PROC_FS)		+= quota/xfs_qm_stats.o
Index: xfs/fs/xfs/linux-2.6/xfs_linux.h
===================================================================
--- xfs.orig/fs/xfs/linux-2.6/xfs_linux.h	2009-01-21 21:03:27.828295110 +0100
+++ xfs/fs/xfs/linux-2.6/xfs_linux.h	2009-01-24 18:52:52.191428473 +0100
@@ -147,17 +147,6 @@
 #define SYNCHRONIZE()	barrier()
 #define __return_address __builtin_return_address(0)
 
-/*
- * IRIX (BSD) quotactl makes use of separate commands for user/group,
- * whereas on Linux the syscall encodes this information into the cmd
- * field (see the QCMD macro in quota.h).  These macros help keep the
- * code portable - they are not visible from the syscall interface.
- */
-#define Q_XSETGQLIM	XQM_CMD(8)	/* set groups disk limits */
-#define Q_XGETGQUOTA	XQM_CMD(9)	/* get groups disk limits */
-#define Q_XSETPQLIM	XQM_CMD(10)	/* set projects disk limits */
-#define Q_XGETPQUOTA	XQM_CMD(11)	/* get projects disk limits */
-
 #define dfltprid	0
 #define MAXPATHLEN	1024
 
Index: xfs/fs/xfs/linux-2.6/xfs_quotaops.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ xfs/fs/xfs/linux-2.6/xfs_quotaops.c	2009-01-24 18:52:52.192428740 +0100
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 2008, Christoph Hellwig
+ * All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation,
+ * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#include "xfs.h"
+#include "xfs_dmapi.h"
+#include "xfs_sb.h"
+#include "xfs_inum.h"
+#include "xfs_ag.h"
+#include "xfs_mount.h"
+#include "xfs_quota.h"
+#include "xfs_log.h"
+#include "xfs_trans.h"
+#include "xfs_bmap_btree.h"
+#include "xfs_inode.h"
+#include "quota/xfs_qm.h"
+#include <linux/quota.h>
+
+
+STATIC int
+xfs_quota_type(int type)
+{
+	switch (type) {
+	case USRQUOTA:
+		return XFS_DQ_USER;
+	case GRPQUOTA:
+		return XFS_DQ_GROUP;
+	default:
+		return XFS_DQ_PROJ;
+	}
+}
+
+STATIC int
+xfs_fs_quota_sync(
+	struct super_block	*sb,
+	int			type)
+{
+	struct xfs_mount	*mp = XFS_M(sb);
+
+	if (!XFS_IS_QUOTA_RUNNING(mp))
+		return -ENOSYS;
+	return -xfs_sync_inodes(mp, SYNC_DELWRI);
+}
+
+STATIC int
+xfs_fs_get_xstate(
+	struct super_block	*sb,
+	struct fs_quota_stat	*fqs)
+{
+	struct xfs_mount	*mp = XFS_M(sb);
+
+	if (!XFS_IS_QUOTA_RUNNING(mp))
+		return -ENOSYS;
+	return xfs_qm_scall_getqstat(mp, fqs);
+}
+
+STATIC int
+xfs_fs_set_xstate(
+	struct super_block	*sb,
+	unsigned int		uflags,
+	int			op)
+{
+	struct xfs_mount	*mp = XFS_M(sb);
+	unsigned int		flags = 0;
+
+	if (sb->s_flags & MS_RDONLY)
+		return -EROFS;
+	if (!XFS_IS_QUOTA_RUNNING(mp))
+		return -ENOSYS;
+	if (!capable(CAP_SYS_ADMIN))
+		return -EPERM;
+
+	if (uflags & XFS_QUOTA_UDQ_ACCT)
+		flags |= XFS_UQUOTA_ACCT;
+	if (uflags & XFS_QUOTA_PDQ_ACCT)
+		flags |= XFS_PQUOTA_ACCT;
+	if (uflags & XFS_QUOTA_GDQ_ACCT)
+		flags |= XFS_GQUOTA_ACCT;
+	if (uflags & XFS_QUOTA_UDQ_ENFD)
+		flags |= XFS_UQUOTA_ENFD;
+	if (uflags & (XFS_QUOTA_PDQ_ENFD|XFS_QUOTA_GDQ_ENFD))
+		flags |= XFS_OQUOTA_ENFD;
+
+	switch (op) {
+	case Q_XQUOTAON:
+		return -xfs_qm_scall_quotaon(mp, flags);
+	case Q_XQUOTAOFF:
+		if (!XFS_IS_QUOTA_ON(mp))
+			return -EINVAL;
+		return -xfs_qm_scall_quotaoff(mp, flags);
+	case Q_XQUOTARM:
+		if (XFS_IS_QUOTA_ON(mp))
+			return -EINVAL;
+		return -xfs_qm_scall_trunc_qfiles(mp, flags);
+	}
+
+	return -EINVAL;
+}
+
+STATIC int
+xfs_fs_get_xquota(
+	struct super_block	*sb,
+	int			type,
+	qid_t			id,
+	struct fs_disk_quota	*fdq)
+{
+	struct xfs_mount	*mp = XFS_M(sb);
+
+	if (!XFS_IS_QUOTA_RUNNING(mp))
+		return -ENOSYS;
+	if (!XFS_IS_QUOTA_ON(mp))
+		return -ESRCH;
+
+	return -xfs_qm_scall_getquota(mp, id, xfs_quota_type(type), fdq);
+}
+
+STATIC int
+xfs_fs_set_xquota(
+	struct super_block	*sb,
+	int			type,
+	qid_t			id,
+	struct fs_disk_quota	*fdq)
+{
+	struct xfs_mount	*mp = XFS_M(sb);
+
+	if (sb->s_flags & MS_RDONLY)
+		return -EROFS;
+	if (!XFS_IS_QUOTA_RUNNING(mp))
+		return -ENOSYS;
+	if (!XFS_IS_QUOTA_ON(mp))
+		return -ESRCH;
+	if (!capable(CAP_SYS_ADMIN))
+		return -EPERM;
+
+	return xfs_qm_scall_setqlim(mp, id, xfs_quota_type(type), fdq);
+}
+
+struct quotactl_ops xfs_quotactl_operations = {
+	.quota_sync		= xfs_fs_quota_sync,
+	.get_xstate		= xfs_fs_get_xstate,
+	.set_xstate		= xfs_fs_set_xstate,
+	.get_xquota		= xfs_fs_get_xquota,
+	.set_xquota		= xfs_fs_set_xquota,
+};
Index: xfs/fs/xfs/linux-2.6/xfs_super.h
===================================================================
--- xfs.orig/fs/xfs/linux-2.6/xfs_super.h	2009-01-21 21:03:27.831294794 +0100
+++ xfs/fs/xfs/linux-2.6/xfs_super.h	2009-01-24 18:52:52.192428740 +0100
@@ -93,6 +93,7 @@ extern void xfs_blkdev_issue_flush(struc
 
 extern const struct export_operations xfs_export_operations;
 extern struct xattr_handler *xfs_xattr_handlers[];
+extern struct quotactl_ops xfs_quotactl_operations;
 
 #define XFS_M(sb)		((struct xfs_mount *)((sb)->s_fs_info))
 
Index: xfs/fs/xfs/linux-2.6/xfs_sync.h
===================================================================
--- xfs.orig/fs/xfs/linux-2.6/xfs_sync.h	2009-01-24 17:58:49.029903800 +0100
+++ xfs/fs/xfs/linux-2.6/xfs_sync.h	2009-01-24 18:52:52.203535043 +0100
@@ -19,6 +19,7 @@
 #define XFS_SYNC_H 1
 
 struct xfs_mount;
+struct xfs_perag;
 
 typedef struct bhv_vfs_sync_work {
 	struct list_head	w_list;
Index: xfs/fs/xfs/quota/xfs_qm.h
===================================================================
--- xfs.orig/fs/xfs/quota/xfs_qm.h	2009-01-21 21:03:27.835294745 +0100
+++ xfs/fs/xfs/quota/xfs_qm.h	2009-01-24 18:52:52.206583965 +0100
@@ -178,6 +178,16 @@ extern void		xfs_qm_dqdetach(xfs_inode_t
 extern int		xfs_qm_dqpurge_all(xfs_mount_t *, uint);
 extern void		xfs_qm_dqrele_all_inodes(xfs_mount_t *, uint);
 
+/* quota ops */
+extern int		xfs_qm_scall_trunc_qfiles(xfs_mount_t *, uint);
+extern int		xfs_qm_scall_getquota(xfs_mount_t *, xfs_dqid_t, uint,
+					fs_disk_quota_t *);
+extern int		xfs_qm_scall_setqlim(xfs_mount_t *, xfs_dqid_t, uint,
+					fs_disk_quota_t *);
+extern int		xfs_qm_scall_getqstat(xfs_mount_t *, fs_quota_stat_t *);
+extern int		xfs_qm_scall_quotaon(xfs_mount_t *, uint);
+extern int		xfs_qm_scall_quotaoff(xfs_mount_t *, uint);
+
 /* vop stuff */
 extern int		xfs_qm_vop_dqalloc(xfs_mount_t *, xfs_inode_t *,
 					uid_t, gid_t, prid_t, uint,
@@ -196,10 +206,6 @@ extern void		xfs_qm_freelist_append(xfs_
 extern void		xfs_qm_freelist_unlink(xfs_dquot_t *);
 extern int		xfs_qm_freelist_lock_nowait(xfs_qm_t *);
 
-/* system call interface */
-extern int		xfs_qm_quotactl(struct xfs_mount *, int, int,
-				xfs_caddr_t);
-
 #ifdef DEBUG
 extern int		xfs_qm_internalqcheck(xfs_mount_t *);
 #else
Index: xfs/fs/xfs/quota/xfs_qm_bhv.c
===================================================================
--- xfs.orig/fs/xfs/quota/xfs_qm_bhv.c	2009-01-21 21:03:27.836295012 +0100
+++ xfs/fs/xfs/quota/xfs_qm_bhv.c	2009-01-24 18:52:52.206583965 +0100
@@ -235,7 +235,6 @@ struct xfs_qmops xfs_qmcore_xfs = {
 	.xfs_dqvopchownresv	= xfs_qm_vop_chown_reserve,
 	.xfs_dqstatvfs		= xfs_qm_statvfs,
 	.xfs_dqsync		= xfs_qm_sync,
-	.xfs_quotactl		= xfs_qm_quotactl,
 	.xfs_dqtrxops		= &xfs_trans_dquot_ops,
 };
 EXPORT_SYMBOL(xfs_qmcore_xfs);
Index: xfs/fs/xfs/quota/xfs_qm_syscalls.c
===================================================================
--- xfs.orig/fs/xfs/quota/xfs_qm_syscalls.c	2009-01-21 21:03:27.836295012 +0100
+++ xfs/fs/xfs/quota/xfs_qm_syscalls.c	2009-01-24 18:52:52.207553991 +0100
@@ -57,135 +57,16 @@
 # define qdprintk(s, args...)	do { } while (0)
 #endif
 
-STATIC int	xfs_qm_scall_trunc_qfiles(xfs_mount_t *, uint);
-STATIC int	xfs_qm_scall_getquota(xfs_mount_t *, xfs_dqid_t, uint,
-					fs_disk_quota_t *);
-STATIC int	xfs_qm_scall_getqstat(xfs_mount_t *, fs_quota_stat_t *);
-STATIC int	xfs_qm_scall_setqlim(xfs_mount_t *, xfs_dqid_t, uint,
-					fs_disk_quota_t *);
-STATIC int	xfs_qm_scall_quotaon(xfs_mount_t *, uint);
-STATIC int	xfs_qm_scall_quotaoff(xfs_mount_t *, uint, boolean_t);
 STATIC int	xfs_qm_log_quotaoff(xfs_mount_t *, xfs_qoff_logitem_t **, uint);
 STATIC int	xfs_qm_log_quotaoff_end(xfs_mount_t *, xfs_qoff_logitem_t *,
 					uint);
-STATIC uint	xfs_qm_import_flags(uint);
 STATIC uint	xfs_qm_export_flags(uint);
-STATIC uint	xfs_qm_import_qtype_flags(uint);
 STATIC uint	xfs_qm_export_qtype_flags(uint);
 STATIC void	xfs_qm_export_dquot(xfs_mount_t *, xfs_disk_dquot_t *,
 					fs_disk_quota_t *);
 
 
 /*
- * The main distribution switch of all XFS quotactl system calls.
- */
-int
-xfs_qm_quotactl(
-	xfs_mount_t	*mp,
-	int		cmd,
-	int		id,
-	xfs_caddr_t	addr)
-{
-	int		error;
-
-	ASSERT(addr != NULL || cmd == Q_XQUOTASYNC);
-
-	/*
-	 * The following commands are valid even when quotaoff.
-	 */
-	switch (cmd) {
-	case Q_XQUOTARM:
-		/*
-		 * Truncate quota files. quota must be off.
-		 */
-		if (XFS_IS_QUOTA_ON(mp))
-			return XFS_ERROR(EINVAL);
-		if (mp->m_flags & XFS_MOUNT_RDONLY)
-			return XFS_ERROR(EROFS);
-		return (xfs_qm_scall_trunc_qfiles(mp,
-			       xfs_qm_import_qtype_flags(*(uint *)addr)));
-
-	case Q_XGETQSTAT:
-		/*
-		 * Get quota status information.
-		 */
-		return (xfs_qm_scall_getqstat(mp, (fs_quota_stat_t *)addr));
-
-	case Q_XQUOTAON:
-		/*
-		 * QUOTAON - enabling quota enforcement.
-		 * Quota accounting must be turned on at mount time.
-		 */
-		if (mp->m_flags & XFS_MOUNT_RDONLY)
-			return XFS_ERROR(EROFS);
-		return (xfs_qm_scall_quotaon(mp,
-					  xfs_qm_import_flags(*(uint *)addr)));
-
-	case Q_XQUOTAOFF:
-		if (mp->m_flags & XFS_MOUNT_RDONLY)
-			return XFS_ERROR(EROFS);
-		break;
-
-	case Q_XQUOTASYNC:
-		return xfs_sync_inodes(mp, SYNC_DELWRI);
-
-	default:
-		break;
-	}
-
-	if (! XFS_IS_QUOTA_ON(mp))
-		return XFS_ERROR(ESRCH);
-
-	switch (cmd) {
-	case Q_XQUOTAOFF:
-		if (mp->m_flags & XFS_MOUNT_RDONLY)
-			return XFS_ERROR(EROFS);
-		error = xfs_qm_scall_quotaoff(mp,
-					    xfs_qm_import_flags(*(uint *)addr),
-					    B_FALSE);
-		break;
-
-	case Q_XGETQUOTA:
-		error = xfs_qm_scall_getquota(mp, (xfs_dqid_t)id, XFS_DQ_USER,
-					(fs_disk_quota_t *)addr);
-		break;
-	case Q_XGETGQUOTA:
-		error = xfs_qm_scall_getquota(mp, (xfs_dqid_t)id, XFS_DQ_GROUP,
-					(fs_disk_quota_t *)addr);
-		break;
-	case Q_XGETPQUOTA:
-		error = xfs_qm_scall_getquota(mp, (xfs_dqid_t)id, XFS_DQ_PROJ,
-					(fs_disk_quota_t *)addr);
-		break;
-
-	case Q_XSETQLIM:
-		if (mp->m_flags & XFS_MOUNT_RDONLY)
-			return XFS_ERROR(EROFS);
-		error = xfs_qm_scall_setqlim(mp, (xfs_dqid_t)id, XFS_DQ_USER,
-					     (fs_disk_quota_t *)addr);
-		break;
-	case Q_XSETGQLIM:
-		if (mp->m_flags & XFS_MOUNT_RDONLY)
-			return XFS_ERROR(EROFS);
-		error = xfs_qm_scall_setqlim(mp, (xfs_dqid_t)id, XFS_DQ_GROUP,
-					     (fs_disk_quota_t *)addr);
-		break;
-	case Q_XSETPQLIM:
-		if (mp->m_flags & XFS_MOUNT_RDONLY)
-			return XFS_ERROR(EROFS);
-		error = xfs_qm_scall_setqlim(mp, (xfs_dqid_t)id, XFS_DQ_PROJ,
-					     (fs_disk_quota_t *)addr);
-		break;
-
-	default:
-		error = XFS_ERROR(EINVAL);
-		break;
-	}
-
-	return (error);
-}
-
-/*
  * Turn off quota accounting and/or enforcement for all udquots and/or
  * gdquots. Called only at unmount time.
  *
@@ -193,11 +74,10 @@ xfs_qm_quotactl(
  * incore, and modifies the ondisk dquot directly. Therefore, for example,
  * it is an error to call this twice, without purging the cache.
  */
-STATIC int
+int
 xfs_qm_scall_quotaoff(
 	xfs_mount_t		*mp,
-	uint			flags,
-	boolean_t		force)
+	uint			flags)
 {
 	uint			dqtype;
 	int			error;
@@ -205,8 +85,6 @@ xfs_qm_scall_quotaoff(
 	xfs_qoff_logitem_t	*qoffstart;
 	int			nculprits;
 
-	if (!force && !capable(CAP_SYS_ADMIN))
-		return XFS_ERROR(EPERM);
 	/*
 	 * No file system can have quotas enabled on disk but not in core.
 	 * Note that quota utilities (like quotaoff) _expect_
@@ -375,7 +253,7 @@ out_error:
 	return (error);
 }
 
-STATIC int
+int
 xfs_qm_scall_trunc_qfiles(
 	xfs_mount_t	*mp,
 	uint		flags)
@@ -383,8 +261,6 @@ xfs_qm_scall_trunc_qfiles(
 	int		error = 0, error2 = 0;
 	xfs_inode_t	*qip;
 
-	if (!capable(CAP_SYS_ADMIN))
-		return XFS_ERROR(EPERM);
 	if (!xfs_sb_version_hasquota(&mp->m_sb) || flags == 0) {
 		qdprintk("qtrunc flags=%x m_qflags=%x\n", flags, mp->m_qflags);
 		return XFS_ERROR(EINVAL);
@@ -416,7 +292,7 @@ xfs_qm_scall_trunc_qfiles(
  * effect immediately.
  * (Switching on quota accounting must be done at mount time.)
  */
-STATIC int
+int
 xfs_qm_scall_quotaon(
 	xfs_mount_t	*mp,
 	uint		flags)
@@ -426,9 +302,6 @@ xfs_qm_scall_quotaon(
 	uint		accflags;
 	__int64_t	sbflags;
 
-	if (!capable(CAP_SYS_ADMIN))
-		return XFS_ERROR(EPERM);
-
 	flags &= (XFS_ALL_QUOTA_ACCT | XFS_ALL_QUOTA_ENFD);
 	/*
 	 * Switching on quota accounting must be done at mount time.
@@ -517,7 +390,7 @@ xfs_qm_scall_quotaon(
 /*
  * Return quota status information, such as uquota-off, enforcements, etc.
  */
-STATIC int
+int
 xfs_qm_scall_getqstat(
 	xfs_mount_t	*mp,
 	fs_quota_stat_t *out)
@@ -582,7 +455,7 @@ xfs_qm_scall_getqstat(
 /*
  * Adjust quota limits, and start/stop timers accordingly.
  */
-STATIC int
+int
 xfs_qm_scall_setqlim(
 	xfs_mount_t		*mp,
 	xfs_dqid_t		id,
@@ -595,9 +468,6 @@ xfs_qm_scall_setqlim(
 	int			error;
 	xfs_qcnt_t		hard, soft;
 
-	if (!capable(CAP_SYS_ADMIN))
-		return XFS_ERROR(EPERM);
-
 	if ((newlim->d_fieldmask &
 	    (FS_DQ_LIMIT_MASK|FS_DQ_TIMER_MASK|FS_DQ_WARNS_MASK)) == 0)
 		return (0);
@@ -742,7 +612,7 @@ xfs_qm_scall_setqlim(
 	return error;
 }
 
-STATIC int
+int
 xfs_qm_scall_getquota(
 	xfs_mount_t	*mp,
 	xfs_dqid_t	id,
@@ -935,30 +805,6 @@ xfs_qm_export_dquot(
 }
 
 STATIC uint
-xfs_qm_import_qtype_flags(
-	uint		uflags)
-{
-	uint		oflags = 0;
-
-	/*
-	 * Can't be more than one, or none.
-	 */
-	if (((uflags & (XFS_GROUP_QUOTA | XFS_USER_QUOTA)) ==
-			(XFS_GROUP_QUOTA | XFS_USER_QUOTA)) ||
-	    ((uflags & (XFS_GROUP_QUOTA | XFS_PROJ_QUOTA)) ==
-			(XFS_GROUP_QUOTA | XFS_PROJ_QUOTA)) ||
-	    ((uflags & (XFS_USER_QUOTA | XFS_PROJ_QUOTA)) ==
-			(XFS_USER_QUOTA | XFS_PROJ_QUOTA)) ||
-	    ((uflags & (XFS_GROUP_QUOTA|XFS_USER_QUOTA|XFS_PROJ_QUOTA)) == 0))
-		return (0);
-
-	oflags |= (uflags & XFS_USER_QUOTA) ? XFS_DQ_USER : 0;
-	oflags |= (uflags & XFS_PROJ_QUOTA) ? XFS_DQ_PROJ : 0;
-	oflags |= (uflags & XFS_GROUP_QUOTA) ? XFS_DQ_GROUP: 0;
-	return oflags;
-}
-
-STATIC uint
 xfs_qm_export_qtype_flags(
 	uint flags)
 {
@@ -979,26 +825,6 @@ xfs_qm_export_qtype_flags(
 }
 
 STATIC uint
-xfs_qm_import_flags(
-	uint uflags)
-{
-	uint flags = 0;
-
-	if (uflags & XFS_QUOTA_UDQ_ACCT)
-		flags |= XFS_UQUOTA_ACCT;
-	if (uflags & XFS_QUOTA_PDQ_ACCT)
-		flags |= XFS_PQUOTA_ACCT;
-	if (uflags & XFS_QUOTA_GDQ_ACCT)
-		flags |= XFS_GQUOTA_ACCT;
-	if (uflags & XFS_QUOTA_UDQ_ENFD)
-		flags |= XFS_UQUOTA_ENFD;
-	if (uflags & (XFS_QUOTA_PDQ_ENFD|XFS_QUOTA_GDQ_ENFD))
-		flags |= XFS_OQUOTA_ENFD;
-	return (flags);
-}
-
-
-STATIC uint
 xfs_qm_export_flags(
 	uint flags)
 {
Index: xfs/fs/xfs/xfs_mount.h
===================================================================
--- xfs.orig/fs/xfs/xfs_mount.h	2009-01-24 18:32:57.980458591 +0100
+++ xfs/fs/xfs/xfs_mount.h	2009-01-24 18:52:52.208554118 +0100
@@ -136,7 +136,6 @@ typedef int	(*xfs_dqvopchownresv_t)(stru
 			struct xfs_dquot *, struct xfs_dquot *, uint);
 typedef void	(*xfs_dqstatvfs_t)(struct xfs_inode *, struct kstatfs *);
 typedef int	(*xfs_dqsync_t)(struct xfs_mount *, int flags);
-typedef int	(*xfs_quotactl_t)(struct xfs_mount *, int, int, xfs_caddr_t);
 
 typedef struct xfs_qmops {
 	xfs_qminit_t		xfs_qminit;
@@ -154,7 +153,6 @@ typedef struct xfs_qmops {
 	xfs_dqvopchownresv_t	xfs_dqvopchownresv;
 	xfs_dqstatvfs_t		xfs_dqstatvfs;
 	xfs_dqsync_t		xfs_dqsync;
-	xfs_quotactl_t		xfs_quotactl;
 	struct xfs_dqtrxops	*xfs_dqtrxops;
 } xfs_qmops_t;
 
@@ -188,8 +186,6 @@ typedef struct xfs_qmops {
 	(*(ip)->i_mount->m_qm_ops->xfs_dqstatvfs)(ip, statp)
 #define XFS_QM_DQSYNC(mp, flags) \
 	(*(mp)->m_qm_ops->xfs_dqsync)(mp, flags)
-#define XFS_QM_QUOTACTL(mp, cmd, id, addr) \
-	(*(mp)->m_qm_ops->xfs_quotactl)(mp, cmd, id, addr)
 
 #ifdef HAVE_PERCPU_SB
 
Index: xfs/fs/xfs/xfs_qmops.c
===================================================================
--- xfs.orig/fs/xfs/xfs_qmops.c	2009-01-21 21:03:27.866294994 +0100
+++ xfs/fs/xfs/xfs_qmops.c	2009-01-24 18:52:52.208554118 +0100
@@ -126,7 +126,6 @@ static struct xfs_qmops xfs_qmcore_stub 
 	.xfs_dqvopchownresv	= (xfs_dqvopchownresv_t) fs_noerr,
 	.xfs_dqstatvfs		= (xfs_dqstatvfs_t) fs_noval,
 	.xfs_dqsync		= (xfs_dqsync_t) fs_noerr,
-	.xfs_quotactl		= (xfs_quotactl_t) fs_nosys,
 };
 
 int
Index: xfs/fs/xfs/xfs_quota.h
===================================================================
--- xfs.orig/fs/xfs/xfs_quota.h	2009-01-21 21:03:27.866294994 +0100
+++ xfs/fs/xfs/xfs_quota.h	2009-01-24 18:52:52.211583834 +0100
@@ -18,6 +18,8 @@
 #ifndef __XFS_QUOTA_H__
 #define __XFS_QUOTA_H__
 
+struct xfs_trans;
+
 /*
  * The ondisk form of a dquot structure.
  */

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

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

* [PATCH 14/17] xfs: remove the unused XFS_QMOPT_DQLOCK flag
  2009-01-26  7:31 [PATCH 00/17] 2.6.30 queue Christoph Hellwig
                   ` (12 preceding siblings ...)
  2009-01-26  7:31 ` [PATCH 13/17] xfs: get rid of indirections in the quotaops implementation Christoph Hellwig
@ 2009-01-26  7:31 ` Christoph Hellwig
  2009-02-08  0:35   ` Felix Blyakher
  2009-01-26  7:31 ` [PATCH 15/17] xfs: remove XFS_QM_LOCK/XFS_QM_UNLOCK/XFS_QM_HOLD/XFS_QM_RELE Christoph Hellwig
                   ` (3 subsequent siblings)
  17 siblings, 1 reply; 50+ messages in thread
From: Christoph Hellwig @ 2009-01-26  7:31 UTC (permalink / raw)
  To: xfs

[-- Attachment #1: xfs-kill-XFS_QMOPT_DQLOCK --]
[-- Type: text/plain, Size: 9470 bytes --]

The XFS_QMOPT_DQLOCK flag introduces major complexity in the quota subsystem
but isn't actually used anywhere.  So remove it and all the hazzles it
introduces.


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

Index: xfs/fs/xfs/quota/xfs_qm.c
===================================================================
--- xfs.orig/fs/xfs/quota/xfs_qm.c	2009-01-21 21:03:27.835294745 +0100
+++ xfs/fs/xfs/quota/xfs_qm.c	2009-01-24 18:56:04.215429212 +0100
@@ -632,7 +632,6 @@ xfs_qm_dqattach_one(
 	xfs_dqid_t	id,
 	uint		type,
 	uint		doalloc,
-	uint		dolock,
 	xfs_dquot_t	*udqhint, /* hint */
 	xfs_dquot_t	**IO_idqpp)
 {
@@ -641,16 +640,16 @@ xfs_qm_dqattach_one(
 
 	ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
 	error = 0;
+
 	/*
 	 * See if we already have it in the inode itself. IO_idqpp is
 	 * &i_udquot or &i_gdquot. This made the code look weird, but
 	 * made the logic a lot simpler.
 	 */
-	if ((dqp = *IO_idqpp)) {
-		if (dolock)
-			xfs_dqlock(dqp);
+	dqp = *IO_idqpp;
+	if (dqp) {
 		xfs_dqtrace_entry(dqp, "DQATTACH: found in ip");
-		goto done;
+		return 0;
 	}
 
 	/*
@@ -659,38 +658,38 @@ xfs_qm_dqattach_one(
 	 * lookup by dqid (xfs_qm_dqget) by caching a group dquot inside
 	 * the user dquot.
 	 */
-	ASSERT(!udqhint || type == XFS_DQ_GROUP || type == XFS_DQ_PROJ);
-	if (udqhint && !dolock)
+	if (udqhint) {
+		ASSERT(type == XFS_DQ_GROUP || type == XFS_DQ_PROJ);
 		xfs_dqlock(udqhint);
 
-	/*
-	 * No need to take dqlock to look at the id.
-	 * The ID can't change until it gets reclaimed, and it won't
-	 * be reclaimed as long as we have a ref from inode and we hold
-	 * the ilock.
-	 */
-	if (udqhint &&
-	    (dqp = udqhint->q_gdquot) &&
-	    (be32_to_cpu(dqp->q_core.d_id) == id)) {
-		ASSERT(XFS_DQ_IS_LOCKED(udqhint));
-		xfs_dqlock(dqp);
-		XFS_DQHOLD(dqp);
-		ASSERT(*IO_idqpp == NULL);
-		*IO_idqpp = dqp;
-		if (!dolock) {
+		/*
+		 * No need to take dqlock to look at the id.
+		 *
+		 * The ID can't change until it gets reclaimed, and it won't
+		 * be reclaimed as long as we have a ref from inode and we
+		 * hold the ilock.
+		 */
+		dqp = udqhint->q_gdquot;
+		if (dqp && be32_to_cpu(dqp->q_core.d_id) == id) {
+			xfs_dqlock(dqp);
+			XFS_DQHOLD(dqp);
+			ASSERT(*IO_idqpp == NULL);
+			*IO_idqpp = dqp;
+
 			xfs_dqunlock(dqp);
 			xfs_dqunlock(udqhint);
+			return 0;
 		}
-		goto done;
-	}
-	/*
-	 * We can't hold a dquot lock when we call the dqget code.
-	 * We'll deadlock in no time, because of (not conforming to)
-	 * lock ordering - the inodelock comes before any dquot lock,
-	 * and we may drop and reacquire the ilock in xfs_qm_dqget().
-	 */
-	if (udqhint)
+
+		/*
+		 * We can't hold a dquot lock when we call the dqget code.
+		 * We'll deadlock in no time, because of (not conforming to)
+		 * lock ordering - the inodelock comes before any dquot lock,
+		 * and we may drop and reacquire the ilock in xfs_qm_dqget().
+		 */
 		xfs_dqunlock(udqhint);
+	}
+
 	/*
 	 * Find the dquot from somewhere. This bumps the
 	 * reference count of dquot and returns it locked.
@@ -698,48 +697,19 @@ xfs_qm_dqattach_one(
 	 * disk and we didn't ask it to allocate;
 	 * ESRCH if quotas got turned off suddenly.
 	 */
-	if ((error = xfs_qm_dqget(ip->i_mount, ip, id, type,
-				 doalloc|XFS_QMOPT_DOWARN, &dqp))) {
-		if (udqhint && dolock)
-			xfs_dqlock(udqhint);
-		goto done;
-	}
+	error = xfs_qm_dqget(ip->i_mount, ip, id, type, XFS_QMOPT_DOWARN, &dqp);
+	if (error)
+		return error;
 
 	xfs_dqtrace_entry(dqp, "DQATTACH: found by dqget");
+
 	/*
 	 * dqget may have dropped and re-acquired the ilock, but it guarantees
 	 * that the dquot returned is the one that should go in the inode.
 	 */
 	*IO_idqpp = dqp;
-	ASSERT(dqp);
-	ASSERT(XFS_DQ_IS_LOCKED(dqp));
-	if (! dolock) {
-		xfs_dqunlock(dqp);
-		goto done;
-	}
-	if (! udqhint)
-		goto done;
-
-	ASSERT(udqhint);
-	ASSERT(dolock);
-	ASSERT(XFS_DQ_IS_LOCKED(dqp));
-	if (! xfs_qm_dqlock_nowait(udqhint)) {
-		xfs_dqunlock(dqp);
-		xfs_dqlock(udqhint);
-		xfs_dqlock(dqp);
-	}
-      done:
-#ifdef QUOTADEBUG
-	if (udqhint) {
-		if (dolock)
-			ASSERT(XFS_DQ_IS_LOCKED(udqhint));
-	}
-	if (! error) {
-		if (dolock)
-			ASSERT(XFS_DQ_IS_LOCKED(dqp));
-	}
-#endif
-	return error;
+	xfs_dqunlock(dqp);
+	return 0;
 }
 
 
@@ -754,24 +724,15 @@ xfs_qm_dqattach_one(
 STATIC void
 xfs_qm_dqattach_grouphint(
 	xfs_dquot_t	*udq,
-	xfs_dquot_t	*gdq,
-	uint		locked)
+	xfs_dquot_t	*gdq)
 {
 	xfs_dquot_t	*tmp;
 
-#ifdef QUOTADEBUG
-	if (locked) {
-		ASSERT(XFS_DQ_IS_LOCKED(udq));
-		ASSERT(XFS_DQ_IS_LOCKED(gdq));
-	}
-#endif
-	if (! locked)
-		xfs_dqlock(udq);
+	xfs_dqlock(udq);
 
 	if ((tmp = udq->q_gdquot)) {
 		if (tmp == gdq) {
-			if (! locked)
-				xfs_dqunlock(udq);
+			xfs_dqunlock(udq);
 			return;
 		}
 
@@ -781,8 +742,6 @@ xfs_qm_dqattach_grouphint(
 		 * because the freelist lock comes before dqlocks.
 		 */
 		xfs_dqunlock(udq);
-		if (locked)
-			xfs_dqunlock(gdq);
 		/*
 		 * we took a hard reference once upon a time in dqget,
 		 * so give it back when the udquot no longer points at it
@@ -795,9 +754,7 @@ xfs_qm_dqattach_grouphint(
 
 	} else {
 		ASSERT(XFS_DQ_IS_LOCKED(udq));
-		if (! locked) {
-			xfs_dqlock(gdq);
-		}
+		xfs_dqlock(gdq);
 	}
 
 	ASSERT(XFS_DQ_IS_LOCKED(udq));
@@ -810,10 +767,9 @@ xfs_qm_dqattach_grouphint(
 		XFS_DQHOLD(gdq);
 		udq->q_gdquot = gdq;
 	}
-	if (! locked) {
-		xfs_dqunlock(gdq);
-		xfs_dqunlock(udq);
-	}
+
+	xfs_dqunlock(gdq);
+	xfs_dqunlock(udq);
 }
 
 
@@ -821,8 +777,6 @@ xfs_qm_dqattach_grouphint(
  * Given a locked inode, attach dquot(s) to it, taking U/G/P-QUOTAON
  * into account.
  * If XFS_QMOPT_DQALLOC, the dquot(s) will be allocated if needed.
- * If XFS_QMOPT_DQLOCK, the dquot(s) will be returned locked. This option pretty
- * much made this code a complete mess, but it has been pretty useful.
  * If XFS_QMOPT_ILOCKED, then inode sent is already locked EXCL.
  * Inode may get unlocked and relocked in here, and the caller must deal with
  * the consequences.
@@ -851,7 +805,6 @@ xfs_qm_dqattach(
 	if (XFS_IS_UQUOTA_ON(mp)) {
 		error = xfs_qm_dqattach_one(ip, ip->i_d.di_uid, XFS_DQ_USER,
 						flags & XFS_QMOPT_DQALLOC,
-						flags & XFS_QMOPT_DQLOCK,
 						NULL, &ip->i_udquot);
 		if (error)
 			goto done;
@@ -863,11 +816,9 @@ xfs_qm_dqattach(
 		error = XFS_IS_GQUOTA_ON(mp) ?
 			xfs_qm_dqattach_one(ip, ip->i_d.di_gid, XFS_DQ_GROUP,
 						flags & XFS_QMOPT_DQALLOC,
-						flags & XFS_QMOPT_DQLOCK,
 						ip->i_udquot, &ip->i_gdquot) :
 			xfs_qm_dqattach_one(ip, ip->i_d.di_projid, XFS_DQ_PROJ,
 						flags & XFS_QMOPT_DQALLOC,
-						flags & XFS_QMOPT_DQLOCK,
 						ip->i_udquot, &ip->i_gdquot);
 		/*
 		 * Don't worry about the udquot that we may have
@@ -898,22 +849,13 @@ xfs_qm_dqattach(
 		/*
 		 * Attach i_gdquot to the gdquot hint inside the i_udquot.
 		 */
-		xfs_qm_dqattach_grouphint(ip->i_udquot, ip->i_gdquot,
-					 flags & XFS_QMOPT_DQLOCK);
+		xfs_qm_dqattach_grouphint(ip->i_udquot, ip->i_gdquot);
 	}
 
       done:
 
 #ifdef QUOTADEBUG
 	if (! error) {
-		if (ip->i_udquot) {
-			if (flags & XFS_QMOPT_DQLOCK)
-				ASSERT(XFS_DQ_IS_LOCKED(ip->i_udquot));
-		}
-		if (ip->i_gdquot) {
-			if (flags & XFS_QMOPT_DQLOCK)
-				ASSERT(XFS_DQ_IS_LOCKED(ip->i_gdquot));
-		}
 		if (XFS_IS_UQUOTA_ON(mp))
 			ASSERT(ip->i_udquot);
 		if (XFS_IS_OQUOTA_ON(mp))
Index: xfs/fs/xfs/quota/xfs_trans_dquot.c
===================================================================
--- xfs.orig/fs/xfs/quota/xfs_trans_dquot.c	2009-01-21 21:03:27.837294860 +0100
+++ xfs/fs/xfs/quota/xfs_trans_dquot.c	2009-01-24 18:56:04.216429130 +0100
@@ -624,10 +624,9 @@ xfs_trans_dqresv(
 	xfs_qcnt_t	*resbcountp;
 	xfs_quotainfo_t	*q = mp->m_quotainfo;
 
-	if (! (flags & XFS_QMOPT_DQLOCK)) {
-		xfs_dqlock(dqp);
-	}
-	ASSERT(XFS_DQ_IS_LOCKED(dqp));
+
+	xfs_dqlock(dqp);
+
 	if (flags & XFS_TRANS_DQ_RES_BLKS) {
 		hardlimit = be64_to_cpu(dqp->q_core.d_blk_hardlimit);
 		if (!hardlimit)
@@ -740,10 +739,8 @@ xfs_trans_dqresv(
 	ASSERT(dqp->q_res_icount >= be64_to_cpu(dqp->q_core.d_icount));
 
 error_return:
-	if (! (flags & XFS_QMOPT_DQLOCK)) {
-		xfs_dqunlock(dqp);
-	}
-	return (error);
+	xfs_dqunlock(dqp);
+	return error;
 }
 
 
@@ -753,8 +750,7 @@ error_return:
  * grp/prj quotas is important, because this follows a both-or-nothing
  * approach.
  *
- * flags = XFS_QMOPT_DQLOCK indicate if dquot(s) need to be locked.
- *	   XFS_QMOPT_FORCE_RES evades limit enforcement. Used by chown.
+ * flags = XFS_QMOPT_FORCE_RES evades limit enforcement. Used by chown.
  *	   XFS_QMOPT_ENOSPC returns ENOSPC not EDQUOT.  Used by pquota.
  *	   XFS_TRANS_DQ_RES_BLKS reserves regular disk blocks
  *	   XFS_TRANS_DQ_RES_RTBLKS reserves realtime disk blocks
Index: xfs/fs/xfs/xfs_quota.h
===================================================================
--- xfs.orig/fs/xfs/xfs_quota.h	2009-01-24 18:52:52.211583834 +0100
+++ xfs/fs/xfs/xfs_quota.h	2009-01-24 18:56:04.217428839 +0100
@@ -187,7 +187,6 @@ typedef struct xfs_qoff_logformat {
  * to a single function. None of these XFS_QMOPT_* flags are meant to have
  * persistent values (ie. their values can and will change between versions)
  */
-#define XFS_QMOPT_DQLOCK	0x0000001 /* dqlock */
 #define XFS_QMOPT_DQALLOC	0x0000002 /* alloc dquot ondisk if needed */
 #define XFS_QMOPT_UQUOTA	0x0000004 /* user dquot requested */
 #define XFS_QMOPT_PQUOTA	0x0000008 /* project dquot requested */

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

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

* [PATCH 15/17] xfs: remove XFS_QM_LOCK/XFS_QM_UNLOCK/XFS_QM_HOLD/XFS_QM_RELE
  2009-01-26  7:31 [PATCH 00/17] 2.6.30 queue Christoph Hellwig
                   ` (13 preceding siblings ...)
  2009-01-26  7:31 ` [PATCH 14/17] xfs: remove the unused XFS_QMOPT_DQLOCK flag Christoph Hellwig
@ 2009-01-26  7:31 ` Christoph Hellwig
  2009-02-09  2:42   ` Dave Chinner
  2009-01-26  7:31 ` [PATCH 16/17] xfs: use mutex_is_locked in XFS_DQ_IS_LOCKED Christoph Hellwig
                   ` (2 subsequent siblings)
  17 siblings, 1 reply; 50+ messages in thread
From: Christoph Hellwig @ 2009-01-26  7:31 UTC (permalink / raw)
  To: xfs

[-- Attachment #1: xfs-kill-XFS_QM_LOCK --]
[-- Type: text/plain, Size: 2119 bytes --]

Remove these macros which only obsfucated the code in rather nast ways.


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

Index: xfs/fs/xfs/quota/xfs_qm.c
===================================================================
--- xfs.orig/fs/xfs/quota/xfs_qm.c	2008-12-30 20:38:36.144493445 +0100
+++ xfs/fs/xfs/quota/xfs_qm.c	2008-12-30 21:55:41.865496758 +0100
@@ -219,7 +219,7 @@ xfs_qm_hold_quotafs_ref(
 	 * the structure could disappear between the entry to this routine and
 	 * a HOLD operation if not locked.
 	 */
-	XFS_QM_LOCK(xfs_Gqm);
+	mutex_lock(&xfs_Gqm_lock);
 
 	if (xfs_Gqm == NULL)
 		xfs_Gqm = xfs_Gqm_init();
@@ -228,8 +228,8 @@ xfs_qm_hold_quotafs_ref(
 	 * debugging and statistical purposes, but ...
 	 * Just take a reference and get out.
 	 */
-	XFS_QM_HOLD(xfs_Gqm);
-	XFS_QM_UNLOCK(xfs_Gqm);
+	xfs_Gqm->qm_nrefs++;
+	mutex_unlock(&xfs_Gqm_lock);
 
 	return 0;
 }
@@ -277,13 +277,12 @@ xfs_qm_rele_quotafs_ref(
 	 * Destroy the entire XQM. If somebody mounts with quotaon, this'll
 	 * be restarted.
 	 */
-	XFS_QM_LOCK(xfs_Gqm);
-	XFS_QM_RELE(xfs_Gqm);
-	if (xfs_Gqm->qm_nrefs == 0) {
+	mutex_lock(&xfs_Gqm_lock);
+	if (--xfs_Gqm->qm_nrefs == 0) {
 		xfs_qm_destroy(xfs_Gqm);
 		xfs_Gqm = NULL;
 	}
-	XFS_QM_UNLOCK(xfs_Gqm);
+	mutex_unlock(&xfs_Gqm_lock);
 }
 
 /*
Index: xfs/fs/xfs/quota/xfs_qm.h
===================================================================
--- xfs.orig/fs/xfs/quota/xfs_qm.h	2008-12-30 20:38:32.989527673 +0100
+++ xfs/fs/xfs/quota/xfs_qm.h	2008-12-30 21:15:23.500493377 +0100
@@ -158,11 +158,6 @@ typedef struct xfs_dquot_acct {
 #define XFS_QM_IWARNLIMIT	5
 #define XFS_QM_RTBWARNLIMIT	5
 
-#define XFS_QM_LOCK(xqm)	(mutex_lock(&xqm##_lock))
-#define XFS_QM_UNLOCK(xqm)	(mutex_unlock(&xqm##_lock))
-#define XFS_QM_HOLD(xqm)	((xqm)->qm_nrefs++)
-#define XFS_QM_RELE(xqm)	((xqm)->qm_nrefs--)
-
 extern void		xfs_qm_destroy_quotainfo(xfs_mount_t *);
 extern void		xfs_qm_mount_quotas(xfs_mount_t *);
 extern int		xfs_qm_quotacheck(xfs_mount_t *);

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

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

* [PATCH 16/17] xfs: use mutex_is_locked in XFS_DQ_IS_LOCKED
  2009-01-26  7:31 [PATCH 00/17] 2.6.30 queue Christoph Hellwig
                   ` (14 preceding siblings ...)
  2009-01-26  7:31 ` [PATCH 15/17] xfs: remove XFS_QM_LOCK/XFS_QM_UNLOCK/XFS_QM_HOLD/XFS_QM_RELE Christoph Hellwig
@ 2009-01-26  7:31 ` Christoph Hellwig
  2009-02-09  2:42   ` Dave Chinner
  2009-01-26  7:31 ` [PATCH 17/17] xfs: sanitize qh_lock wrappers Christoph Hellwig
  2009-02-04 19:37 ` [PATCH 00/17] 2.6.30 queue Christoph Hellwig
  17 siblings, 1 reply; 50+ messages in thread
From: Christoph Hellwig @ 2009-01-26  7:31 UTC (permalink / raw)
  To: xfs

[-- Attachment #1: xfs-XFS_DQ_IS_LOCKED-use-mutex_is_locked --]
[-- Type: text/plain, Size: 1284 bytes --]

Now that we have a helper to test if a mutex is held use it instead of our
own little hacks.

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

Index: xfs/fs/xfs/quota/xfs_dquot.h
===================================================================
--- xfs.orig/fs/xfs/quota/xfs_dquot.h	2008-12-30 09:58:43.271493395 +0100
+++ xfs/fs/xfs/quota/xfs_dquot.h	2008-12-30 09:59:38.831495515 +0100
@@ -109,19 +109,6 @@ enum {
 
 #define XFS_DQHOLD(dqp)		((dqp)->q_nrefs++)
 
-#ifdef DEBUG
-static inline int
-XFS_DQ_IS_LOCKED(xfs_dquot_t *dqp)
-{
-	if (mutex_trylock(&dqp->q_qlock)) {
-		mutex_unlock(&dqp->q_qlock);
-		return 0;
-	}
-	return 1;
-}
-#endif
-
-
 /*
  * Manage the q_flush completion queue embedded in the dquot.  This completion
  * queue synchronizes processes attempting to flush the in-core dquot back to
@@ -142,6 +129,7 @@ static inline void xfs_dqfunlock(xfs_dqu
 	complete(&dqp->q_flush);
 }
 
+#define XFS_DQ_IS_LOCKED(dqp)	(mutex_is_locked(&((dqp)->q_qlock)))
 #define XFS_DQ_IS_ON_FREELIST(dqp)  ((dqp)->dq_flnext != (dqp))
 #define XFS_DQ_IS_DIRTY(dqp)	((dqp)->dq_flags & XFS_DQ_DIRTY)
 #define XFS_QM_ISUDQ(dqp)	((dqp)->dq_flags & XFS_DQ_USER)

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

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

* [PATCH 17/17] xfs: sanitize qh_lock wrappers
  2009-01-26  7:31 [PATCH 00/17] 2.6.30 queue Christoph Hellwig
                   ` (15 preceding siblings ...)
  2009-01-26  7:31 ` [PATCH 16/17] xfs: use mutex_is_locked in XFS_DQ_IS_LOCKED Christoph Hellwig
@ 2009-01-26  7:31 ` Christoph Hellwig
  2009-02-09  2:45   ` Dave Chinner
  2009-02-04 19:37 ` [PATCH 00/17] 2.6.30 queue Christoph Hellwig
  17 siblings, 1 reply; 50+ messages in thread
From: Christoph Hellwig @ 2009-01-26  7:31 UTC (permalink / raw)
  To: xfs

[-- Attachment #1: xfs-quota-remove-qh_lock-wrappers --]
[-- Type: text/plain, Size: 9644 bytes --]

Get rid of various obsfucating wrappers for accessing the quota hash lock,
we only keep the accessors for accessing the mplist and freelist locks as
they encode a multi-level datastructure walk.  But make sure all of them
are defined in the same way as simple macros.


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

Index: xfs/fs/xfs/quota/xfs_dquot.c
===================================================================
--- xfs.orig/fs/xfs/quota/xfs_dquot.c	2009-01-21 21:03:27.832295131 +0100
+++ xfs/fs/xfs/quota/xfs_dquot.c	2009-01-24 18:59:09.587428189 +0100
@@ -804,7 +804,7 @@ xfs_qm_dqlookup(
 	uint			flist_locked;
 	xfs_dquot_t		*d;
 
-	ASSERT(XFS_DQ_IS_HASH_LOCKED(qh));
+	ASSERT(mutex_is_locked(&qh->qh_lock));
 
 	flist_locked = B_FALSE;
 
@@ -877,7 +877,7 @@ xfs_qm_dqlookup(
 			/*
 			 * move the dquot to the front of the hashchain
 			 */
-			ASSERT(XFS_DQ_IS_HASH_LOCKED(qh));
+			ASSERT(mutex_is_locked(&qh->qh_lock));
 			if (dqp->HL_PREVP != &qh->qh_next) {
 				xfs_dqtrace_entry(dqp,
 						  "DQLOOKUP: HASH MOVETOFRONT");
@@ -892,13 +892,13 @@ xfs_qm_dqlookup(
 			}
 			xfs_dqtrace_entry(dqp, "LOOKUP END");
 			*O_dqpp = dqp;
-			ASSERT(XFS_DQ_IS_HASH_LOCKED(qh));
+			ASSERT(mutex_is_locked(&qh->qh_lock));
 			return (0);
 		}
 	}
 
 	*O_dqpp = NULL;
-	ASSERT(XFS_DQ_IS_HASH_LOCKED(qh));
+	ASSERT(mutex_is_locked(&qh->qh_lock));
 	return (1);
 }
 
@@ -956,7 +956,7 @@ xfs_qm_dqget(
 			ASSERT(ip->i_gdquot == NULL);
 	}
 #endif
-	XFS_DQ_HASH_LOCK(h);
+	mutex_lock(&h->qh_lock);
 
 	/*
 	 * Look in the cache (hashtable).
@@ -971,7 +971,7 @@ xfs_qm_dqget(
 		 */
 		ASSERT(*O_dqpp);
 		ASSERT(XFS_DQ_IS_LOCKED(*O_dqpp));
-		XFS_DQ_HASH_UNLOCK(h);
+		mutex_unlock(&h->qh_lock);
 		xfs_dqtrace_entry(*O_dqpp, "DQGET DONE (FROM CACHE)");
 		return (0);	/* success */
 	}
@@ -991,7 +991,7 @@ xfs_qm_dqget(
 	 * we don't keep the lock across a disk read
 	 */
 	version = h->qh_version;
-	XFS_DQ_HASH_UNLOCK(h);
+	mutex_unlock(&h->qh_lock);
 
 	/*
 	 * Allocate the dquot on the kernel heap, and read the ondisk
@@ -1056,7 +1056,7 @@ xfs_qm_dqget(
 	/*
 	 * Hashlock comes after ilock in lock order
 	 */
-	XFS_DQ_HASH_LOCK(h);
+	mutex_lock(&h->qh_lock);
 	if (version != h->qh_version) {
 		xfs_dquot_t *tmpdqp;
 		/*
@@ -1072,7 +1072,7 @@ xfs_qm_dqget(
 			 * and start over.
 			 */
 			xfs_qm_dqput(tmpdqp);
-			XFS_DQ_HASH_UNLOCK(h);
+			mutex_unlock(&h->qh_lock);
 			xfs_qm_dqdestroy(dqp);
 			XQM_STATS_INC(xqmstats.xs_qm_dquot_dups);
 			goto again;
@@ -1083,7 +1083,7 @@ xfs_qm_dqget(
 	 * Put the dquot at the beginning of the hash-chain and mp's list
 	 * LOCK ORDER: hashlock, freelistlock, mplistlock, udqlock, gdqlock ..
 	 */
-	ASSERT(XFS_DQ_IS_HASH_LOCKED(h));
+	ASSERT(mutex_is_locked(&h->qh_lock));
 	dqp->q_hash = h;
 	XQM_HASHLIST_INSERT(h, dqp);
 
@@ -1102,7 +1102,7 @@ xfs_qm_dqget(
 	XQM_MPLIST_INSERT(&(XFS_QI_MPL_LIST(mp)), dqp);
 
 	xfs_qm_mplist_unlock(mp);
-	XFS_DQ_HASH_UNLOCK(h);
+	mutex_unlock(&h->qh_lock);
  dqret:
 	ASSERT((ip == NULL) || xfs_isilocked(ip, XFS_ILOCK_EXCL));
 	xfs_dqtrace_entry(dqp, "DQGET DONE");
@@ -1440,7 +1440,7 @@ xfs_qm_dqpurge(
 	xfs_mount_t	*mp = dqp->q_mount;
 
 	ASSERT(XFS_QM_IS_MPLIST_LOCKED(mp));
-	ASSERT(XFS_DQ_IS_HASH_LOCKED(dqp->q_hash));
+	ASSERT(mutex_is_locked(&dqp->q_hash->qh_lock));
 
 	xfs_dqlock(dqp);
 	/*
@@ -1453,7 +1453,7 @@ xfs_qm_dqpurge(
 	 */
 	if (dqp->q_nrefs != 0) {
 		xfs_dqunlock(dqp);
-		XFS_DQ_HASH_UNLOCK(dqp->q_hash);
+		mutex_unlock(&dqp->q_hash->qh_lock);
 		return (1);
 	}
 
@@ -1517,7 +1517,7 @@ xfs_qm_dqpurge(
 	memset(&dqp->q_core, 0, sizeof(dqp->q_core));
 	xfs_dqfunlock(dqp);
 	xfs_dqunlock(dqp);
-	XFS_DQ_HASH_UNLOCK(thishash);
+	mutex_unlock(&thishash->qh_lock);
 	return (0);
 }
 
Index: xfs/fs/xfs/quota/xfs_qm.c
===================================================================
--- xfs.orig/fs/xfs/quota/xfs_qm.c	2009-01-24 18:57:29.143429031 +0100
+++ xfs/fs/xfs/quota/xfs_qm.c	2009-01-24 18:59:09.593428604 +0100
@@ -69,8 +69,6 @@ STATIC void	xfs_qm_list_destroy(xfs_dqli
 
 STATIC void	xfs_qm_freelist_init(xfs_frlist_t *);
 STATIC void	xfs_qm_freelist_destroy(xfs_frlist_t *);
-STATIC int	xfs_qm_mplist_nowait(xfs_mount_t *);
-STATIC int	xfs_qm_dqhashlock_nowait(xfs_dquot_t *);
 
 STATIC int	xfs_qm_init_quotainos(xfs_mount_t *);
 STATIC int	xfs_qm_init_quotainfo(xfs_mount_t *);
@@ -576,10 +574,10 @@ xfs_qm_dqpurge_int(
 			continue;
 		}
 
-		if (! xfs_qm_dqhashlock_nowait(dqp)) {
+		if (!mutex_trylock(&dqp->q_hash->qh_lock)) {
 			nrecl = XFS_QI_MPLRECLAIMS(mp);
 			xfs_qm_mplist_unlock(mp);
-			XFS_DQ_HASH_LOCK(dqp->q_hash);
+			mutex_lock(&dqp->q_hash->qh_lock);
 			xfs_qm_mplist_lock(mp);
 
 			/*
@@ -589,7 +587,7 @@ xfs_qm_dqpurge_int(
 			 * this point, but somebody might be taking things off.
 			 */
 			if (nrecl != XFS_QI_MPLRECLAIMS(mp)) {
-				XFS_DQ_HASH_UNLOCK(dqp->q_hash);
+				mutex_unlock(&dqp->q_hash->qh_lock);
 				goto again;
 			}
 		}
@@ -2027,7 +2025,7 @@ xfs_qm_shake_freelist(
 		 * a dqlookup process that holds the hashlock that is
 		 * waiting for the freelist lock.
 		 */
-		if (! xfs_qm_dqhashlock_nowait(dqp)) {
+		if (!mutex_trylock(&dqp->q_hash->qh_lock)) {
 			xfs_dqfunlock(dqp);
 			xfs_dqunlock(dqp);
 			dqp = dqp->dq_flnext;
@@ -2044,7 +2042,7 @@ xfs_qm_shake_freelist(
 			/* XXX put a sentinel so that we can come back here */
 			xfs_dqfunlock(dqp);
 			xfs_dqunlock(dqp);
-			XFS_DQ_HASH_UNLOCK(hash);
+			mutex_unlock(&hash->qh_lock);
 			xfs_qm_freelist_unlock(xfs_Gqm);
 			if (++restarts >= XFS_QM_RECLAIM_MAX_RESTARTS)
 				return nreclaimed;
@@ -2061,7 +2059,7 @@ xfs_qm_shake_freelist(
 		XQM_HASHLIST_REMOVE(hash, dqp);
 		xfs_dqfunlock(dqp);
 		xfs_qm_mplist_unlock(dqp->q_mount);
-		XFS_DQ_HASH_UNLOCK(hash);
+		mutex_unlock(&hash->qh_lock);
 
  off_freelist:
 		XQM_FREELIST_REMOVE(dqp);
@@ -2203,7 +2201,7 @@ xfs_qm_dqreclaim_one(void)
 			continue;
 		}
 
-		if (! xfs_qm_dqhashlock_nowait(dqp))
+		if (!mutex_trylock(&dqp->q_hash->qh_lock))
 			goto mplistunlock;
 
 		ASSERT(dqp->q_nrefs == 0);
@@ -2212,7 +2210,7 @@ xfs_qm_dqreclaim_one(void)
 		XQM_HASHLIST_REMOVE(dqp->q_hash, dqp);
 		XQM_FREELIST_REMOVE(dqp);
 		dqpout = dqp;
-		XFS_DQ_HASH_UNLOCK(dqp->q_hash);
+		mutex_unlock(&dqp->q_hash->qh_lock);
  mplistunlock:
 		xfs_qm_mplist_unlock(dqp->q_mount);
 		xfs_dqfunlock(dqp);
@@ -2715,34 +2713,3 @@ xfs_qm_freelist_append(xfs_frlist_t *ql,
 {
 	xfs_qm_freelist_insert((xfs_frlist_t *)ql->qh_prev, dq);
 }
-
-STATIC int
-xfs_qm_dqhashlock_nowait(
-	xfs_dquot_t *dqp)
-{
-	int locked;
-
-	locked = mutex_trylock(&((dqp)->q_hash->qh_lock));
-	return locked;
-}
-
-int
-xfs_qm_freelist_lock_nowait(
-	xfs_qm_t *xqm)
-{
-	int locked;
-
-	locked = mutex_trylock(&(xqm->qm_dqfreelist.qh_lock));
-	return locked;
-}
-
-STATIC int
-xfs_qm_mplist_nowait(
-	xfs_mount_t	*mp)
-{
-	int locked;
-
-	ASSERT(mp->m_quotainfo);
-	locked = mutex_trylock(&(XFS_QI_MPLLOCK(mp)));
-	return locked;
-}
Index: xfs/fs/xfs/quota/xfs_qm.h
===================================================================
--- xfs.orig/fs/xfs/quota/xfs_qm.h	2009-01-24 18:57:29.143429031 +0100
+++ xfs/fs/xfs/quota/xfs_qm.h	2009-01-24 18:59:09.593428604 +0100
@@ -199,7 +199,6 @@ extern int		xfs_qm_vop_chown_reserve(xfs
 /* list stuff */
 extern void		xfs_qm_freelist_append(xfs_frlist_t *, xfs_dquot_t *);
 extern void		xfs_qm_freelist_unlink(xfs_dquot_t *);
-extern int		xfs_qm_freelist_lock_nowait(xfs_qm_t *);
 
 #ifdef DEBUG
 extern int		xfs_qm_internalqcheck(xfs_mount_t *);
Index: xfs/fs/xfs/quota/xfs_quota_priv.h
===================================================================
--- xfs.orig/fs/xfs/quota/xfs_quota_priv.h	2009-01-21 21:03:27.836295012 +0100
+++ xfs/fs/xfs/quota/xfs_quota_priv.h	2009-01-24 18:59:09.594477411 +0100
@@ -42,34 +42,24 @@
 #define XFS_QI_QOFFLOCK(mp)	((mp)->m_quotainfo->qi_quotaofflock)
 
 #define XFS_QI_MPL_LIST(mp)	((mp)->m_quotainfo->qi_dqlist)
-#define XFS_QI_MPLLOCK(mp)	((mp)->m_quotainfo->qi_dqlist.qh_lock)
 #define XFS_QI_MPLNEXT(mp)	((mp)->m_quotainfo->qi_dqlist.qh_next)
 #define XFS_QI_MPLNDQUOTS(mp)	((mp)->m_quotainfo->qi_dqlist.qh_nelems)
 
-#define XQMLCK(h)			(mutex_lock(&((h)->qh_lock)))
-#define XQMUNLCK(h)			(mutex_unlock(&((h)->qh_lock)))
-#ifdef DEBUG
-struct xfs_dqhash;
-static inline int XQMISLCKD(struct xfs_dqhash *h)
-{
-	if (mutex_trylock(&h->qh_lock)) {
-		mutex_unlock(&h->qh_lock);
-		return 0;
-	}
-	return 1;
-}
-#endif
-
-#define XFS_DQ_HASH_LOCK(h)		XQMLCK(h)
-#define XFS_DQ_HASH_UNLOCK(h)		XQMUNLCK(h)
-#define XFS_DQ_IS_HASH_LOCKED(h)	XQMISLCKD(h)
-
-#define xfs_qm_mplist_lock(mp)		XQMLCK(&(XFS_QI_MPL_LIST(mp)))
-#define xfs_qm_mplist_unlock(mp)	XQMUNLCK(&(XFS_QI_MPL_LIST(mp)))
-#define XFS_QM_IS_MPLIST_LOCKED(mp)	XQMISLCKD(&(XFS_QI_MPL_LIST(mp)))
-
-#define xfs_qm_freelist_lock(qm)	XQMLCK(&((qm)->qm_dqfreelist))
-#define xfs_qm_freelist_unlock(qm)	XQMUNLCK(&((qm)->qm_dqfreelist))
+#define xfs_qm_mplist_lock(mp) \
+	mutex_lock(&(XFS_QI_MPL_LIST(mp).qh_lock))
+#define xfs_qm_mplist_nowait(mp) \
+	mutex_trylock(&(XFS_QI_MPL_LIST(mp).qh_lock))
+#define xfs_qm_mplist_unlock(mp) \
+	mutex_unlock(&(XFS_QI_MPL_LIST(mp).qh_lock))
+#define XFS_QM_IS_MPLIST_LOCKED(mp) \
+	mutex_is_locked(&(XFS_QI_MPL_LIST(mp).qh_lock))
+
+#define xfs_qm_freelist_lock(qm) \
+	mutex_lock(&((qm)->qm_dqfreelist.qh_lock))
+#define xfs_qm_freelist_lock_nowait(qm) \
+	mutex_trylock(&((qm)->qm_dqfreelist.qh_lock))
+#define xfs_qm_freelist_unlock(qm) \
+	mutex_unlock(&((qm)->qm_dqfreelist.qh_lock))
 
 /*
  * Hash into a bucket in the dquot hash table, based on <mp, id>.

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

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

* Re: [PATCH 03/17] xfs: cleanup handling in xfs_swap_extents
  2009-01-26  7:31 ` [PATCH 03/17] xfs: cleanup handling in xfs_swap_extents Christoph Hellwig
@ 2009-01-26  7:55   ` Christoph Hellwig
  2009-01-27  0:27     ` [PATCH] xfs: cleanup error " Josef 'Jeff' Sipek
  2009-01-26 22:13   ` [PATCH 03/17] xfs: cleanup " Felix Blyakher
  2009-05-08  0:45   ` Eric Sandeen
  2 siblings, 1 reply; 50+ messages in thread
From: Christoph Hellwig @ 2009-01-26  7:55 UTC (permalink / raw)
  To: xfs

On Mon, Jan 26, 2009 at 02:31:39AM -0500, Christoph Hellwig wrote:
> Use multiple lables for proper error unwinding and get rid of some now
> superflous variables.

Sorry, should have been cleanup error handling and marked as beein
from Jeff.

Jeff, maybe you should just resend this yourself so that it doesn't
get messed up?  You can add my Tested-by flag as it passed xfsqa
on multiple platforms for me (although with the recent swapext flaw
I wonder if that actuall means anything :))

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

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

* Re: [PATCH 01/17] xfs: cleanup error handling in xfs_mountfs:
  2009-01-26  7:31 ` [PATCH 01/17] xfs: cleanup error handling in xfs_mountfs: Christoph Hellwig
@ 2009-01-26 21:39   ` Felix Blyakher
  0 siblings, 0 replies; 50+ messages in thread
From: Felix Blyakher @ 2009-01-26 21:39 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs


On Jan 26, 2009, at 1:31 AM, Christoph Hellwig wrote:

> Clean up the error handling in xfs_mountfs.  Use readable goto label  
> names,
> simplify the uuid handling and other error conditions.
>
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Felix Blyakher <felixb@sgi.com>

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

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

* Re: [PATCH 02/17] xfs: make sure to free the real-time inodes in the mount error path
  2009-01-26  7:31 ` [PATCH 02/17] xfs: make sure to free the real-time inodes in the mount error path Christoph Hellwig
@ 2009-01-26 22:02   ` Felix Blyakher
  2009-01-28 20:24   ` Martin Steigerwald
  1 sibling, 0 replies; 50+ messages in thread
From: Felix Blyakher @ 2009-01-26 22:02 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs


On Jan 26, 2009, at 1:31 AM, Christoph Hellwig wrote:

> When mount failes after allocating the real-time inodes we currently  
> leak
> them.  Add a new helper to free the real-time inodes which can be  
> used by
> both the mount and unmount path.
>
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Felix Blyakher <felixb@sgi.com>

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

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

* Re: [PATCH 03/17] xfs: cleanup handling in xfs_swap_extents
  2009-01-26  7:31 ` [PATCH 03/17] xfs: cleanup handling in xfs_swap_extents Christoph Hellwig
  2009-01-26  7:55   ` Christoph Hellwig
@ 2009-01-26 22:13   ` Felix Blyakher
  2009-05-08  0:45   ` Eric Sandeen
  2 siblings, 0 replies; 50+ messages in thread
From: Felix Blyakher @ 2009-01-26 22:13 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs


On Jan 26, 2009, at 1:31 AM, Christoph Hellwig wrote:

> Use multiple lables for proper error unwinding and get rid of some now
> superflous variables.
>
>
> Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
> Reviewed-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Felix Blyakher <felixb@sgi.com>

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

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

* Re: [PATCH 04/17] xfs: tiny cleanup for xfs_link
  2009-01-26  7:31 ` [PATCH 04/17] xfs: tiny cleanup for xfs_link Christoph Hellwig
@ 2009-01-26 22:23   ` Felix Blyakher
  0 siblings, 0 replies; 50+ messages in thread
From: Felix Blyakher @ 2009-01-26 22:23 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs


On Jan 26, 2009, at 1:31 AM, Christoph Hellwig wrote:

> The source and target inodes are guaranteed to never be the same by  
> the VFS,
> so no need to check for that (and we would get into bad trouble  
> later anyway
> if that were the case).  Also clean up the error handling to use two  
> gotos
> instead of nested conditions.
>
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Felix Blyakher <felixb@sgi.com>

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

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

* Re: [PATCH 05/17] xfs: remove unused XFS_MOUNT_ILOCK/XFS_MOUNT_IUNLOCK
  2009-01-26  7:31 ` [PATCH 05/17] xfs: remove unused XFS_MOUNT_ILOCK/XFS_MOUNT_IUNLOCK Christoph Hellwig
@ 2009-01-26 23:43   ` Felix Blyakher
  0 siblings, 0 replies; 50+ messages in thread
From: Felix Blyakher @ 2009-01-26 23:43 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs


On Jan 26, 2009, at 1:31 AM, Christoph Hellwig wrote:

> These aren't only unused but also reference a lock that doesn't  
> exist anymore.
>
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Yep, leftover from "kill deleted inode list" commit.

Reviewed-by: Felix Blyakher <felixb@sgi.com>


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

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

* [PATCH] xfs: cleanup error handling in xfs_swap_extents
  2009-01-26  7:55   ` Christoph Hellwig
@ 2009-01-27  0:27     ` Josef 'Jeff' Sipek
  2009-01-28 20:25       ` Martin Steigerwald
  0 siblings, 1 reply; 50+ messages in thread
From: Josef 'Jeff' Sipek @ 2009-01-27  0:27 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

From: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>

Use multiple lables for proper error unwinding and get rid of some now
superflous variables.

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Tested-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Felix Blyakher <felixb@sgi.com>
---
 fs/xfs/xfs_dfrag.c |   62 ++++++++++++++++++++++-----------------------------
 1 files changed, 27 insertions(+), 35 deletions(-)

diff --git a/fs/xfs/xfs_dfrag.c b/fs/xfs/xfs_dfrag.c
index 75b0cd4..ec832bc 100644
--- a/fs/xfs/xfs_dfrag.c
+++ b/fs/xfs/xfs_dfrag.c
@@ -132,19 +132,17 @@ xfs_swap_extents(
 	xfs_bstat_t	*sbp = &sxp->sx_stat;
 	xfs_ifork_t	*tempifp, *ifp, *tifp;
 	int		ilf_fields, tilf_fields;
-	static uint	lock_flags = XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL;
 	int		error = 0;
 	int		aforkblks = 0;
 	int		taforkblks = 0;
 	__uint64_t	tmp;
-	char		locked = 0;
 
 	mp = ip->i_mount;
 
 	tempifp = kmem_alloc(sizeof(xfs_ifork_t), KM_MAYFAIL);
 	if (!tempifp) {
 		error = XFS_ERROR(ENOMEM);
-		goto error0;
+		goto out;
 	}
 
 	sbp = &sxp->sx_stat;
@@ -157,25 +155,24 @@ xfs_swap_extents(
 	 */
 	xfs_lock_two_inodes(ip, tip, XFS_IOLOCK_EXCL);
 	xfs_lock_two_inodes(ip, tip, XFS_ILOCK_EXCL);
-	locked = 1;
 
 	/* Verify that both files have the same format */
 	if ((ip->i_d.di_mode & S_IFMT) != (tip->i_d.di_mode & S_IFMT)) {
 		error = XFS_ERROR(EINVAL);
-		goto error0;
+		goto out_unlock;
 	}
 
 	/* Verify both files are either real-time or non-realtime */
 	if (XFS_IS_REALTIME_INODE(ip) != XFS_IS_REALTIME_INODE(tip)) {
 		error = XFS_ERROR(EINVAL);
-		goto error0;
+		goto out_unlock;
 	}
 
 	/* Should never get a local format */
 	if (ip->i_d.di_format == XFS_DINODE_FMT_LOCAL ||
 	    tip->i_d.di_format == XFS_DINODE_FMT_LOCAL) {
 		error = XFS_ERROR(EINVAL);
-		goto error0;
+		goto out_unlock;
 	}
 
 	if (VN_CACHED(VFS_I(tip)) != 0) {
@@ -183,13 +180,13 @@ xfs_swap_extents(
 		error = xfs_flushinval_pages(tip, 0, -1,
 				FI_REMAPF_LOCKED);
 		if (error)
-			goto error0;
+			goto out_unlock;
 	}
 
 	/* Verify O_DIRECT for ftmp */
 	if (VN_CACHED(VFS_I(tip)) != 0) {
 		error = XFS_ERROR(EINVAL);
-		goto error0;
+		goto out_unlock;
 	}
 
 	/* Verify all data are being swapped */
@@ -197,7 +194,7 @@ xfs_swap_extents(
 	    sxp->sx_length != ip->i_d.di_size ||
 	    sxp->sx_length != tip->i_d.di_size) {
 		error = XFS_ERROR(EFAULT);
-		goto error0;
+		goto out_unlock;
 	}
 
 	/*
@@ -207,7 +204,7 @@ xfs_swap_extents(
 	 */
 	if ( XFS_IFORK_Q(ip) != XFS_IFORK_Q(tip) ) {
 		error = XFS_ERROR(EINVAL);
-		goto error0;
+		goto out_unlock;
 	}
 
 	/*
@@ -222,7 +219,7 @@ xfs_swap_extents(
 	    (sbp->bs_mtime.tv_sec != ip->i_d.di_mtime.t_sec) ||
 	    (sbp->bs_mtime.tv_nsec != ip->i_d.di_mtime.t_nsec)) {
 		error = XFS_ERROR(EBUSY);
-		goto error0;
+		goto out_unlock;
 	}
 
 	/* We need to fail if the file is memory mapped.  Once we have tossed
@@ -233,7 +230,7 @@ xfs_swap_extents(
 	 */
 	if (VN_MAPPED(VFS_I(ip))) {
 		error = XFS_ERROR(EBUSY);
-		goto error0;
+		goto out_unlock;
 	}
 
 	xfs_iunlock(ip, XFS_ILOCK_EXCL);
@@ -256,8 +253,7 @@ xfs_swap_extents(
 		xfs_iunlock(ip,  XFS_IOLOCK_EXCL);
 		xfs_iunlock(tip, XFS_IOLOCK_EXCL);
 		xfs_trans_cancel(tp, 0);
-		locked = 0;
-		goto error0;
+		goto out;
 	}
 	xfs_lock_two_inodes(ip, tip, XFS_ILOCK_EXCL);
 
@@ -267,19 +263,15 @@ xfs_swap_extents(
 	if ( ((XFS_IFORK_Q(ip) != 0) && (ip->i_d.di_anextents > 0)) &&
 	     (ip->i_d.di_aformat != XFS_DINODE_FMT_LOCAL)) {
 		error = xfs_bmap_count_blocks(tp, ip, XFS_ATTR_FORK, &aforkblks);
-		if (error) {
-			xfs_trans_cancel(tp, 0);
-			goto error0;
-		}
+		if (error)
+			goto out_trans_cancel;
 	}
 	if ( ((XFS_IFORK_Q(tip) != 0) && (tip->i_d.di_anextents > 0)) &&
 	     (tip->i_d.di_aformat != XFS_DINODE_FMT_LOCAL)) {
 		error = xfs_bmap_count_blocks(tp, tip, XFS_ATTR_FORK,
 			&taforkblks);
-		if (error) {
-			xfs_trans_cancel(tp, 0);
-			goto error0;
-		}
+		if (error)
+			goto out_trans_cancel;
 	}
 
 	/*
@@ -346,10 +338,10 @@ xfs_swap_extents(
 
 
 	IHOLD(ip);
-	xfs_trans_ijoin(tp, ip, lock_flags);
+	xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);
 
 	IHOLD(tip);
-	xfs_trans_ijoin(tp, tip, lock_flags);
+	xfs_trans_ijoin(tp, tip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);
 
 	xfs_trans_log_inode(tp, ip,  ilf_fields);
 	xfs_trans_log_inode(tp, tip, tilf_fields);
@@ -358,19 +350,19 @@ xfs_swap_extents(
 	 * If this is a synchronous mount, make sure that the
 	 * transaction goes to disk before returning to the user.
 	 */
-	if (mp->m_flags & XFS_MOUNT_WSYNC) {
+	if (mp->m_flags & XFS_MOUNT_WSYNC)
 		xfs_trans_set_sync(tp);
-	}
 
 	error = xfs_trans_commit(tp, XFS_TRANS_SWAPEXT);
-	locked = 0;
 
- error0:
-	if (locked) {
-		xfs_iunlock(ip,  lock_flags);
-		xfs_iunlock(tip, lock_flags);
-	}
-	if (tempifp != NULL)
-		kmem_free(tempifp);
+out_unlock:
+	xfs_iunlock(ip,  XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);
+	xfs_iunlock(tip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);
+out:
+	kmem_free(tempifp);
 	return error;
+
+out_trans_cancel:
+	xfs_trans_cancel(tp, 0);
+	goto out_unlock;
 }
-- 
1.5.6.5

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

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

* Re: [PATCH 10/17] xfs: factor out attr fork reset handling
  2009-01-26  7:31 ` [PATCH 10/17] xfs: factor out attr fork reset handling Christoph Hellwig
@ 2009-01-27 16:53   ` Felix Blyakher
  0 siblings, 0 replies; 50+ messages in thread
From: Felix Blyakher @ 2009-01-27 16:53 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

On Jan 26, 2009, at 1:31 AM, Christoph Hellwig wrote:

> We currently duplicate code to reset the attribute fork after the last
> attribute has been deleted.  Factor this out into a small helper.
>
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Felix Blyakher <felixb@sgi.com>

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

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

* Re: [PATCH 11/17] xfs: merge xfs_inode_flush into xfs_fs_write_inode
  2009-01-26  7:31 ` [PATCH 11/17] xfs: merge xfs_inode_flush into xfs_fs_write_inode Christoph Hellwig
@ 2009-01-27 17:37   ` Felix Blyakher
  2009-02-01  0:54   ` Dave Chinner
  2009-02-15  6:42   ` Dave Chinner
  2 siblings, 0 replies; 50+ messages in thread
From: Felix Blyakher @ 2009-01-27 17:37 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

On Jan 26, 2009, at 1:31 AM, Christoph Hellwig wrote:

> Spliting the task for a VFS-induced inode flush into two functions  
> doesn't
> make any sense, so merge the two functions dealing with it.
>
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Seems like nothing is taken or added, just the merge of two
functions. Looks good.

Reviewed-by: Felix Blyakher <felixb@sgi.com>

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

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

* Re: [PATCH 02/17] xfs: make sure to free the real-time inodes in the mount error path
  2009-01-26  7:31 ` [PATCH 02/17] xfs: make sure to free the real-time inodes in the mount error path Christoph Hellwig
  2009-01-26 22:02   ` Felix Blyakher
@ 2009-01-28 20:24   ` Martin Steigerwald
  1 sibling, 0 replies; 50+ messages in thread
From: Martin Steigerwald @ 2009-01-28 20:24 UTC (permalink / raw)
  To: xfs

Am Montag 26 Januar 2009 schrieb Christoph Hellwig:
> When mount failes after allocating the real-time inodes we currently
> leak them.  Add a new helper to free the real-time inodes which can be
> used by both the mount and unmount path.

Typo in description: s/failes/fails

-- 
Martin 'Helios' Steigerwald - http://www.Lichtvoll.de
GPG: 03B0 0D6C 0040 0710 4AFA  B82F 991B EAAC A599 84C7

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

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

* Re: [PATCH] xfs: cleanup error handling in xfs_swap_extents
  2009-01-27  0:27     ` [PATCH] xfs: cleanup error " Josef 'Jeff' Sipek
@ 2009-01-28 20:25       ` Martin Steigerwald
  0 siblings, 0 replies; 50+ messages in thread
From: Martin Steigerwald @ 2009-01-28 20:25 UTC (permalink / raw)
  To: xfs

Am Dienstag 27 Januar 2009 schrieb Josef 'Jeff' Sipek:
> From: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
>
> Use multiple lables for proper error unwinding and get rid of some now
> superflous variables.

Typo in description: s/lables/labels

-- 
Martin 'Helios' Steigerwald - http://www.Lichtvoll.de
GPG: 03B0 0D6C 0040 0710 4AFA  B82F 991B EAAC A599 84C7

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

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

* Re: [PATCH 11/17] xfs: merge xfs_inode_flush into xfs_fs_write_inode
  2009-01-26  7:31 ` [PATCH 11/17] xfs: merge xfs_inode_flush into xfs_fs_write_inode Christoph Hellwig
  2009-01-27 17:37   ` Felix Blyakher
@ 2009-02-01  0:54   ` Dave Chinner
  2009-02-15  6:42   ` Dave Chinner
  2 siblings, 0 replies; 50+ messages in thread
From: Dave Chinner @ 2009-02-01  0:54 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

On Mon, Jan 26, 2009 at 02:31:47AM -0500, Christoph Hellwig wrote:
> Spliting the task for a VFS-induced inode flush into two functions doesn't

Splitting

> make any sense, so merge the two functions dealing with it.
.....
> +		error = xfs_iflush(ip, XFS_IFLUSH_ASYNC_NOBLOCK);
>  	}
> -	error = xfs_inode_flush(ip, flags);
>  
> -out_error:
> + out_unlock:
> +	xfs_iunlock(ip, XFS_ILOCK_SHARED);
> + out:

Don't need spaces before the labels.

Otherwise looks OK.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

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

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

* Re: [PATCH 00/17] 2.6.30 queue
  2009-01-26  7:31 [PATCH 00/17] 2.6.30 queue Christoph Hellwig
                   ` (16 preceding siblings ...)
  2009-01-26  7:31 ` [PATCH 17/17] xfs: sanitize qh_lock wrappers Christoph Hellwig
@ 2009-02-04 19:37 ` Christoph Hellwig
  2009-02-08 21:12   ` Christoph Hellwig
  17 siblings, 1 reply; 50+ messages in thread
From: Christoph Hellwig @ 2009-02-04 19:37 UTC (permalink / raw)
  To: xfs

On Mon, Jan 26, 2009 at 02:31:36AM -0500, Christoph Hellwig wrote:
> Various misc small fixes and cleanups for 2.6.30.

All the patches that have been reviewed are not available to pull from

	git://git.kernel.org/pub/scm/fs/xfs/xfs.git

still waitinf for more reviews..

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

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

* Re: [PATCH 09/17] xfs: cleanup xfs_find_handle
  2009-01-26  7:31 ` [PATCH 09/17] xfs: cleanup xfs_find_handle Christoph Hellwig
@ 2009-02-06  5:20   ` Felix Blyakher
  2009-02-06  7:17     ` Christoph Hellwig
  0 siblings, 1 reply; 50+ messages in thread
From: Felix Blyakher @ 2009-02-06  5:20 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs


On Jan 26, 2009, at 1:31 AM, Christoph Hellwig wrote:

> Remove the superflous igrab by keeping a reference on the path/file  
> all the
> time and clean up various bits of surrounding code.
>
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
>
> Index: xfs/fs/xfs/linux-2.6/xfs_ioctl.c
> ===================================================================
> --- xfs.orig/fs/xfs/linux-2.6/xfs_ioctl.c	2009-01-21  
> 21:03:27.828295110 +0100
> +++ xfs/fs/xfs/linux-2.6/xfs_ioctl.c	2009-01-24 18:41:24.547427865  
> +0100
> @@ -78,92 +78,74 @@ xfs_find_handle(
>  	int			hsize;
>  	xfs_handle_t		handle;
>  	struct inode		*inode;
> +	struct file		*file = NULL;
> +	struct path		path;
> +	int			error;
> +	struct xfs_inode	*ip;
>
> -	memset((char *)&handle, 0, sizeof(handle));
> -
> -	switch (cmd) {
> -	case XFS_IOC_PATH_TO_FSHANDLE:
> -	case XFS_IOC_PATH_TO_HANDLE: {
> -		struct path path;
> -		int error = user_lpath((const char __user *)hreq->path, &path);
> +	if (cmd == XFS_IOC_FD_TO_HANDLE) {
> +		file = fget(hreq->fd);
> +		if (!file)
> +			return -EBADF;
> +		inode = file->f_path.dentry->d_inode;
> +	} else {

Do we want to verify here that cmd is either XFS_IOC_PATH_TO_FSHANDLE
or XFS_IOC_PATH_TO_HANDLE ...

> +		error = user_lpath((const char __user *)hreq->path, &path);
>  		if (error)
>  			return error;
> -
> -		ASSERT(path.dentry);
> -		ASSERT(path.dentry->d_inode);
> -		inode = igrab(path.dentry->d_inode);
> -		path_put(&path);
> -		break;
> +		inode = path.dentry->d_inode;
>  	}

... and fail with EINVAL if cmd is neither.

> +	ip = XFS_I(inode);
>
> -	case XFS_IOC_FD_TO_HANDLE: {
> -		struct file	*file;
> -
> -		file = fget(hreq->fd);
> -		if (!file)
> -		    return -EBADF;
> +	/*
> +	 * We can only generate handles for inodes residing on a XFS  
> filesystem,
> +	 * and only for regular files, directories or symbolic links.
> +	 */
> +	error = -EINVAL;
> +	if (inode->i_sb->s_magic != XFS_SB_MAGIC)
> +		goto out_put;
>
> -		ASSERT(file->f_path.dentry);
> -		ASSERT(file->f_path.dentry->d_inode);
> -		inode = igrab(file->f_path.dentry->d_inode);
> -		fput(file);
> -		break;
> -	}
> +	error = -EBADF;
> +	if (!S_ISREG(inode->i_mode) &&
> +	    !S_ISDIR(inode->i_mode) &&
> +	    !S_ISLNK(inode->i_mode))
> +		goto out_put;
>
> -	default:
> -		ASSERT(0);
> -		return -XFS_ERROR(EINVAL);
> -	}
>
> -	if (inode->i_sb->s_magic != XFS_SB_MAGIC) {
> -		/* we're not in XFS anymore, Toto */
> -		iput(inode);
> -		return -XFS_ERROR(EINVAL);
> -	}
> +	memcpy(&handle.ha_fsid, ip->i_mount->m_fixedfsid, sizeof 
> (xfs_fsid_t));
>
> -	switch (inode->i_mode & S_IFMT) {
> -	case S_IFREG:
> -	case S_IFDIR:
> -	case S_IFLNK:
> -		break;
> -	default:
> -		iput(inode);
> -		return -XFS_ERROR(EBADF);
> -	}
> -
> -	/* now we can grab the fsid */
> -	memcpy(&handle.ha_fsid, XFS_I(inode)->i_mount->m_fixedfsid,
> -			sizeof(xfs_fsid_t));
> -	hsize = sizeof(xfs_fsid_t);
> -
> -	if (cmd != XFS_IOC_PATH_TO_FSHANDLE) {
> -		xfs_inode_t	*ip = XFS_I(inode);
> +	if (cmd == XFS_IOC_PATH_TO_FSHANDLE) {
> +		/*
> +		 * This handle only contains an fsid, zero the rest.
> +		 */
> +		memset(&handle.ha_fid, 0, sizeof(handle.ha_fid));
> +		hsize = sizeof(xfs_fsid_t);
> +	} else {
>  		int		lock_mode;
>
> -		/* need to get access to the xfs_inode to read the generation */
>  		lock_mode = xfs_ilock_map_shared(ip);
> -
> -		/* fill in fid section of handle from inode */
>  		handle.ha_fid.fid_len = sizeof(xfs_fid_t) -
>  					sizeof(handle.ha_fid.fid_len);
>  		handle.ha_fid.fid_pad = 0;
>  		handle.ha_fid.fid_gen = ip->i_d.di_gen;
>  		handle.ha_fid.fid_ino = ip->i_ino;
> -
>  		xfs_iunlock_map_shared(ip, lock_mode);
>
>  		hsize = XFS_HSIZE(handle);
>  	}
>
> -	/* now copy our handle into the user buffer & write out the size */
> +	error = -EFAULT;
>  	if (copy_to_user(hreq->ohandle, &handle, hsize) ||
> -	    copy_to_user(hreq->ohandlen, &hsize, sizeof(__s32))) {
> -		iput(inode);
> -		return -XFS_ERROR(EFAULT);
> -	}
> +	    copy_to_user(hreq->ohandlen, &hsize, sizeof(__s32)))
> +		goto out_put;
>
> -	iput(inode);
> -	return 0;
> +	error = 0;
> +
> + out_put:
> +	if (cmd == XFS_IOC_FD_TO_HANDLE)
> +		fput(file);
> +	else
> +		path_put(&path);
> +	return error;
>  }
>
>  /*
>
> _______________________________________________
> 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] 50+ messages in thread

* Re: [PATCH 09/17] xfs: cleanup xfs_find_handle
  2009-02-06  5:20   ` Felix Blyakher
@ 2009-02-06  7:17     ` Christoph Hellwig
  2009-02-06 20:31       ` Felix Blyakher
  0 siblings, 1 reply; 50+ messages in thread
From: Christoph Hellwig @ 2009-02-06  7:17 UTC (permalink / raw)
  To: Felix Blyakher; +Cc: Christoph Hellwig, xfs

On Thu, Feb 05, 2009 at 11:20:22PM -0600, Felix Blyakher wrote:
> Do we want to verify here that cmd is either XFS_IOC_PATH_TO_FSHANDLE
> or XFS_IOC_PATH_TO_HANDLE ...

It's called in a single place for just these three subcases, so having
another verification here doesn't seem juseful.

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

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

* Re: [PATCH 09/17] xfs: cleanup xfs_find_handle
  2009-02-06  7:17     ` Christoph Hellwig
@ 2009-02-06 20:31       ` Felix Blyakher
  0 siblings, 0 replies; 50+ messages in thread
From: Felix Blyakher @ 2009-02-06 20:31 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs


On Feb 6, 2009, at 1:17 AM, Christoph Hellwig wrote:

> On Thu, Feb 05, 2009 at 11:20:22PM -0600, Felix Blyakher wrote:
>> Do we want to verify here that cmd is either XFS_IOC_PATH_TO_FSHANDLE
>> or XFS_IOC_PATH_TO_HANDLE ...
>
> It's called in a single place for just these three subcases, so having
> another verification here doesn't seem juseful.

Yes, I know it's called from xfs_file_ioctl() only, and only
with the those three commands, but I prefer the defensive code,
which would flag something unexpected rather then going the
wrong way.
Though, in this case, I'm not too much set on the "defensive"
side :)

Reviewed-by: Felix Blyakher <felixb@sgi.com>

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

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

* Re: [PATCH 14/17] xfs: remove the unused XFS_QMOPT_DQLOCK flag
  2009-01-26  7:31 ` [PATCH 14/17] xfs: remove the unused XFS_QMOPT_DQLOCK flag Christoph Hellwig
@ 2009-02-08  0:35   ` Felix Blyakher
  0 siblings, 0 replies; 50+ messages in thread
From: Felix Blyakher @ 2009-02-08  0:35 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs


On Jan 26, 2009, at 1:31 AM, Christoph Hellwig wrote:

> The XFS_QMOPT_DQLOCK flag introduces major complexity in the quota  
> subsystem
> but isn't actually used anywhere.  So remove it and all the hazzles it
> introduces.
>
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Felix Blyakher <felixb@sgi.com>

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

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

* Re: [PATCH 00/17] 2.6.30 queue
  2009-02-04 19:37 ` [PATCH 00/17] 2.6.30 queue Christoph Hellwig
@ 2009-02-08 21:12   ` Christoph Hellwig
  0 siblings, 0 replies; 50+ messages in thread
From: Christoph Hellwig @ 2009-02-08 21:12 UTC (permalink / raw)
  To: xfs

On Wed, Feb 04, 2009 at 02:37:06PM -0500, Christoph Hellwig wrote:
> On Mon, Jan 26, 2009 at 02:31:36AM -0500, Christoph Hellwig wrote:
> > Various misc small fixes and cleanups for 2.6.30.
> 
> All the patches that have been reviewed are not available to pull from
> 
> 	git://git.kernel.org/pub/scm/fs/xfs/xfs.git

I've added the two recently reviewed patch to that repoistory now.

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

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

* Re: [PATCH 06/17] xfs: remove iclog calculation special cases
  2009-01-26  7:31 ` [PATCH 06/17] xfs: remove iclog calculation special cases Christoph Hellwig
@ 2009-02-09  2:15   ` Dave Chinner
  0 siblings, 0 replies; 50+ messages in thread
From: Dave Chinner @ 2009-02-09  2:15 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

On Mon, Jan 26, 2009 at 02:31:42AM -0500, Christoph Hellwig wrote:
> Our default has been to always use 8 32KB log buffers for a while now, so
> remove the special casing for larger block size filesystem to use the same
> or even lower number of buffers.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>


Reviewed-by: Dave Chinner <david@fromorbit.com>

-- 
Dave Chinner
david@fromorbit.com

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

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

* Re: [PATCH 07/17] xfs: remove superflous inobt macros
  2009-01-26  7:31 ` [PATCH 07/17] xfs: remove superflous inobt macros Christoph Hellwig
@ 2009-02-09  2:16   ` Dave Chinner
  0 siblings, 0 replies; 50+ messages in thread
From: Dave Chinner @ 2009-02-09  2:16 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

On Mon, Jan 26, 2009 at 02:31:43AM -0500, Christoph Hellwig wrote:
> xfs_ialloc_btree.h has a a cuple of macros that only obsfucate the code
> but don't provide any abstraction benefits.  This patches removes those
> and cleans up the reamaining defintions up a little.
> 
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Dave Chinner <david@fromorbit.com>

-- 
Dave Chinner
david@fromorbit.com

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

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

* Re: [PATCH 08/17] xfs: remove uchar_t/ushort_t/uint_t/ulong_t types
  2009-01-26  7:31 ` [PATCH 08/17] xfs: remove uchar_t/ushort_t/uint_t/ulong_t types Christoph Hellwig
@ 2009-02-09  2:18   ` Dave Chinner
  0 siblings, 0 replies; 50+ messages in thread
From: Dave Chinner @ 2009-02-09  2:18 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

On Mon, Jan 26, 2009 at 02:31:44AM -0500, Christoph Hellwig wrote:
> Just another set of types obsfucating the code, remove them.
> 
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Dave Chinner <david@fromorbit.com>

-- 
Dave Chinner
david@fromorbit.com

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

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

* Re: [PATCH 12/17] xfs: merge xfs_mkdir into xfs_create
  2009-01-26  7:31 ` [PATCH 12/17] xfs: merge xfs_mkdir into xfs_create Christoph Hellwig
@ 2009-02-09  2:28   ` Dave Chinner
  0 siblings, 0 replies; 50+ messages in thread
From: Dave Chinner @ 2009-02-09  2:28 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

On Mon, Jan 26, 2009 at 02:31:48AM -0500, Christoph Hellwig wrote:
> xfs_create and xfs_mkdir only have minor differences, so merge both of them
> into a sigle function.  While we're at it also make the error handling code
> more straight-forward.
> 
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Dave Chinner <david@fromorbit.com>

-- 
Dave Chinner
david@fromorbit.com

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

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

* Re: [PATCH 13/17] xfs: get rid of indirections in the quotaops implementation
  2009-01-26  7:31 ` [PATCH 13/17] xfs: get rid of indirections in the quotaops implementation Christoph Hellwig
@ 2009-02-09  2:41   ` Dave Chinner
  2009-02-09  7:46     ` Christoph Hellwig
  2009-05-13  8:11   ` Christoph Hellwig
  1 sibling, 1 reply; 50+ messages in thread
From: Dave Chinner @ 2009-02-09  2:41 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

On Mon, Jan 26, 2009 at 02:31:49AM -0500, Christoph Hellwig wrote:
> Currently we call from the nicely abstracted linux quotaops into a ugly
> multiplexer just to split the calls out at the same boundary again.
> Rewrite the quota ops handling to remove that obfucation.
> 
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
.....
> +STATIC int
> +xfs_fs_get_xstate(
> +	struct super_block	*sb,
> +	struct fs_quota_stat	*fqs)
> +{
> +	struct xfs_mount	*mp = XFS_M(sb);
> +
> +	if (!XFS_IS_QUOTA_RUNNING(mp))
> +		return -ENOSYS;
> +	return xfs_qm_scall_getqstat(mp, fqs);

The return of xfs_qm_scall_getqstat() needs to be negated.

> +STATIC int
> +xfs_fs_set_xquota(
> +	struct super_block	*sb,
> +	int			type,
> +	qid_t			id,
> +	struct fs_disk_quota	*fdq)
> +{
> +	struct xfs_mount	*mp = XFS_M(sb);
> +
> +	if (sb->s_flags & MS_RDONLY)
> +		return -EROFS;
> +	if (!XFS_IS_QUOTA_RUNNING(mp))
> +		return -ENOSYS;
> +	if (!XFS_IS_QUOTA_ON(mp))
> +		return -ESRCH;
> +	if (!capable(CAP_SYS_ADMIN))
> +		return -EPERM;
> +
> +	return xfs_qm_scall_setqlim(mp, id, xfs_quota_type(type), fdq);

That should be negated as well.

Other than those two little things, looks good.

Reviewed-by: Dave Chinner <david@fromorbit.com>

-- 
Dave Chinner
david@fromorbit.com

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

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

* Re: [PATCH 15/17] xfs: remove XFS_QM_LOCK/XFS_QM_UNLOCK/XFS_QM_HOLD/XFS_QM_RELE
  2009-01-26  7:31 ` [PATCH 15/17] xfs: remove XFS_QM_LOCK/XFS_QM_UNLOCK/XFS_QM_HOLD/XFS_QM_RELE Christoph Hellwig
@ 2009-02-09  2:42   ` Dave Chinner
  0 siblings, 0 replies; 50+ messages in thread
From: Dave Chinner @ 2009-02-09  2:42 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

On Mon, Jan 26, 2009 at 02:31:51AM -0500, Christoph Hellwig wrote:
> Remove these macros which only obsfucated the code in rather nast ways.
> 
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Dave Chinner <david@fromorbit.com>

-- 
Dave Chinner
david@fromorbit.com

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

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

* Re: [PATCH 16/17] xfs: use mutex_is_locked in XFS_DQ_IS_LOCKED
  2009-01-26  7:31 ` [PATCH 16/17] xfs: use mutex_is_locked in XFS_DQ_IS_LOCKED Christoph Hellwig
@ 2009-02-09  2:42   ` Dave Chinner
  0 siblings, 0 replies; 50+ messages in thread
From: Dave Chinner @ 2009-02-09  2:42 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

On Mon, Jan 26, 2009 at 02:31:52AM -0500, Christoph Hellwig wrote:
> Now that we have a helper to test if a mutex is held use it instead of our
> own little hacks.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Dave Chinner <david@fromorbit.com>

-- 
Dave Chinner
david@fromorbit.com

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

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

* Re: [PATCH 17/17] xfs: sanitize qh_lock wrappers
  2009-01-26  7:31 ` [PATCH 17/17] xfs: sanitize qh_lock wrappers Christoph Hellwig
@ 2009-02-09  2:45   ` Dave Chinner
  0 siblings, 0 replies; 50+ messages in thread
From: Dave Chinner @ 2009-02-09  2:45 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

On Mon, Jan 26, 2009 at 02:31:53AM -0500, Christoph Hellwig wrote:
> Get rid of various obsfucating wrappers for accessing the quota hash lock,
> we only keep the accessors for accessing the mplist and freelist locks as
> they encode a multi-level datastructure walk.  But make sure all of them
> are defined in the same way as simple macros.
> 
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Dave Chinner <david@fromorbit.com>

-- 
Dave Chinner
david@fromorbit.com

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

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

* Re: [PATCH 13/17] xfs: get rid of indirections in the quotaops implementation
  2009-02-09  2:41   ` Dave Chinner
@ 2009-02-09  7:46     ` Christoph Hellwig
  0 siblings, 0 replies; 50+ messages in thread
From: Christoph Hellwig @ 2009-02-09  7:46 UTC (permalink / raw)
  To: Christoph Hellwig, xfs

On Mon, Feb 09, 2009 at 01:41:15PM +1100, Dave Chinner wrote:
> > +STATIC int
> > +xfs_fs_get_xstate(
> > +	struct super_block	*sb,
> > +	struct fs_quota_stat	*fqs)
> > +{
> > +	struct xfs_mount	*mp = XFS_M(sb);
> > +
> > +	if (!XFS_IS_QUOTA_RUNNING(mp))
> > +		return -ENOSYS;
> > +	return xfs_qm_scall_getqstat(mp, fqs);
> 
> The return of xfs_qm_scall_getqstat() needs to be negated.

Currently it only ever returns 0.  But I agree, if this ever returns
an error it would be a positive one, so I added the inversion.

> > +	return xfs_qm_scall_setqlim(mp, id, xfs_quota_type(type), fdq);
> 
> That should be negated as well.

But this one can already return a positive error, so it's definitively
needed.

Thanks, I've commited the updated version.

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

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

* Re: [PATCH 11/17] xfs: merge xfs_inode_flush into xfs_fs_write_inode
  2009-01-26  7:31 ` [PATCH 11/17] xfs: merge xfs_inode_flush into xfs_fs_write_inode Christoph Hellwig
  2009-01-27 17:37   ` Felix Blyakher
  2009-02-01  0:54   ` Dave Chinner
@ 2009-02-15  6:42   ` Dave Chinner
  2009-02-15 20:13     ` Christoph Hellwig
  2 siblings, 1 reply; 50+ messages in thread
From: Dave Chinner @ 2009-02-15  6:42 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

On Mon, Jan 26, 2009 at 02:31:47AM -0500, Christoph Hellwig wrote:
> Spliting the task for a VFS-induced inode flush into two functions doesn't
> make any sense, so merge the two functions dealing with it.

I just realised that we should really be calling xfs_inode_flush() from
xfs_sync_inodes_ag() - it open codes xfs_inode_flush() and doesn't
have any of the non-blocking flush code for async flushes...

Thoughts?

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

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

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

* Re: [PATCH 11/17] xfs: merge xfs_inode_flush into xfs_fs_write_inode
  2009-02-15  6:42   ` Dave Chinner
@ 2009-02-15 20:13     ` Christoph Hellwig
  2009-02-16  3:06       ` Dave Chinner
  0 siblings, 1 reply; 50+ messages in thread
From: Christoph Hellwig @ 2009-02-15 20:13 UTC (permalink / raw)
  To: Christoph Hellwig, xfs

On Sun, Feb 15, 2009 at 05:42:25PM +1100, Dave Chinner wrote:
> On Mon, Jan 26, 2009 at 02:31:47AM -0500, Christoph Hellwig wrote:
> > Spliting the task for a VFS-induced inode flush into two functions doesn't
> > make any sense, so merge the two functions dealing with it.
> 
> I just realised that we should really be calling xfs_inode_flush() from
> xfs_sync_inodes_ag() - it open codes xfs_inode_flush() and doesn't
> have any of the non-blocking flush code for async flushes...

Given that we'll hopefully do batched flushes driven directly from
the sync code re-introducing the helper now just to rip it out again
a little later doesn't seem to useful to me.  And the calling
conventions for xfs_inode_flush were rather odd to start with anyway.

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

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

* Re: [PATCH 11/17] xfs: merge xfs_inode_flush into xfs_fs_write_inode
  2009-02-15 20:13     ` Christoph Hellwig
@ 2009-02-16  3:06       ` Dave Chinner
  0 siblings, 0 replies; 50+ messages in thread
From: Dave Chinner @ 2009-02-16  3:06 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

On Sun, Feb 15, 2009 at 03:13:21PM -0500, Christoph Hellwig wrote:
> On Sun, Feb 15, 2009 at 05:42:25PM +1100, Dave Chinner wrote:
> > On Mon, Jan 26, 2009 at 02:31:47AM -0500, Christoph Hellwig wrote:
> > > Spliting the task for a VFS-induced inode flush into two functions doesn't
> > > make any sense, so merge the two functions dealing with it.
> > 
> > I just realised that we should really be calling xfs_inode_flush() from
> > xfs_sync_inodes_ag() - it open codes xfs_inode_flush() and doesn't
> > have any of the non-blocking flush code for async flushes...
> 
> Given that we'll hopefully do batched flushes driven directly from
> the sync code re-introducing the helper now just to rip it out again
> a little later doesn't seem to useful to me.  And the calling
> conventions for xfs_inode_flush were rather odd to start with anyway.

Well, ok. I'll just duplicate xfs_fs_write_inode() for the sync code
right now, then.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

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

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

* Re: [PATCH 03/17] xfs: cleanup handling in xfs_swap_extents
  2009-01-26  7:31 ` [PATCH 03/17] xfs: cleanup handling in xfs_swap_extents Christoph Hellwig
  2009-01-26  7:55   ` Christoph Hellwig
  2009-01-26 22:13   ` [PATCH 03/17] xfs: cleanup " Felix Blyakher
@ 2009-05-08  0:45   ` Eric Sandeen
  2 siblings, 0 replies; 50+ messages in thread
From: Eric Sandeen @ 2009-05-08  0:45 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Alexander Beregalov, xfs

Christoph Hellwig wrote:

> Use multiple lables for proper error unwinding and get rid of some now
> superflous variables.
>
>
> Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
> Reviewed-by: Christoph Hellwig <hch@lst.de>

Problem in this patch, I think, getting hangs on x86 fsr...

> Index: xfs/fs/xfs/xfs_dfrag.c
> ===================================================================
> --- xfs.orig/fs/xfs/xfs_dfrag.c	2008-12-19 15:02:54.003908425 +0100
> +++ xfs/fs/xfs/xfs_dfrag.c	2008-12-22 15:59:55.013247371 +0100
<snip>
> @@ -352,19 +344,19 @@ xfs_swap_extents(
>  	 * If this is a synchronous mount, make sure that the
>  	 * transaction goes to disk before returning to the user.
>  	 */
> -	if (mp->m_flags & XFS_MOUNT_WSYNC) {
> +	if (mp->m_flags & XFS_MOUNT_WSYNC)
>  		xfs_trans_set_sync(tp);
> -	}
>  
>  	error = xfs_trans_commit(tp, XFS_TRANS_SWAPEXT);
> -	locked = 0;

old code said "unlocked" here thanks to the trans commit ...

> - error0:
> -	if (locked) {
> -		xfs_iunlock(ip,  lock_flags);
> -		xfs_iunlock(tip, lock_flags);
> -	}
and so we wouldn't unlock again ...
> -	if (tempifp != NULL)
> -		kmem_free(tempifp);
> +out_unlock:
> +	xfs_iunlock(ip,  XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);
> +	xfs_iunlock(tip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);

But now we do it unconditionally, and ruh-roh.

> +out:
> +	kmem_free(tempifp);
>  	return error;
> +
> +out_trans_cancel:
> +	xfs_trans_cancel(tp, 0);
> +	goto out_unlock;
>  }

Is this too ugly a fix?

XFS: Fix double unlock of inodes in xfs_swap_extents()

commit ef8f7fc549bf345d92f396f5aa7b152b4969cbf7 had an error
where we would try to re-unlock the inodes after they had been
committed in the transaction; this double unlock caused a

=====================================
[ BUG: bad unlock balance detected! ]
-------------------------------------
xfs_fsr/1459 is trying to release lock (&(&ip->i_iolock)->mr_lock) at:
[<e248dedb>] xfs_iunlock+0x2c/0x92 [xfs]
but there are no more locks to release!

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
---

Index: linux-2.6/fs/xfs/xfs_dfrag.c
===================================================================
--- linux-2.6.orig/fs/xfs/xfs_dfrag.c
+++ linux-2.6/fs/xfs/xfs_dfrag.c
@@ -347,13 +347,15 @@ xfs_swap_extents(
 
 	error = xfs_trans_commit(tp, XFS_TRANS_SWAPEXT);
 
-out_unlock:
-	xfs_iunlock(ip,  XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);
-	xfs_iunlock(tip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);
 out:
 	kmem_free(tempifp);
 	return error;
 
+out_unlock:
+	xfs_iunlock(ip,  XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);
+	xfs_iunlock(tip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);
+	goto out;
+
 out_trans_cancel:
 	xfs_trans_cancel(tp, 0);
 	goto out_unlock;


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

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

* Re: [PATCH 13/17] xfs: get rid of indirections in the quotaops implementation
  2009-01-26  7:31 ` [PATCH 13/17] xfs: get rid of indirections in the quotaops implementation Christoph Hellwig
  2009-02-09  2:41   ` Dave Chinner
@ 2009-05-13  8:11   ` Christoph Hellwig
  1 sibling, 0 replies; 50+ messages in thread
From: Christoph Hellwig @ 2009-05-13  8:11 UTC (permalink / raw)
  To: xfs

On Mon, Jan 26, 2009 at 02:31:49AM -0500, Christoph Hellwig wrote:
> Currently we call from the nicely abstracted linux quotaops into a ugly
> multiplexer just to split the calls out at the same boundary again.
> Rewrite the quota ops handling to remove that obfucation.

What's the chance of getting a full review for this one after almost
four month?

> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> 
> Index: xfs/fs/xfs/linux-2.6/xfs_super.c
> ===================================================================
> --- xfs.orig/fs/xfs/linux-2.6/xfs_super.c	2009-01-24 18:50:29.764553115 +0100
> +++ xfs/fs/xfs/linux-2.6/xfs_super.c	2009-01-24 18:52:52.180428678 +0100
> @@ -68,7 +68,6 @@
>  #include <linux/freezer.h>
>  #include <linux/parser.h>
>  
> -static struct quotactl_ops xfs_quotactl_operations;
>  static struct super_operations xfs_super_operations;
>  static kmem_zone_t *xfs_ioend_zone;
>  mempool_t *xfs_ioend_pool;
> @@ -1333,57 +1332,6 @@ xfs_fs_show_options(
>  	return -xfs_showargs(XFS_M(mnt->mnt_sb), m);
>  }
>  
> -STATIC int
> -xfs_fs_quotasync(
> -	struct super_block	*sb,
> -	int			type)
> -{
> -	return -XFS_QM_QUOTACTL(XFS_M(sb), Q_XQUOTASYNC, 0, NULL);
> -}
> -
> -STATIC int
> -xfs_fs_getxstate(
> -	struct super_block	*sb,
> -	struct fs_quota_stat	*fqs)
> -{
> -	return -XFS_QM_QUOTACTL(XFS_M(sb), Q_XGETQSTAT, 0, (caddr_t)fqs);
> -}
> -
> -STATIC int
> -xfs_fs_setxstate(
> -	struct super_block	*sb,
> -	unsigned int		flags,
> -	int			op)
> -{
> -	return -XFS_QM_QUOTACTL(XFS_M(sb), op, 0, (caddr_t)&flags);
> -}
> -
> -STATIC int
> -xfs_fs_getxquota(
> -	struct super_block	*sb,
> -	int			type,
> -	qid_t			id,
> -	struct fs_disk_quota	*fdq)
> -{
> -	return -XFS_QM_QUOTACTL(XFS_M(sb),
> -				 (type == USRQUOTA) ? Q_XGETQUOTA :
> -				  ((type == GRPQUOTA) ? Q_XGETGQUOTA :
> -				   Q_XGETPQUOTA), id, (caddr_t)fdq);
> -}
> -
> -STATIC int
> -xfs_fs_setxquota(
> -	struct super_block	*sb,
> -	int			type,
> -	qid_t			id,
> -	struct fs_disk_quota	*fdq)
> -{
> -	return -XFS_QM_QUOTACTL(XFS_M(sb),
> -				 (type == USRQUOTA) ? Q_XSETQLIM :
> -				  ((type == GRPQUOTA) ? Q_XSETGQLIM :
> -				   Q_XSETPQLIM), id, (caddr_t)fdq);
> -}
> -
>  /*
>   * This function fills in xfs_mount_t fields based on mount args.
>   * Note: the superblock _has_ now been read in.
> @@ -1466,7 +1414,9 @@ xfs_fs_fill_super(
>  	sb_min_blocksize(sb, BBSIZE);
>  	sb->s_xattr = xfs_xattr_handlers;
>  	sb->s_export_op = &xfs_export_operations;
> +#ifdef CONFIG_XFS_QUOTA
>  	sb->s_qcop = &xfs_quotactl_operations;
> +#endif
>  	sb->s_op = &xfs_super_operations;
>  
>  	error = xfs_dmops_get(mp);
> @@ -1609,14 +1559,6 @@ static struct super_operations xfs_super
>  	.show_options		= xfs_fs_show_options,
>  };
>  
> -static struct quotactl_ops xfs_quotactl_operations = {
> -	.quota_sync		= xfs_fs_quotasync,
> -	.get_xstate		= xfs_fs_getxstate,
> -	.set_xstate		= xfs_fs_setxstate,
> -	.get_xquota		= xfs_fs_getxquota,
> -	.set_xquota		= xfs_fs_setxquota,
> -};
> -
>  static struct file_system_type xfs_fs_type = {
>  	.owner			= THIS_MODULE,
>  	.name			= "xfs",
> Index: xfs/fs/xfs/Makefile
> ===================================================================
> --- xfs.orig/fs/xfs/Makefile	2009-01-21 21:03:27.824295159 +0100
> +++ xfs/fs/xfs/Makefile	2009-01-24 18:52:52.184428210 +0100
> @@ -33,6 +33,7 @@ xfs-$(CONFIG_XFS_QUOTA)		+= $(addprefix 
>  				   xfs_qm_syscalls.o \
>  				   xfs_qm_bhv.o \
>  				   xfs_qm.o)
> +xfs-$(CONFIG_XFS_QUOTA)		+= linux-2.6/xfs_quotaops.o
>  
>  ifeq ($(CONFIG_XFS_QUOTA),y)
>  xfs-$(CONFIG_PROC_FS)		+= quota/xfs_qm_stats.o
> Index: xfs/fs/xfs/linux-2.6/xfs_linux.h
> ===================================================================
> --- xfs.orig/fs/xfs/linux-2.6/xfs_linux.h	2009-01-21 21:03:27.828295110 +0100
> +++ xfs/fs/xfs/linux-2.6/xfs_linux.h	2009-01-24 18:52:52.191428473 +0100
> @@ -147,17 +147,6 @@
>  #define SYNCHRONIZE()	barrier()
>  #define __return_address __builtin_return_address(0)
>  
> -/*
> - * IRIX (BSD) quotactl makes use of separate commands for user/group,
> - * whereas on Linux the syscall encodes this information into the cmd
> - * field (see the QCMD macro in quota.h).  These macros help keep the
> - * code portable - they are not visible from the syscall interface.
> - */
> -#define Q_XSETGQLIM	XQM_CMD(8)	/* set groups disk limits */
> -#define Q_XGETGQUOTA	XQM_CMD(9)	/* get groups disk limits */
> -#define Q_XSETPQLIM	XQM_CMD(10)	/* set projects disk limits */
> -#define Q_XGETPQUOTA	XQM_CMD(11)	/* get projects disk limits */
> -
>  #define dfltprid	0
>  #define MAXPATHLEN	1024
>  
> Index: xfs/fs/xfs/linux-2.6/xfs_quotaops.c
> ===================================================================
> --- /dev/null	1970-01-01 00:00:00.000000000 +0000
> +++ xfs/fs/xfs/linux-2.6/xfs_quotaops.c	2009-01-24 18:52:52.192428740 +0100
> @@ -0,0 +1,157 @@
> +/*
> + * Copyright (c) 2008, Christoph Hellwig
> + * All Rights Reserved.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it would be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write the Free Software Foundation,
> + * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> + */
> +#include "xfs.h"
> +#include "xfs_dmapi.h"
> +#include "xfs_sb.h"
> +#include "xfs_inum.h"
> +#include "xfs_ag.h"
> +#include "xfs_mount.h"
> +#include "xfs_quota.h"
> +#include "xfs_log.h"
> +#include "xfs_trans.h"
> +#include "xfs_bmap_btree.h"
> +#include "xfs_inode.h"
> +#include "quota/xfs_qm.h"
> +#include <linux/quota.h>
> +
> +
> +STATIC int
> +xfs_quota_type(int type)
> +{
> +	switch (type) {
> +	case USRQUOTA:
> +		return XFS_DQ_USER;
> +	case GRPQUOTA:
> +		return XFS_DQ_GROUP;
> +	default:
> +		return XFS_DQ_PROJ;
> +	}
> +}
> +
> +STATIC int
> +xfs_fs_quota_sync(
> +	struct super_block	*sb,
> +	int			type)
> +{
> +	struct xfs_mount	*mp = XFS_M(sb);
> +
> +	if (!XFS_IS_QUOTA_RUNNING(mp))
> +		return -ENOSYS;
> +	return -xfs_sync_inodes(mp, SYNC_DELWRI);
> +}
> +
> +STATIC int
> +xfs_fs_get_xstate(
> +	struct super_block	*sb,
> +	struct fs_quota_stat	*fqs)
> +{
> +	struct xfs_mount	*mp = XFS_M(sb);
> +
> +	if (!XFS_IS_QUOTA_RUNNING(mp))
> +		return -ENOSYS;
> +	return xfs_qm_scall_getqstat(mp, fqs);
> +}
> +
> +STATIC int
> +xfs_fs_set_xstate(
> +	struct super_block	*sb,
> +	unsigned int		uflags,
> +	int			op)
> +{
> +	struct xfs_mount	*mp = XFS_M(sb);
> +	unsigned int		flags = 0;
> +
> +	if (sb->s_flags & MS_RDONLY)
> +		return -EROFS;
> +	if (!XFS_IS_QUOTA_RUNNING(mp))
> +		return -ENOSYS;
> +	if (!capable(CAP_SYS_ADMIN))
> +		return -EPERM;
> +
> +	if (uflags & XFS_QUOTA_UDQ_ACCT)
> +		flags |= XFS_UQUOTA_ACCT;
> +	if (uflags & XFS_QUOTA_PDQ_ACCT)
> +		flags |= XFS_PQUOTA_ACCT;
> +	if (uflags & XFS_QUOTA_GDQ_ACCT)
> +		flags |= XFS_GQUOTA_ACCT;
> +	if (uflags & XFS_QUOTA_UDQ_ENFD)
> +		flags |= XFS_UQUOTA_ENFD;
> +	if (uflags & (XFS_QUOTA_PDQ_ENFD|XFS_QUOTA_GDQ_ENFD))
> +		flags |= XFS_OQUOTA_ENFD;
> +
> +	switch (op) {
> +	case Q_XQUOTAON:
> +		return -xfs_qm_scall_quotaon(mp, flags);
> +	case Q_XQUOTAOFF:
> +		if (!XFS_IS_QUOTA_ON(mp))
> +			return -EINVAL;
> +		return -xfs_qm_scall_quotaoff(mp, flags);
> +	case Q_XQUOTARM:
> +		if (XFS_IS_QUOTA_ON(mp))
> +			return -EINVAL;
> +		return -xfs_qm_scall_trunc_qfiles(mp, flags);
> +	}
> +
> +	return -EINVAL;
> +}
> +
> +STATIC int
> +xfs_fs_get_xquota(
> +	struct super_block	*sb,
> +	int			type,
> +	qid_t			id,
> +	struct fs_disk_quota	*fdq)
> +{
> +	struct xfs_mount	*mp = XFS_M(sb);
> +
> +	if (!XFS_IS_QUOTA_RUNNING(mp))
> +		return -ENOSYS;
> +	if (!XFS_IS_QUOTA_ON(mp))
> +		return -ESRCH;
> +
> +	return -xfs_qm_scall_getquota(mp, id, xfs_quota_type(type), fdq);
> +}
> +
> +STATIC int
> +xfs_fs_set_xquota(
> +	struct super_block	*sb,
> +	int			type,
> +	qid_t			id,
> +	struct fs_disk_quota	*fdq)
> +{
> +	struct xfs_mount	*mp = XFS_M(sb);
> +
> +	if (sb->s_flags & MS_RDONLY)
> +		return -EROFS;
> +	if (!XFS_IS_QUOTA_RUNNING(mp))
> +		return -ENOSYS;
> +	if (!XFS_IS_QUOTA_ON(mp))
> +		return -ESRCH;
> +	if (!capable(CAP_SYS_ADMIN))
> +		return -EPERM;
> +
> +	return xfs_qm_scall_setqlim(mp, id, xfs_quota_type(type), fdq);
> +}
> +
> +struct quotactl_ops xfs_quotactl_operations = {
> +	.quota_sync		= xfs_fs_quota_sync,
> +	.get_xstate		= xfs_fs_get_xstate,
> +	.set_xstate		= xfs_fs_set_xstate,
> +	.get_xquota		= xfs_fs_get_xquota,
> +	.set_xquota		= xfs_fs_set_xquota,
> +};
> Index: xfs/fs/xfs/linux-2.6/xfs_super.h
> ===================================================================
> --- xfs.orig/fs/xfs/linux-2.6/xfs_super.h	2009-01-21 21:03:27.831294794 +0100
> +++ xfs/fs/xfs/linux-2.6/xfs_super.h	2009-01-24 18:52:52.192428740 +0100
> @@ -93,6 +93,7 @@ extern void xfs_blkdev_issue_flush(struc
>  
>  extern const struct export_operations xfs_export_operations;
>  extern struct xattr_handler *xfs_xattr_handlers[];
> +extern struct quotactl_ops xfs_quotactl_operations;
>  
>  #define XFS_M(sb)		((struct xfs_mount *)((sb)->s_fs_info))
>  
> Index: xfs/fs/xfs/linux-2.6/xfs_sync.h
> ===================================================================
> --- xfs.orig/fs/xfs/linux-2.6/xfs_sync.h	2009-01-24 17:58:49.029903800 +0100
> +++ xfs/fs/xfs/linux-2.6/xfs_sync.h	2009-01-24 18:52:52.203535043 +0100
> @@ -19,6 +19,7 @@
>  #define XFS_SYNC_H 1
>  
>  struct xfs_mount;
> +struct xfs_perag;
>  
>  typedef struct bhv_vfs_sync_work {
>  	struct list_head	w_list;
> Index: xfs/fs/xfs/quota/xfs_qm.h
> ===================================================================
> --- xfs.orig/fs/xfs/quota/xfs_qm.h	2009-01-21 21:03:27.835294745 +0100
> +++ xfs/fs/xfs/quota/xfs_qm.h	2009-01-24 18:52:52.206583965 +0100
> @@ -178,6 +178,16 @@ extern void		xfs_qm_dqdetach(xfs_inode_t
>  extern int		xfs_qm_dqpurge_all(xfs_mount_t *, uint);
>  extern void		xfs_qm_dqrele_all_inodes(xfs_mount_t *, uint);
>  
> +/* quota ops */
> +extern int		xfs_qm_scall_trunc_qfiles(xfs_mount_t *, uint);
> +extern int		xfs_qm_scall_getquota(xfs_mount_t *, xfs_dqid_t, uint,
> +					fs_disk_quota_t *);
> +extern int		xfs_qm_scall_setqlim(xfs_mount_t *, xfs_dqid_t, uint,
> +					fs_disk_quota_t *);
> +extern int		xfs_qm_scall_getqstat(xfs_mount_t *, fs_quota_stat_t *);
> +extern int		xfs_qm_scall_quotaon(xfs_mount_t *, uint);
> +extern int		xfs_qm_scall_quotaoff(xfs_mount_t *, uint);
> +
>  /* vop stuff */
>  extern int		xfs_qm_vop_dqalloc(xfs_mount_t *, xfs_inode_t *,
>  					uid_t, gid_t, prid_t, uint,
> @@ -196,10 +206,6 @@ extern void		xfs_qm_freelist_append(xfs_
>  extern void		xfs_qm_freelist_unlink(xfs_dquot_t *);
>  extern int		xfs_qm_freelist_lock_nowait(xfs_qm_t *);
>  
> -/* system call interface */
> -extern int		xfs_qm_quotactl(struct xfs_mount *, int, int,
> -				xfs_caddr_t);
> -
>  #ifdef DEBUG
>  extern int		xfs_qm_internalqcheck(xfs_mount_t *);
>  #else
> Index: xfs/fs/xfs/quota/xfs_qm_bhv.c
> ===================================================================
> --- xfs.orig/fs/xfs/quota/xfs_qm_bhv.c	2009-01-21 21:03:27.836295012 +0100
> +++ xfs/fs/xfs/quota/xfs_qm_bhv.c	2009-01-24 18:52:52.206583965 +0100
> @@ -235,7 +235,6 @@ struct xfs_qmops xfs_qmcore_xfs = {
>  	.xfs_dqvopchownresv	= xfs_qm_vop_chown_reserve,
>  	.xfs_dqstatvfs		= xfs_qm_statvfs,
>  	.xfs_dqsync		= xfs_qm_sync,
> -	.xfs_quotactl		= xfs_qm_quotactl,
>  	.xfs_dqtrxops		= &xfs_trans_dquot_ops,
>  };
>  EXPORT_SYMBOL(xfs_qmcore_xfs);
> Index: xfs/fs/xfs/quota/xfs_qm_syscalls.c
> ===================================================================
> --- xfs.orig/fs/xfs/quota/xfs_qm_syscalls.c	2009-01-21 21:03:27.836295012 +0100
> +++ xfs/fs/xfs/quota/xfs_qm_syscalls.c	2009-01-24 18:52:52.207553991 +0100
> @@ -57,135 +57,16 @@
>  # define qdprintk(s, args...)	do { } while (0)
>  #endif
>  
> -STATIC int	xfs_qm_scall_trunc_qfiles(xfs_mount_t *, uint);
> -STATIC int	xfs_qm_scall_getquota(xfs_mount_t *, xfs_dqid_t, uint,
> -					fs_disk_quota_t *);
> -STATIC int	xfs_qm_scall_getqstat(xfs_mount_t *, fs_quota_stat_t *);
> -STATIC int	xfs_qm_scall_setqlim(xfs_mount_t *, xfs_dqid_t, uint,
> -					fs_disk_quota_t *);
> -STATIC int	xfs_qm_scall_quotaon(xfs_mount_t *, uint);
> -STATIC int	xfs_qm_scall_quotaoff(xfs_mount_t *, uint, boolean_t);
>  STATIC int	xfs_qm_log_quotaoff(xfs_mount_t *, xfs_qoff_logitem_t **, uint);
>  STATIC int	xfs_qm_log_quotaoff_end(xfs_mount_t *, xfs_qoff_logitem_t *,
>  					uint);
> -STATIC uint	xfs_qm_import_flags(uint);
>  STATIC uint	xfs_qm_export_flags(uint);
> -STATIC uint	xfs_qm_import_qtype_flags(uint);
>  STATIC uint	xfs_qm_export_qtype_flags(uint);
>  STATIC void	xfs_qm_export_dquot(xfs_mount_t *, xfs_disk_dquot_t *,
>  					fs_disk_quota_t *);
>  
>  
>  /*
> - * The main distribution switch of all XFS quotactl system calls.
> - */
> -int
> -xfs_qm_quotactl(
> -	xfs_mount_t	*mp,
> -	int		cmd,
> -	int		id,
> -	xfs_caddr_t	addr)
> -{
> -	int		error;
> -
> -	ASSERT(addr != NULL || cmd == Q_XQUOTASYNC);
> -
> -	/*
> -	 * The following commands are valid even when quotaoff.
> -	 */
> -	switch (cmd) {
> -	case Q_XQUOTARM:
> -		/*
> -		 * Truncate quota files. quota must be off.
> -		 */
> -		if (XFS_IS_QUOTA_ON(mp))
> -			return XFS_ERROR(EINVAL);
> -		if (mp->m_flags & XFS_MOUNT_RDONLY)
> -			return XFS_ERROR(EROFS);
> -		return (xfs_qm_scall_trunc_qfiles(mp,
> -			       xfs_qm_import_qtype_flags(*(uint *)addr)));
> -
> -	case Q_XGETQSTAT:
> -		/*
> -		 * Get quota status information.
> -		 */
> -		return (xfs_qm_scall_getqstat(mp, (fs_quota_stat_t *)addr));
> -
> -	case Q_XQUOTAON:
> -		/*
> -		 * QUOTAON - enabling quota enforcement.
> -		 * Quota accounting must be turned on at mount time.
> -		 */
> -		if (mp->m_flags & XFS_MOUNT_RDONLY)
> -			return XFS_ERROR(EROFS);
> -		return (xfs_qm_scall_quotaon(mp,
> -					  xfs_qm_import_flags(*(uint *)addr)));
> -
> -	case Q_XQUOTAOFF:
> -		if (mp->m_flags & XFS_MOUNT_RDONLY)
> -			return XFS_ERROR(EROFS);
> -		break;
> -
> -	case Q_XQUOTASYNC:
> -		return xfs_sync_inodes(mp, SYNC_DELWRI);
> -
> -	default:
> -		break;
> -	}
> -
> -	if (! XFS_IS_QUOTA_ON(mp))
> -		return XFS_ERROR(ESRCH);
> -
> -	switch (cmd) {
> -	case Q_XQUOTAOFF:
> -		if (mp->m_flags & XFS_MOUNT_RDONLY)
> -			return XFS_ERROR(EROFS);
> -		error = xfs_qm_scall_quotaoff(mp,
> -					    xfs_qm_import_flags(*(uint *)addr),
> -					    B_FALSE);
> -		break;
> -
> -	case Q_XGETQUOTA:
> -		error = xfs_qm_scall_getquota(mp, (xfs_dqid_t)id, XFS_DQ_USER,
> -					(fs_disk_quota_t *)addr);
> -		break;
> -	case Q_XGETGQUOTA:
> -		error = xfs_qm_scall_getquota(mp, (xfs_dqid_t)id, XFS_DQ_GROUP,
> -					(fs_disk_quota_t *)addr);
> -		break;
> -	case Q_XGETPQUOTA:
> -		error = xfs_qm_scall_getquota(mp, (xfs_dqid_t)id, XFS_DQ_PROJ,
> -					(fs_disk_quota_t *)addr);
> -		break;
> -
> -	case Q_XSETQLIM:
> -		if (mp->m_flags & XFS_MOUNT_RDONLY)
> -			return XFS_ERROR(EROFS);
> -		error = xfs_qm_scall_setqlim(mp, (xfs_dqid_t)id, XFS_DQ_USER,
> -					     (fs_disk_quota_t *)addr);
> -		break;
> -	case Q_XSETGQLIM:
> -		if (mp->m_flags & XFS_MOUNT_RDONLY)
> -			return XFS_ERROR(EROFS);
> -		error = xfs_qm_scall_setqlim(mp, (xfs_dqid_t)id, XFS_DQ_GROUP,
> -					     (fs_disk_quota_t *)addr);
> -		break;
> -	case Q_XSETPQLIM:
> -		if (mp->m_flags & XFS_MOUNT_RDONLY)
> -			return XFS_ERROR(EROFS);
> -		error = xfs_qm_scall_setqlim(mp, (xfs_dqid_t)id, XFS_DQ_PROJ,
> -					     (fs_disk_quota_t *)addr);
> -		break;
> -
> -	default:
> -		error = XFS_ERROR(EINVAL);
> -		break;
> -	}
> -
> -	return (error);
> -}
> -
> -/*
>   * Turn off quota accounting and/or enforcement for all udquots and/or
>   * gdquots. Called only at unmount time.
>   *
> @@ -193,11 +74,10 @@ xfs_qm_quotactl(
>   * incore, and modifies the ondisk dquot directly. Therefore, for example,
>   * it is an error to call this twice, without purging the cache.
>   */
> -STATIC int
> +int
>  xfs_qm_scall_quotaoff(
>  	xfs_mount_t		*mp,
> -	uint			flags,
> -	boolean_t		force)
> +	uint			flags)
>  {
>  	uint			dqtype;
>  	int			error;
> @@ -205,8 +85,6 @@ xfs_qm_scall_quotaoff(
>  	xfs_qoff_logitem_t	*qoffstart;
>  	int			nculprits;
>  
> -	if (!force && !capable(CAP_SYS_ADMIN))
> -		return XFS_ERROR(EPERM);
>  	/*
>  	 * No file system can have quotas enabled on disk but not in core.
>  	 * Note that quota utilities (like quotaoff) _expect_
> @@ -375,7 +253,7 @@ out_error:
>  	return (error);
>  }
>  
> -STATIC int
> +int
>  xfs_qm_scall_trunc_qfiles(
>  	xfs_mount_t	*mp,
>  	uint		flags)
> @@ -383,8 +261,6 @@ xfs_qm_scall_trunc_qfiles(
>  	int		error = 0, error2 = 0;
>  	xfs_inode_t	*qip;
>  
> -	if (!capable(CAP_SYS_ADMIN))
> -		return XFS_ERROR(EPERM);
>  	if (!xfs_sb_version_hasquota(&mp->m_sb) || flags == 0) {
>  		qdprintk("qtrunc flags=%x m_qflags=%x\n", flags, mp->m_qflags);
>  		return XFS_ERROR(EINVAL);
> @@ -416,7 +292,7 @@ xfs_qm_scall_trunc_qfiles(
>   * effect immediately.
>   * (Switching on quota accounting must be done at mount time.)
>   */
> -STATIC int
> +int
>  xfs_qm_scall_quotaon(
>  	xfs_mount_t	*mp,
>  	uint		flags)
> @@ -426,9 +302,6 @@ xfs_qm_scall_quotaon(
>  	uint		accflags;
>  	__int64_t	sbflags;
>  
> -	if (!capable(CAP_SYS_ADMIN))
> -		return XFS_ERROR(EPERM);
> -
>  	flags &= (XFS_ALL_QUOTA_ACCT | XFS_ALL_QUOTA_ENFD);
>  	/*
>  	 * Switching on quota accounting must be done at mount time.
> @@ -517,7 +390,7 @@ xfs_qm_scall_quotaon(
>  /*
>   * Return quota status information, such as uquota-off, enforcements, etc.
>   */
> -STATIC int
> +int
>  xfs_qm_scall_getqstat(
>  	xfs_mount_t	*mp,
>  	fs_quota_stat_t *out)
> @@ -582,7 +455,7 @@ xfs_qm_scall_getqstat(
>  /*
>   * Adjust quota limits, and start/stop timers accordingly.
>   */
> -STATIC int
> +int
>  xfs_qm_scall_setqlim(
>  	xfs_mount_t		*mp,
>  	xfs_dqid_t		id,
> @@ -595,9 +468,6 @@ xfs_qm_scall_setqlim(
>  	int			error;
>  	xfs_qcnt_t		hard, soft;
>  
> -	if (!capable(CAP_SYS_ADMIN))
> -		return XFS_ERROR(EPERM);
> -
>  	if ((newlim->d_fieldmask &
>  	    (FS_DQ_LIMIT_MASK|FS_DQ_TIMER_MASK|FS_DQ_WARNS_MASK)) == 0)
>  		return (0);
> @@ -742,7 +612,7 @@ xfs_qm_scall_setqlim(
>  	return error;
>  }
>  
> -STATIC int
> +int
>  xfs_qm_scall_getquota(
>  	xfs_mount_t	*mp,
>  	xfs_dqid_t	id,
> @@ -935,30 +805,6 @@ xfs_qm_export_dquot(
>  }
>  
>  STATIC uint
> -xfs_qm_import_qtype_flags(
> -	uint		uflags)
> -{
> -	uint		oflags = 0;
> -
> -	/*
> -	 * Can't be more than one, or none.
> -	 */
> -	if (((uflags & (XFS_GROUP_QUOTA | XFS_USER_QUOTA)) ==
> -			(XFS_GROUP_QUOTA | XFS_USER_QUOTA)) ||
> -	    ((uflags & (XFS_GROUP_QUOTA | XFS_PROJ_QUOTA)) ==
> -			(XFS_GROUP_QUOTA | XFS_PROJ_QUOTA)) ||
> -	    ((uflags & (XFS_USER_QUOTA | XFS_PROJ_QUOTA)) ==
> -			(XFS_USER_QUOTA | XFS_PROJ_QUOTA)) ||
> -	    ((uflags & (XFS_GROUP_QUOTA|XFS_USER_QUOTA|XFS_PROJ_QUOTA)) == 0))
> -		return (0);
> -
> -	oflags |= (uflags & XFS_USER_QUOTA) ? XFS_DQ_USER : 0;
> -	oflags |= (uflags & XFS_PROJ_QUOTA) ? XFS_DQ_PROJ : 0;
> -	oflags |= (uflags & XFS_GROUP_QUOTA) ? XFS_DQ_GROUP: 0;
> -	return oflags;
> -}
> -
> -STATIC uint
>  xfs_qm_export_qtype_flags(
>  	uint flags)
>  {
> @@ -979,26 +825,6 @@ xfs_qm_export_qtype_flags(
>  }
>  
>  STATIC uint
> -xfs_qm_import_flags(
> -	uint uflags)
> -{
> -	uint flags = 0;
> -
> -	if (uflags & XFS_QUOTA_UDQ_ACCT)
> -		flags |= XFS_UQUOTA_ACCT;
> -	if (uflags & XFS_QUOTA_PDQ_ACCT)
> -		flags |= XFS_PQUOTA_ACCT;
> -	if (uflags & XFS_QUOTA_GDQ_ACCT)
> -		flags |= XFS_GQUOTA_ACCT;
> -	if (uflags & XFS_QUOTA_UDQ_ENFD)
> -		flags |= XFS_UQUOTA_ENFD;
> -	if (uflags & (XFS_QUOTA_PDQ_ENFD|XFS_QUOTA_GDQ_ENFD))
> -		flags |= XFS_OQUOTA_ENFD;
> -	return (flags);
> -}
> -
> -
> -STATIC uint
>  xfs_qm_export_flags(
>  	uint flags)
>  {
> Index: xfs/fs/xfs/xfs_mount.h
> ===================================================================
> --- xfs.orig/fs/xfs/xfs_mount.h	2009-01-24 18:32:57.980458591 +0100
> +++ xfs/fs/xfs/xfs_mount.h	2009-01-24 18:52:52.208554118 +0100
> @@ -136,7 +136,6 @@ typedef int	(*xfs_dqvopchownresv_t)(stru
>  			struct xfs_dquot *, struct xfs_dquot *, uint);
>  typedef void	(*xfs_dqstatvfs_t)(struct xfs_inode *, struct kstatfs *);
>  typedef int	(*xfs_dqsync_t)(struct xfs_mount *, int flags);
> -typedef int	(*xfs_quotactl_t)(struct xfs_mount *, int, int, xfs_caddr_t);
>  
>  typedef struct xfs_qmops {
>  	xfs_qminit_t		xfs_qminit;
> @@ -154,7 +153,6 @@ typedef struct xfs_qmops {
>  	xfs_dqvopchownresv_t	xfs_dqvopchownresv;
>  	xfs_dqstatvfs_t		xfs_dqstatvfs;
>  	xfs_dqsync_t		xfs_dqsync;
> -	xfs_quotactl_t		xfs_quotactl;
>  	struct xfs_dqtrxops	*xfs_dqtrxops;
>  } xfs_qmops_t;
>  
> @@ -188,8 +186,6 @@ typedef struct xfs_qmops {
>  	(*(ip)->i_mount->m_qm_ops->xfs_dqstatvfs)(ip, statp)
>  #define XFS_QM_DQSYNC(mp, flags) \
>  	(*(mp)->m_qm_ops->xfs_dqsync)(mp, flags)
> -#define XFS_QM_QUOTACTL(mp, cmd, id, addr) \
> -	(*(mp)->m_qm_ops->xfs_quotactl)(mp, cmd, id, addr)
>  
>  #ifdef HAVE_PERCPU_SB
>  
> Index: xfs/fs/xfs/xfs_qmops.c
> ===================================================================
> --- xfs.orig/fs/xfs/xfs_qmops.c	2009-01-21 21:03:27.866294994 +0100
> +++ xfs/fs/xfs/xfs_qmops.c	2009-01-24 18:52:52.208554118 +0100
> @@ -126,7 +126,6 @@ static struct xfs_qmops xfs_qmcore_stub 
>  	.xfs_dqvopchownresv	= (xfs_dqvopchownresv_t) fs_noerr,
>  	.xfs_dqstatvfs		= (xfs_dqstatvfs_t) fs_noval,
>  	.xfs_dqsync		= (xfs_dqsync_t) fs_noerr,
> -	.xfs_quotactl		= (xfs_quotactl_t) fs_nosys,
>  };
>  
>  int
> Index: xfs/fs/xfs/xfs_quota.h
> ===================================================================
> --- xfs.orig/fs/xfs/xfs_quota.h	2009-01-21 21:03:27.866294994 +0100
> +++ xfs/fs/xfs/xfs_quota.h	2009-01-24 18:52:52.211583834 +0100
> @@ -18,6 +18,8 @@
>  #ifndef __XFS_QUOTA_H__
>  #define __XFS_QUOTA_H__
>  
> +struct xfs_trans;
> +
>  /*
>   * The ondisk form of a dquot structure.
>   */
> 
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
---end quoted text---

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

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

end of thread, other threads:[~2009-05-13  8:10 UTC | newest]

Thread overview: 50+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-26  7:31 [PATCH 00/17] 2.6.30 queue Christoph Hellwig
2009-01-26  7:31 ` [PATCH 01/17] xfs: cleanup error handling in xfs_mountfs: Christoph Hellwig
2009-01-26 21:39   ` Felix Blyakher
2009-01-26  7:31 ` [PATCH 02/17] xfs: make sure to free the real-time inodes in the mount error path Christoph Hellwig
2009-01-26 22:02   ` Felix Blyakher
2009-01-28 20:24   ` Martin Steigerwald
2009-01-26  7:31 ` [PATCH 03/17] xfs: cleanup handling in xfs_swap_extents Christoph Hellwig
2009-01-26  7:55   ` Christoph Hellwig
2009-01-27  0:27     ` [PATCH] xfs: cleanup error " Josef 'Jeff' Sipek
2009-01-28 20:25       ` Martin Steigerwald
2009-01-26 22:13   ` [PATCH 03/17] xfs: cleanup " Felix Blyakher
2009-05-08  0:45   ` Eric Sandeen
2009-01-26  7:31 ` [PATCH 04/17] xfs: tiny cleanup for xfs_link Christoph Hellwig
2009-01-26 22:23   ` Felix Blyakher
2009-01-26  7:31 ` [PATCH 05/17] xfs: remove unused XFS_MOUNT_ILOCK/XFS_MOUNT_IUNLOCK Christoph Hellwig
2009-01-26 23:43   ` Felix Blyakher
2009-01-26  7:31 ` [PATCH 06/17] xfs: remove iclog calculation special cases Christoph Hellwig
2009-02-09  2:15   ` Dave Chinner
2009-01-26  7:31 ` [PATCH 07/17] xfs: remove superflous inobt macros Christoph Hellwig
2009-02-09  2:16   ` Dave Chinner
2009-01-26  7:31 ` [PATCH 08/17] xfs: remove uchar_t/ushort_t/uint_t/ulong_t types Christoph Hellwig
2009-02-09  2:18   ` Dave Chinner
2009-01-26  7:31 ` [PATCH 09/17] xfs: cleanup xfs_find_handle Christoph Hellwig
2009-02-06  5:20   ` Felix Blyakher
2009-02-06  7:17     ` Christoph Hellwig
2009-02-06 20:31       ` Felix Blyakher
2009-01-26  7:31 ` [PATCH 10/17] xfs: factor out attr fork reset handling Christoph Hellwig
2009-01-27 16:53   ` Felix Blyakher
2009-01-26  7:31 ` [PATCH 11/17] xfs: merge xfs_inode_flush into xfs_fs_write_inode Christoph Hellwig
2009-01-27 17:37   ` Felix Blyakher
2009-02-01  0:54   ` Dave Chinner
2009-02-15  6:42   ` Dave Chinner
2009-02-15 20:13     ` Christoph Hellwig
2009-02-16  3:06       ` Dave Chinner
2009-01-26  7:31 ` [PATCH 12/17] xfs: merge xfs_mkdir into xfs_create Christoph Hellwig
2009-02-09  2:28   ` Dave Chinner
2009-01-26  7:31 ` [PATCH 13/17] xfs: get rid of indirections in the quotaops implementation Christoph Hellwig
2009-02-09  2:41   ` Dave Chinner
2009-02-09  7:46     ` Christoph Hellwig
2009-05-13  8:11   ` Christoph Hellwig
2009-01-26  7:31 ` [PATCH 14/17] xfs: remove the unused XFS_QMOPT_DQLOCK flag Christoph Hellwig
2009-02-08  0:35   ` Felix Blyakher
2009-01-26  7:31 ` [PATCH 15/17] xfs: remove XFS_QM_LOCK/XFS_QM_UNLOCK/XFS_QM_HOLD/XFS_QM_RELE Christoph Hellwig
2009-02-09  2:42   ` Dave Chinner
2009-01-26  7:31 ` [PATCH 16/17] xfs: use mutex_is_locked in XFS_DQ_IS_LOCKED Christoph Hellwig
2009-02-09  2:42   ` Dave Chinner
2009-01-26  7:31 ` [PATCH 17/17] xfs: sanitize qh_lock wrappers Christoph Hellwig
2009-02-09  2:45   ` Dave Chinner
2009-02-04 19:37 ` [PATCH 00/17] 2.6.30 queue Christoph Hellwig
2009-02-08 21:12   ` Christoph Hellwig

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.