All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 05/24] xfs: define the on-disk refcount btree format
Date: Thu, 30 Jul 2015 10:42:15 +1000	[thread overview]
Message-ID: <20150730004215.GI16638@dastard> (raw)
In-Reply-To: <20150729223330.17414.82692.stgit@birch.djwong.org>

On Wed, Jul 29, 2015 at 03:33:30PM -0700, Darrick J. Wong wrote:
> Start constructing the refcount btree implementation by establishing
> the on-disk format and everything needed to read, write, and
> manipulate the refcount btree blocks.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
....
> +STATIC bool
> +xfs_refcountbt_verify(
> +	struct xfs_buf		*bp)

feel free to shorten that prefix to xfs_refcbt_.....

> +{
> +	struct xfs_mount	*mp = bp->b_target->bt_mount;
> +	struct xfs_btree_block	*block = XFS_BUF_TO_BLOCK(bp);
> +	struct xfs_perag	*pag = bp->b_pag;
> +	unsigned int		level;
> +
> +	if (block->bb_magic != cpu_to_be32(XFS_REFC_CRC_MAGIC))
> +		return false;
> +
> +	if (!xfs_sb_version_hasreflink(&mp->m_sb))
> +		return false;
> +	if (!uuid_equal(&block->bb_u.s.bb_uuid, &mp->m_sb.sb_uuid))
> +		return false;
> +	if (block->bb_u.s.bb_blkno != cpu_to_be64(bp->b_bn))
> +		return false;
> +	if (pag &&
> +	    be32_to_cpu(block->bb_u.s.bb_owner) != pag->pag_agno)
> +		return false;
> +
> +	level = be16_to_cpu(block->bb_level);
> +	if (pag && pag->pagf_init) {
> +		if (level >= pag->pagf_refcount_level)
> +			return false;
> +	} else if (level >= mp->m_ag_maxlevels)
> +		return false;
> +
> +	/* numrecs verification */
> +	if (be16_to_cpu(block->bb_numrecs) > mp->m_refc_mxr[level != 0])
> +		return false;
> +
> +	/* sibling pointer verification */
> +	if (!block->bb_u.s.bb_leftsib ||
> +	    (be32_to_cpu(block->bb_u.s.bb_leftsib) >= mp->m_sb.sb_agblocks &&
> +	     block->bb_u.s.bb_leftsib != cpu_to_be32(NULLAGBLOCK)))
> +		return false;
> +	if (!block->bb_u.s.bb_rightsib ||
> +	    (be32_to_cpu(block->bb_u.s.bb_rightsib) >= mp->m_sb.sb_agblocks &&
> +	     block->bb_u.s.bb_rightsib != cpu_to_be32(NULLAGBLOCK)))
> +		return false;

I'm starting to think there's a xfs_btree_sblock_verify() function
we need to factor out of all these btree verification functions...

> +#ifndef __XFS_REFCOUNT_BTREE_H__
> +#define	__XFS_REFCOUNT_BTREE_H__
> +
> +/*
> + * Freespace on-disk structures
> + */
> +
> +struct xfs_buf;
> +struct xfs_btree_cur;
> +struct xfs_mount;
> +
> +/*
> + * Btree block header size depends on a superblock flag.
> + */
> +#define XFS_REFCOUNT_BLOCK_LEN	XFS_BTREE_SBLOCK_CRC_LEN

Comment is stale.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

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

  reply	other threads:[~2015-07-30  0:42 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-29 22:32 [RFC v2 00/24] xfs: add reflink and dedupe support Darrick J. Wong
2015-07-29 22:33 ` [PATCH 01/24] xfs: introduce refcount btree definitions Darrick J. Wong
2015-07-29 22:33 ` [PATCH 02/24] xfs: define tracepoints for refcount/reflink activities Darrick J. Wong
2015-07-29 22:33 ` [PATCH 03/24] xfs: add refcount btree stats infrastructure Darrick J. Wong
2015-07-30  0:34   ` Dave Chinner
2015-07-30 19:04     ` Darrick J. Wong
2015-07-29 22:33 ` [PATCH 04/24] xfs: refcount btree add more reserved blocks Darrick J. Wong
2015-07-30  0:35   ` Dave Chinner
2015-07-30 19:09     ` Darrick J. Wong
2015-07-29 22:33 ` [PATCH 05/24] xfs: define the on-disk refcount btree format Darrick J. Wong
2015-07-30  0:42   ` Dave Chinner [this message]
2015-07-30 22:14     ` Darrick J. Wong
2015-07-29 22:33 ` [PATCH 06/24] xfs: add refcount btree support to growfs Darrick J. Wong
2015-07-29 22:33 ` [PATCH 07/24] xfs: add refcount btree operations Darrick J. Wong
2015-07-30  0:51   ` Dave Chinner
2015-07-29 22:33 ` [PATCH 08/24] libxfs: adjust refcount of an extent of blocks in refcount btree Darrick J. Wong
2015-07-29 22:33 ` [PATCH 09/24] libxfs: adjust refcount when unmapping file blocks Darrick J. Wong
2015-07-29 22:34 ` [PATCH 10/24] xfs: add refcount btree block detection to log recovery Darrick J. Wong
2015-07-29 22:34 ` [PATCH 11/24] xfs: map an inode's offset to an exact physical block Darrick J. Wong
2015-07-30  1:04   ` Dave Chinner
2015-07-30 21:09     ` Darrick J. Wong
2015-07-29 22:34 ` [PATCH 12/24] xfs: add reflink feature flag to geometry Darrick J. Wong
2015-07-29 22:34 ` [PATCH 13/24] xfs: create a separate workqueue for copy-on-write activities Darrick J. Wong
2015-07-29 22:34 ` [PATCH 14/24] xfs: implement copy-on-write for reflinked blocks Darrick J. Wong
2015-07-29 22:34 ` [PATCH 15/24] xfs: handle directio " Darrick J. Wong
2015-07-29 22:34 ` [PATCH 16/24] xfs: copy-on-write reflinked blocks when zeroing ranges of blocks Darrick J. Wong
2015-07-29 22:34 ` [PATCH 17/24] xfs: clear inode reflink flag when freeing blocks Darrick J. Wong
2015-07-29 22:34 ` [PATCH 18/24] xfs: reflink extents from one file to another Darrick J. Wong
2015-07-29 22:35 ` [PATCH 19/24] xfs: add clone file and clone range ioctls Darrick J. Wong
2015-07-29 22:35 ` [PATCH 20/24] xfs: emulate the btrfs dedupe extent same ioctl Darrick J. Wong
2015-07-29 22:35 ` [PATCH 21/24] xfs: teach fiemap about reflink'd extents Darrick J. Wong
2015-07-29 22:35 ` [PATCH 22/24] xfs: swap inode reflink flags when swapping inode extents Darrick J. Wong
2015-08-01 12:51   ` Josef 'Jeff' Sipek
2015-07-29 22:35 ` [PATCH 23/24] xfs: support XFS_XFLAG_REFLINK (and FS_NOCOW_FL) on reflink filesystems Darrick J. Wong
2015-07-29 22:35 ` [PATCH 24/24] xfs: recognize the reflink feature bit Darrick J. Wong
2015-08-01 13:01 ` [RFC v2 00/24] xfs: add reflink and dedupe support Josef 'Jeff' Sipek
2015-08-01 22:58   ` Dave Chinner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150730004215.GI16638@dastard \
    --to=david@fromorbit.com \
    --cc=darrick.wong@oracle.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.