Skip to contentSkip to conversation

remove flags param from xfs_free_eofblocks

PATCH In review Eric Sandeen 2 participants 4 messages Jan 1, 2009 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 remove flags param from xfs_free_eofblocks

Remove unused XFS_FREE_EOF_NOLOCK and make XFS_FREE_EOF_LOCK default.

XFS_FREE_EOF_NOLOCK is never used, so remove it, make XFS_FREE_EOF_LOCK the only behavior, and remove the flags parameters.

---

fs/xfs/xfs_rw.h +1 -9
Index: xfs/fs/xfs/xfs_rw.h
===================================================================
@@ -37,13 +37,6 @@ xfs_fsb_to_db(struct xfs_inode *ip, xfs_
 }
 
 /*
- * Flags for xfs_free_eofblocks
- */
-#define XFS_FREE_EOF_LOCK	(1<<0)
-#define XFS_FREE_EOF_NOLOCK	(1<<1)
-
-
-/*
  * helper function to extract extent size hint from inode
  */
 STATIC_INLINE xfs_extlen_t
@@ -81,7 +74,6 @@ extern void xfs_ioerror_alert(char *func
 /*
  * Prototypes for functions in xfs_vnodeops.c.
  */
-extern int xfs_free_eofblocks(struct xfs_mount *mp, struct xfs_inode *ip,
-			int flags);
+extern int xfs_free_eofblocks(struct xfs_mount *mp, struct xfs_inode *ip);
 
 #endif /* __XFS_RW_H__ */
fs/xfs/xfs_vnodeops.c +6 -11
Index: xfs/fs/xfs/xfs_vnodeops.c
===================================================================
@@ -814,8 +814,7 @@ xfs_fsync(
 int
 xfs_free_eofblocks(
 	xfs_mount_t	*mp,
-	xfs_inode_t	*ip,
-	int		flags)
+	xfs_inode_t	*ip)
 {
 	xfs_trans_t	*tp;
 	int		error;
@@ -824,7 +823,6 @@ xfs_free_eofblocks(
 	xfs_filblks_t	map_len;
 	int		nimaps;
 	xfs_bmbt_irec_t	imap;
-	int		use_iolock = (flags & XFS_FREE_EOF_LOCK);
 
 	/*
 	 * Figure out if there are any blocks beyond the end
@@ -865,14 +863,12 @@ xfs_free_eofblocks(
 		 * cache and we can't
 		 * do that within a transaction.
 		 */
-		if (use_iolock)
-			xfs_ilock(ip, XFS_IOLOCK_EXCL);
+		xfs_ilock(ip, XFS_IOLOCK_EXCL);
 		error = xfs_itruncate_start(ip, XFS_ITRUNC_DEFINITE,
 				    ip->i_size);
 		if (error) {
 			xfs_trans_cancel(tp, 0);
-			if (use_iolock)
-				xfs_iunlock(ip, XFS_IOLOCK_EXCL);
+			xfs_iunlock(ip, XFS_IOLOCK_EXCL);
 			return error;
 		}
 
@@ -909,8 +905,7 @@ xfs_free_eofblocks(
 			error = xfs_trans_commit(tp,
 						XFS_TRANS_RELEASE_LOG_RES);
 		}
-		xfs_iunlock(ip, (use_iolock ? (XFS_IOLOCK_EXCL|XFS_ILOCK_EXCL)
-					    : XFS_ILOCK_EXCL));
+		xfs_iunlock(ip, XFS_IOLOCK_EXCL|XFS_ILOCK_EXCL);
 	}
 	return error;
 }
@@ -1204,7 +1199,7 @@ xfs_release(
 		     (ip->i_df.if_flags & XFS_IFEXTENTS))  &&
 		    (!(ip->i_d.di_flags &
 				(XFS_DIFLAG_PREALLOC | XFS_DIFLAG_APPEND)))) {
-			error = xfs_free_eofblocks(mp, ip, XFS_FREE_EOF_LOCK);
+			error = xfs_free_eofblocks(mp, ip);
 			if (error)
 				return error;
 		}
@@ -1275,7 +1270,7 @@ xfs_inactive(
 		     (!(ip->i_d.di_flags &
 				(XFS_DIFLAG_PREALLOC | XFS_DIFLAG_APPEND)) ||
 		      (ip->i_delayed_blks != 0)))) {
-			error = xfs_free_eofblocks(mp, ip, XFS_FREE_EOF_LOCK);
+			error = xfs_free_eofblocks(mp, ip);
 			if (error)
 				return VN_INACTIVE_CACHE;
 		}

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#2 lore raw
Quoted 8 lines · Christoph Hellwig
Quoted 5 lines · Eric Sandeen

Remove unused XFS_FREE_EOF_NOLOCK and make XFS_FREE_EOF_LOCK default.

XFS_FREE_EOF_NOLOCK is never used, so remove it, make XFS_FREE_EOF_LOCK the only behavior, and remove the flags parameters.

Looks good to me.

Actually it's used by dmapi, so we have to keep it. Would be nice if we actually had some uptodate tree with dmapi, though..

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#3 lore raw
Quoted 4 lines · Christoph Hellwig
Quoted 3 lines · Christoph Hellwig
Quoted 2 lines · Eric Sandeen

Remove unused XFS_FREE_EOF_NOLOCK and make XFS_FREE_EOF_LOCK default.

Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

XFS_FREE_EOF_NOLOCK is never used, so remove it, make XFS_FREE_EOF_LOCK the only behavior, and remove the flags parameters.

Looks good to me.

Actually it's used by dmapi, so we have to keep it. Would be nice if we actually had some uptodate tree with dmapi, though..

yep I had the wrong tree :( sorry for the noise.

-Eric

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs