public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/6] xfsprogs: get rid of XFS_IALLOC_INODES macros
@ 2014-05-05 12:31 Jeff Liu
  2014-05-05 21:09 ` Brian Foster
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Liu @ 2014-05-05 12:31 UTC (permalink / raw)
  To: xfs@oss.sgi.com

From: Jie Liu <jeff.liu@oracle.com>

Get rid of XFS_IALLOC_INODES() macros, use mp->m_ialloc_inos directly.

Signed-off-by: Jie Liu <jeff.liu@oracle.com>
---
 include/xfs_ialloc.h |  1 -
 libxfs/xfs_ialloc.c  | 12 ++++++------
 repair/dino_chunks.c | 16 ++++++++--------
 repair/prefetch.c    |  4 ++--
 4 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/include/xfs_ialloc.h b/include/xfs_ialloc.h
index a8f76a5..4689b02 100644
--- a/include/xfs_ialloc.h
+++ b/include/xfs_ialloc.h
@@ -28,7 +28,6 @@ struct xfs_btree_cur;
 /*
  * Allocation parameters for inode allocation.
  */
-#define	XFS_IALLOC_INODES(mp)	(mp)->m_ialloc_inos
 #define	XFS_IALLOC_BLOCKS(mp)	(mp)->m_ialloc_blks
 
 /*
diff --git a/libxfs/xfs_ialloc.c b/libxfs/xfs_ialloc.c
index c19d84a..108f6f2 100644
--- a/libxfs/xfs_ialloc.c
+++ b/libxfs/xfs_ialloc.c
@@ -201,7 +201,7 @@ xfs_ialloc_inode_init(
 		 * they track in the AIL as if they were physically logged.
 		 */
 		if (tp)
-			xfs_icreate_log(tp, agno, agbno, XFS_IALLOC_INODES(mp),
+			xfs_icreate_log(tp, agno, agbno, mp->m_ialloc_inos,
 					mp->m_sb.sb_inodesize, length, gen);
 	} else if (xfs_sb_version_hasnlink(&mp->m_sb))
 		version = 2;
@@ -305,7 +305,7 @@ xfs_ialloc_ag_alloc(
 	 * Locking will ensure that we don't have two callers in here
 	 * at one time.
 	 */
-	newlen = XFS_IALLOC_INODES(args.mp);
+	newlen = args.mp->m_ialloc_inos;
 	if (args.mp->m_maxicount &&
 	    args.mp->m_sb.sb_icount + newlen > args.mp->m_maxicount)
 		return XFS_ERROR(ENOSPC);
@@ -975,7 +975,7 @@ xfs_dialloc(
 	 * inode.
 	 */
 	if (mp->m_maxicount &&
-	    mp->m_sb.sb_icount + XFS_IALLOC_INODES(mp) > mp->m_maxicount) {
+	    mp->m_sb.sb_icount + mp->m_ialloc_inos > mp->m_maxicount) {
 		noroom = 1;
 		okalloc = 0;
 	}
@@ -1178,7 +1178,7 @@ xfs_difree(
 	 * When an inode cluster is free, it becomes eligible for removal
 	 */
 	if (!(mp->m_flags & XFS_MOUNT_IKEEP) &&
-	    (rec.ir_freecount == XFS_IALLOC_INODES(mp))) {
+	    (rec.ir_freecount == mp->m_ialloc_inos)) {
 
 		*delete = 1;
 		*first_ino = XFS_AGINO_TO_INO(mp, agno, rec.ir_startino);
@@ -1188,7 +1188,7 @@ xfs_difree(
 		 * AGI and Superblock inode counts, and mark the disk space
 		 * to be freed when the transaction is committed.
 		 */
-		ilen = XFS_IALLOC_INODES(mp);
+		ilen = mp->m_ialloc_inos;
 		be32_add_cpu(&agi->agi_count, -ilen);
 		be32_add_cpu(&agi->agi_freecount, -(ilen - 1));
 		xfs_ialloc_log_agi(tp, agbp, XFS_AGI_COUNT | XFS_AGI_FREECOUNT);
@@ -1287,7 +1287,7 @@ xfs_imap_lookup(
 
 	/* check that the returned record contains the required inode */
 	if (rec.ir_startino > agino ||
-	    rec.ir_startino + XFS_IALLOC_INODES(mp) <= agino)
+	    rec.ir_startino + mp->m_ialloc_inos <= agino)
 		return EINVAL;
 
 	/* for untrusted inodes check it is allocated first */
diff --git a/repair/dino_chunks.c b/repair/dino_chunks.c
index afb26e0..15aa4f8 100644
--- a/repair/dino_chunks.c
+++ b/repair/dino_chunks.c
@@ -267,7 +267,7 @@ verify_inode_chunk(xfs_mount_t		*mp,
 	 * would include the inode passed into us.
 	 */
 	if (XFS_IALLOC_BLOCKS(mp) > 1)  {
-		if (agino > XFS_IALLOC_INODES(mp))
+		if (agino > mp->m_ialloc_inos)
 			start_agbno = agbno - XFS_IALLOC_BLOCKS(mp) + 1;
 		else
 			start_agbno = 1;
@@ -336,7 +336,7 @@ verify_inode_chunk(xfs_mount_t		*mp,
 			 * of the gap -- is it within the search range?
 			 */
 			if (irec_next_p != NULL &&
-					agino + XFS_IALLOC_INODES(mp) >=
+					agino + mp->m_ialloc_inos >=
 						irec_next_p->ino_startnum)
 				end_agbno = XFS_AGINO_TO_AGBNO(mp,
 						irec_next_p->ino_startnum);
@@ -688,7 +688,7 @@ process_inode_chunk(
 			icnt++;
 			cluster_offset++;
 
-			if (icnt == XFS_IALLOC_INODES(mp) &&
+			if (icnt == mp->m_ialloc_inos &&
 					irec_offset == XFS_INODES_PER_CHUNK)  {
 				/*
 				 * done! - finished up irec and block
@@ -900,7 +900,7 @@ process_inode_chunk(
 		icnt++;
 		cluster_offset++;
 
-		if (icnt == XFS_IALLOC_INODES(mp) &&
+		if (icnt == mp->m_ialloc_inos &&
 				irec_offset == XFS_INODES_PER_CHUNK)  {
 			/*
 			 * done! - finished up irec and block simultaneously
@@ -1002,7 +1002,7 @@ process_aginodes(
 		 * the next block before we call the processing routines.
 		 */
 		num_inos = XFS_INODES_PER_CHUNK;
-		while (num_inos < XFS_IALLOC_INODES(mp) && ino_rec != NULL)  {
+		while (num_inos < mp->m_ialloc_inos && ino_rec != NULL)  {
 			/*
 			 * inodes chunks will always be aligned and sized
 			 * correctly
@@ -1011,7 +1011,7 @@ process_aginodes(
 				num_inos += XFS_INODES_PER_CHUNK;
 		}
 
-		ASSERT(num_inos == XFS_IALLOC_INODES(mp));
+		ASSERT(num_inos == mp->m_ialloc_inos);
 
 		if (pf_args) {
 			sem_post(&pf_args->ra_count);
@@ -1043,7 +1043,7 @@ process_aginodes(
 			 */
 			num_inos = 0;
 			ino_rec = first_ino_rec;
-			while (num_inos < XFS_IALLOC_INODES(mp) &&
+			while (num_inos < mp->m_ialloc_inos &&
 					ino_rec != NULL)  {
 				prev_ino_rec = ino_rec;
 
@@ -1227,7 +1227,7 @@ process_uncertain_aginodes(xfs_mount_t *mp, xfs_agnumber_t agno)
 			 * processing may add more records to the
 			 * uncertain inode lists.
 			 */
-			if (process_inode_chunk(mp, agno, XFS_IALLOC_INODES(mp),
+			if (process_inode_chunk(mp, agno, mp->m_ialloc_inos,
 						nrec, 1, 0, 0, &bogus))  {
 				/* XXX - i/o error, we've got a problem */
 				abort();
diff --git a/repair/prefetch.c b/repair/prefetch.c
index 65fedf5..2cd3d5a 100644
--- a/repair/prefetch.c
+++ b/repair/prefetch.c
@@ -711,7 +711,7 @@ pf_queuing_worker(
 		cur_irec = irec;
 
 		num_inos = XFS_INODES_PER_CHUNK;
-		while (num_inos < XFS_IALLOC_INODES(mp) && irec != NULL) {
+		while (num_inos < mp->m_ialloc_inos && irec != NULL) {
 			irec = next_ino_rec(irec);
 			num_inos += XFS_INODES_PER_CHUNK;
 		}
@@ -749,7 +749,7 @@ pf_queuing_worker(
 								 : B_INODE);
 			bno += blks_per_cluster;
 			num_inos += inodes_per_cluster;
-		} while (num_inos < XFS_IALLOC_INODES(mp));
+		} while (num_inos < mp->m_ialloc_inos);
 	}
 
 	pthread_mutex_lock(&args->lock);
-- 
1.8.3.2

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

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

* Re: [PATCH 1/6] xfsprogs: get rid of XFS_IALLOC_INODES macros
  2014-05-05 12:31 [PATCH 1/6] xfsprogs: get rid of XFS_IALLOC_INODES macros Jeff Liu
@ 2014-05-05 21:09 ` Brian Foster
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Foster @ 2014-05-05 21:09 UTC (permalink / raw)
  To: Jeff Liu; +Cc: xfs@oss.sgi.com

On Mon, May 05, 2014 at 08:31:55PM +0800, Jeff Liu wrote:
> From: Jie Liu <jeff.liu@oracle.com>
> 
> Get rid of XFS_IALLOC_INODES() macros, use mp->m_ialloc_inos directly.
> 
> Signed-off-by: Jie Liu <jeff.liu@oracle.com>
> ---

Pretty straightforward cleanup...

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

>  include/xfs_ialloc.h |  1 -
>  libxfs/xfs_ialloc.c  | 12 ++++++------
>  repair/dino_chunks.c | 16 ++++++++--------
>  repair/prefetch.c    |  4 ++--
>  4 files changed, 16 insertions(+), 17 deletions(-)
> 
> diff --git a/include/xfs_ialloc.h b/include/xfs_ialloc.h
> index a8f76a5..4689b02 100644
> --- a/include/xfs_ialloc.h
> +++ b/include/xfs_ialloc.h
> @@ -28,7 +28,6 @@ struct xfs_btree_cur;
>  /*
>   * Allocation parameters for inode allocation.
>   */
> -#define	XFS_IALLOC_INODES(mp)	(mp)->m_ialloc_inos
>  #define	XFS_IALLOC_BLOCKS(mp)	(mp)->m_ialloc_blks
>  
>  /*
> diff --git a/libxfs/xfs_ialloc.c b/libxfs/xfs_ialloc.c
> index c19d84a..108f6f2 100644
> --- a/libxfs/xfs_ialloc.c
> +++ b/libxfs/xfs_ialloc.c
> @@ -201,7 +201,7 @@ xfs_ialloc_inode_init(
>  		 * they track in the AIL as if they were physically logged.
>  		 */
>  		if (tp)
> -			xfs_icreate_log(tp, agno, agbno, XFS_IALLOC_INODES(mp),
> +			xfs_icreate_log(tp, agno, agbno, mp->m_ialloc_inos,
>  					mp->m_sb.sb_inodesize, length, gen);
>  	} else if (xfs_sb_version_hasnlink(&mp->m_sb))
>  		version = 2;
> @@ -305,7 +305,7 @@ xfs_ialloc_ag_alloc(
>  	 * Locking will ensure that we don't have two callers in here
>  	 * at one time.
>  	 */
> -	newlen = XFS_IALLOC_INODES(args.mp);
> +	newlen = args.mp->m_ialloc_inos;
>  	if (args.mp->m_maxicount &&
>  	    args.mp->m_sb.sb_icount + newlen > args.mp->m_maxicount)
>  		return XFS_ERROR(ENOSPC);
> @@ -975,7 +975,7 @@ xfs_dialloc(
>  	 * inode.
>  	 */
>  	if (mp->m_maxicount &&
> -	    mp->m_sb.sb_icount + XFS_IALLOC_INODES(mp) > mp->m_maxicount) {
> +	    mp->m_sb.sb_icount + mp->m_ialloc_inos > mp->m_maxicount) {
>  		noroom = 1;
>  		okalloc = 0;
>  	}
> @@ -1178,7 +1178,7 @@ xfs_difree(
>  	 * When an inode cluster is free, it becomes eligible for removal
>  	 */
>  	if (!(mp->m_flags & XFS_MOUNT_IKEEP) &&
> -	    (rec.ir_freecount == XFS_IALLOC_INODES(mp))) {
> +	    (rec.ir_freecount == mp->m_ialloc_inos)) {
>  
>  		*delete = 1;
>  		*first_ino = XFS_AGINO_TO_INO(mp, agno, rec.ir_startino);
> @@ -1188,7 +1188,7 @@ xfs_difree(
>  		 * AGI and Superblock inode counts, and mark the disk space
>  		 * to be freed when the transaction is committed.
>  		 */
> -		ilen = XFS_IALLOC_INODES(mp);
> +		ilen = mp->m_ialloc_inos;
>  		be32_add_cpu(&agi->agi_count, -ilen);
>  		be32_add_cpu(&agi->agi_freecount, -(ilen - 1));
>  		xfs_ialloc_log_agi(tp, agbp, XFS_AGI_COUNT | XFS_AGI_FREECOUNT);
> @@ -1287,7 +1287,7 @@ xfs_imap_lookup(
>  
>  	/* check that the returned record contains the required inode */
>  	if (rec.ir_startino > agino ||
> -	    rec.ir_startino + XFS_IALLOC_INODES(mp) <= agino)
> +	    rec.ir_startino + mp->m_ialloc_inos <= agino)
>  		return EINVAL;
>  
>  	/* for untrusted inodes check it is allocated first */
> diff --git a/repair/dino_chunks.c b/repair/dino_chunks.c
> index afb26e0..15aa4f8 100644
> --- a/repair/dino_chunks.c
> +++ b/repair/dino_chunks.c
> @@ -267,7 +267,7 @@ verify_inode_chunk(xfs_mount_t		*mp,
>  	 * would include the inode passed into us.
>  	 */
>  	if (XFS_IALLOC_BLOCKS(mp) > 1)  {
> -		if (agino > XFS_IALLOC_INODES(mp))
> +		if (agino > mp->m_ialloc_inos)
>  			start_agbno = agbno - XFS_IALLOC_BLOCKS(mp) + 1;
>  		else
>  			start_agbno = 1;
> @@ -336,7 +336,7 @@ verify_inode_chunk(xfs_mount_t		*mp,
>  			 * of the gap -- is it within the search range?
>  			 */
>  			if (irec_next_p != NULL &&
> -					agino + XFS_IALLOC_INODES(mp) >=
> +					agino + mp->m_ialloc_inos >=
>  						irec_next_p->ino_startnum)
>  				end_agbno = XFS_AGINO_TO_AGBNO(mp,
>  						irec_next_p->ino_startnum);
> @@ -688,7 +688,7 @@ process_inode_chunk(
>  			icnt++;
>  			cluster_offset++;
>  
> -			if (icnt == XFS_IALLOC_INODES(mp) &&
> +			if (icnt == mp->m_ialloc_inos &&
>  					irec_offset == XFS_INODES_PER_CHUNK)  {
>  				/*
>  				 * done! - finished up irec and block
> @@ -900,7 +900,7 @@ process_inode_chunk(
>  		icnt++;
>  		cluster_offset++;
>  
> -		if (icnt == XFS_IALLOC_INODES(mp) &&
> +		if (icnt == mp->m_ialloc_inos &&
>  				irec_offset == XFS_INODES_PER_CHUNK)  {
>  			/*
>  			 * done! - finished up irec and block simultaneously
> @@ -1002,7 +1002,7 @@ process_aginodes(
>  		 * the next block before we call the processing routines.
>  		 */
>  		num_inos = XFS_INODES_PER_CHUNK;
> -		while (num_inos < XFS_IALLOC_INODES(mp) && ino_rec != NULL)  {
> +		while (num_inos < mp->m_ialloc_inos && ino_rec != NULL)  {
>  			/*
>  			 * inodes chunks will always be aligned and sized
>  			 * correctly
> @@ -1011,7 +1011,7 @@ process_aginodes(
>  				num_inos += XFS_INODES_PER_CHUNK;
>  		}
>  
> -		ASSERT(num_inos == XFS_IALLOC_INODES(mp));
> +		ASSERT(num_inos == mp->m_ialloc_inos);
>  
>  		if (pf_args) {
>  			sem_post(&pf_args->ra_count);
> @@ -1043,7 +1043,7 @@ process_aginodes(
>  			 */
>  			num_inos = 0;
>  			ino_rec = first_ino_rec;
> -			while (num_inos < XFS_IALLOC_INODES(mp) &&
> +			while (num_inos < mp->m_ialloc_inos &&
>  					ino_rec != NULL)  {
>  				prev_ino_rec = ino_rec;
>  
> @@ -1227,7 +1227,7 @@ process_uncertain_aginodes(xfs_mount_t *mp, xfs_agnumber_t agno)
>  			 * processing may add more records to the
>  			 * uncertain inode lists.
>  			 */
> -			if (process_inode_chunk(mp, agno, XFS_IALLOC_INODES(mp),
> +			if (process_inode_chunk(mp, agno, mp->m_ialloc_inos,
>  						nrec, 1, 0, 0, &bogus))  {
>  				/* XXX - i/o error, we've got a problem */
>  				abort();
> diff --git a/repair/prefetch.c b/repair/prefetch.c
> index 65fedf5..2cd3d5a 100644
> --- a/repair/prefetch.c
> +++ b/repair/prefetch.c
> @@ -711,7 +711,7 @@ pf_queuing_worker(
>  		cur_irec = irec;
>  
>  		num_inos = XFS_INODES_PER_CHUNK;
> -		while (num_inos < XFS_IALLOC_INODES(mp) && irec != NULL) {
> +		while (num_inos < mp->m_ialloc_inos && irec != NULL) {
>  			irec = next_ino_rec(irec);
>  			num_inos += XFS_INODES_PER_CHUNK;
>  		}
> @@ -749,7 +749,7 @@ pf_queuing_worker(
>  								 : B_INODE);
>  			bno += blks_per_cluster;
>  			num_inos += inodes_per_cluster;
> -		} while (num_inos < XFS_IALLOC_INODES(mp));
> +		} while (num_inos < mp->m_ialloc_inos);
>  	}
>  
>  	pthread_mutex_lock(&args->lock);
> -- 
> 1.8.3.2
> 
> _______________________________________________
> 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] 2+ messages in thread

end of thread, other threads:[~2014-05-05 21:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-05 12:31 [PATCH 1/6] xfsprogs: get rid of XFS_IALLOC_INODES macros Jeff Liu
2014-05-05 21:09 ` Brian Foster

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