linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 6/10] xfs: introduce xfs_bulkstat_ichunk_ra
@ 2013-12-28 11:22 Jeff Liu
  2013-12-30 16:57 ` Mark Tinguely
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Liu @ 2013-12-28 11:22 UTC (permalink / raw)
  To: xfs@oss.sgi.com

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

Introduce xfs_bulkstat_ichunk_ra() to loop over all clusters in
the next inode chunk, then performs readahead if there are any
allocated inodes in that cluster.

Refactor xfs_bulkstat() with it.

Signed-off-by: Jie Liu <jeff.liu@oracle.com>
---
 fs/xfs/xfs_itable.c | 56 ++++++++++++++++++++++++++++++-----------------------
 1 file changed, 32 insertions(+), 24 deletions(-)

diff --git a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c
index 4c6b0ab..144e403 100644
--- a/fs/xfs/xfs_itable.c
+++ b/fs/xfs/xfs_itable.c
@@ -172,6 +172,37 @@ xfs_bulkstat_one(
 				    xfs_bulkstat_one_fmt, ubused, stat);
 }
 
+/*
+ * Loop over all clusters in a chunk for a given incore inode allocation btree
+ * record.  Do a readahead if there are any allocated inodes in that cluster.
+ */
+STATIC void
+xfs_bulkstat_ichunk_ra(
+	struct xfs_mount		*mp,
+	xfs_agnumber_t			agno,
+	struct xfs_inobt_rec_incore	*irec)
+{
+	xfs_agblock_t			agbno;
+	struct blk_plug			plug;
+	int				blks_per_cluster;
+	int				inodes_per_cluster;
+	int				i;	/* inode chunk index */
+
+	agbno = XFS_AGINO_TO_AGBNO(mp, irec->ir_startino);
+	blks_per_cluster = xfs_icluster_size_fsb(mp);
+	inodes_per_cluster = blks_per_cluster << mp->m_sb.sb_inopblog;
+
+	blk_start_plug(&plug);
+	for (i = 0; i < XFS_INODES_PER_CHUNK;
+	     i += inodes_per_cluster, agbno += blks_per_cluster) {
+		if (xfs_inobt_maskn(i, inodes_per_cluster) & ~irec->ir_free) {
+			xfs_btree_reada_bufs(mp, agno, agbno, blks_per_cluster,
+					     &xfs_inode_buf_ops);
+		}
+	}
+	blk_finish_plug(&plug);
+}
+
 #define XFS_BULKSTAT_UBLEFT(ubleft)	((ubleft) >= statstruct_size)
 
 /*
@@ -187,7 +218,6 @@ xfs_bulkstat(
 	char			__user *ubuffer, /* buffer with inode stats */
 	int			*done)	/* 1 if there are more stats to get */
 {
-	xfs_agblock_t		agbno=0;/* allocation group block number */
 	xfs_buf_t		*agbp;	/* agi header buffer */
 	xfs_agi_t		*agi;	/* agi header data */
 	xfs_agino_t		agino;	/* inode # in allocation group */
@@ -206,8 +236,6 @@ xfs_bulkstat(
 	xfs_inobt_rec_incore_t	*irbuf;	/* start of irec buffer */
 	xfs_inobt_rec_incore_t	*irbufend; /* end of good irec buffer entries */
 	xfs_ino_t		lastino; /* last inode number returned */
-	int			blks_per_cluster; /* # of blocks per cluster */
-	int			inodes_per_cluster;/* # of inodes per cluster */
 	int			nirbuf;	/* size of irbuf */
 	int			rval;	/* return value error code */
 	int			tmp;	/* result value from btree calls */
@@ -236,8 +264,6 @@ xfs_bulkstat(
 	*done = 0;
 	fmterror = 0;
 	ubufp = ubuffer;
-	blks_per_cluster = xfs_icluster_size_fsb(mp);
-	inodes_per_cluster = blks_per_cluster << mp->m_sb.sb_inopblog;
 	irbuf = kmem_zalloc_greedy(&irbsize, PAGE_SIZE, PAGE_SIZE * 4);
 	if (!irbuf)
 		return ENOMEM;
@@ -345,25 +371,7 @@ xfs_bulkstat(
 			 * Also start read-ahead now for this chunk.
 			 */
 			if (r.ir_freecount < XFS_INODES_PER_CHUNK) {
-				struct blk_plug	plug;
-				/*
-				 * Loop over all clusters in the next chunk.
-				 * Do a readahead if there are any allocated
-				 * inodes in that cluster.
-				 */
-				blk_start_plug(&plug);
-				agbno = XFS_AGINO_TO_AGBNO(mp, r.ir_startino);
-				for (chunkidx = 0;
-				     chunkidx < XFS_INODES_PER_CHUNK;
-				     chunkidx += inodes_per_cluster,
-				     agbno += blks_per_cluster) {
-					if (xfs_inobt_maskn(chunkidx,
-					    inodes_per_cluster) & ~r.ir_free)
-						xfs_btree_reada_bufs(mp, agno,
-							agbno, blks_per_cluster,
-							&xfs_inode_buf_ops);
-				}
-				blk_finish_plug(&plug);
+				xfs_bulkstat_ichunk_ra(mp, agno, &r);
 				irbp->ir_startino = r.ir_startino;
 				irbp->ir_freecount = r.ir_freecount;
 				irbp->ir_free = r.ir_free;
-- 
1.8.3.2

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

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

* Re: [PATCH 6/10] xfs: introduce xfs_bulkstat_ichunk_ra
  2013-12-28 11:22 [PATCH 6/10] xfs: introduce xfs_bulkstat_ichunk_ra Jeff Liu
@ 2013-12-30 16:57 ` Mark Tinguely
  2013-12-31  9:46   ` Jeff Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Tinguely @ 2013-12-30 16:57 UTC (permalink / raw)
  To: Jeff Liu; +Cc: xfs@oss.sgi.com

On 12/28/13 05:22, Jeff Liu wrote:
> From: Jie Liu<jeff.liu@oracle.com>
>
> Introduce xfs_bulkstat_ichunk_ra() to loop over all clusters in
> the next inode chunk, then performs readahead if there are any
> allocated inodes in that cluster.
>
> Refactor xfs_bulkstat() with it.
>
> Signed-off-by: Jie Liu<jeff.liu@oracle.com>
> ---

Had some problems applying this patch.
...

> +STATIC void
> +xfs_bulkstat_ichunk_ra(
> +	struct xfs_mount		*mp,
> +	xfs_agnumber_t			agno,
> +	struct xfs_inobt_rec_incore	*irec)
> +{
> +	xfs_agblock_t			agbno;
> +	struct blk_plug			plug;
> +	int				blks_per_cluster;
> +	int				inodes_per_cluster;
> +	int				i;	/* inode chunk index */
> +
> +	agbno = XFS_AGINO_TO_AGBNO(mp, irec->ir_startino);
> +	blks_per_cluster = xfs_icluster_size_fsb(mp);
                            ^^^^^
does not exist.


> @@ -187,7 +218,6 @@ xfs_bulkstat(
>   	char			__user *ubuffer, /* buffer with inode stats */
>   	int			*done)	/* 1 if there are more stats to get */
>   {
> -	xfs_agblock_t		agbno=0;/* allocation group block number */
>   	xfs_buf_t		*agbp;	/* agi header buffer */
>   	xfs_agi_t		*agi;	/* agi header data */
>   	xfs_agino_t		agino;	/* inode # in allocation group */
> @@ -206,8 +236,6 @@ xfs_bulkstat(
>   	xfs_inobt_rec_incore_t	*irbuf;	/* start of irec buffer */
>   	xfs_inobt_rec_incore_t	*irbufend; /* end of good irec buffer entries */
>   	xfs_ino_t		lastino; /* last inode number returned */
> -	int			blks_per_cluster; /* # of blocks per cluster */
> -	int			inodes_per_cluster;/* # of inodes per cluster */
>   	int			nirbuf;	/* size of irbuf */
>   	int			rval;	/* return value error code */
>   	int			tmp;	/* result value from btree calls */
> @@ -236,8 +264,6 @@ xfs_bulkstat(
>   	*done = 0;
>   	fmterror = 0;
>   	ubufp = ubuffer;
> -	blks_per_cluster = xfs_icluster_size_fsb(mp);
> -	inodes_per_cluster = blks_per_cluster<<  mp->m_sb.sb_inopblog;
>   	irbuf = kmem_zalloc_greedy(&irbsize, PAGE_SIZE, PAGE_SIZE * 4);
>   	if (!irbuf)
>   		return ENOMEM;
> @@ -345,25 +371,7 @@ xfs_bulkstat(
>   			 * Also start read-ahead now for this chunk.
>   			 */
>   			if (r.ir_freecount<  XFS_INODES_PER_CHUNK) {
> -				struct blk_plug	plug;
> -				/*
> -				 * Loop over all clusters in the next chunk.
> -				 * Do a readahead if there are any allocated
> -				 * inodes in that cluster.
> -				 */
> -				blk_start_plug(&plug);
> -				agbno = XFS_AGINO_TO_AGBNO(mp, r.ir_startino);
> -				for (chunkidx = 0;
> -				     chunkidx<  XFS_INODES_PER_CHUNK;
> -				     chunkidx += inodes_per_cluster,
> -				     agbno += blks_per_cluster) {
> -					if (xfs_inobt_maskn(chunkidx,
> -					    inodes_per_cluster)&  ~r.ir_free)
> -						xfs_btree_reada_bufs(mp, agno,
> -							agbno, blks_per_cluster,
> -							&xfs_inode_buf_ops);
> -				}
> -				blk_finish_plug(&plug);
> +				xfs_bulkstat_ichunk_ra(mp, agno,&r);
>   				irbp->ir_startino = r.ir_startino;
>   				irbp->ir_freecount = r.ir_freecount;
>   				irbp->ir_free = r.ir_free;

last 3 chunks failed to apply because the sources have 
nbcluster/nicluster (and nimask) instead of 
blks_per_cluster/inodes_per_cluster.

--Mark.

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

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

* Re: [PATCH 6/10] xfs: introduce xfs_bulkstat_ichunk_ra
  2013-12-30 16:57 ` Mark Tinguely
@ 2013-12-31  9:46   ` Jeff Liu
  0 siblings, 0 replies; 3+ messages in thread
From: Jeff Liu @ 2013-12-31  9:46 UTC (permalink / raw)
  To: Mark Tinguely; +Cc: xfs@oss.sgi.com

On 2013年12月31日 00:57, Mark Tinguely wrote:
> On 12/28/13 05:22, Jeff Liu wrote:
>> From: Jie Liu<jeff.liu@oracle.com>
>>
>> Introduce xfs_bulkstat_ichunk_ra() to loop over all clusters in
>> the next inode chunk, then performs readahead if there are any
>> allocated inodes in that cluster.
>>
>> Refactor xfs_bulkstat() with it.
>>
>> Signed-off-by: Jie Liu<jeff.liu@oracle.com>
>> ---
> 
> Had some problems applying this patch.
> ...
> 
>> +STATIC void
>> +xfs_bulkstat_ichunk_ra(
>> +    struct xfs_mount        *mp,
>> +    xfs_agnumber_t            agno,
>> +    struct xfs_inobt_rec_incore    *irec)
>> +{
>> +    xfs_agblock_t            agbno;
>> +    struct blk_plug            plug;
>> +    int                blks_per_cluster;
>> +    int                inodes_per_cluster;
>> +    int                i;    /* inode chunk index */
>> +
>> +    agbno = XFS_AGINO_TO_AGBNO(mp, irec->ir_startino);
>> +    blks_per_cluster = xfs_icluster_size_fsb(mp);
>                            ^^^^^
> does not exist.
This patch series is based on my previous code refactoring of
introducing xfs_icluster_size_fsb() helper.  I guess you would
apply this patch on top of that without the current problems.

Thanks,
-Jeff

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

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

end of thread, other threads:[~2013-12-31  9:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-28 11:22 [PATCH 6/10] xfs: introduce xfs_bulkstat_ichunk_ra Jeff Liu
2013-12-30 16:57 ` Mark Tinguely
2013-12-31  9:46   ` Jeff Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).