xfs
[Top] [All Lists]

Re: [PATCH 05/18] xfs: create macros/helpers for dealing with sparse ino

To: Brian Foster <bfoster@xxxxxxxxxx>
Subject: Re: [PATCH 05/18] xfs: create macros/helpers for dealing with sparse inode chunks
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Fri, 25 Jul 2014 08:13:41 +1000
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1406211788-63206-6-git-send-email-bfoster@xxxxxxxxxx>
References: <1406211788-63206-1-git-send-email-bfoster@xxxxxxxxxx> <1406211788-63206-6-git-send-email-bfoster@xxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Thu, Jul 24, 2014 at 10:22:55AM -0400, Brian Foster wrote:
> Sparse inode chunks allow the traditional inode btree record format to
> describe an inode chunk that is not fully allocated and/or contiguous.
> Define a couple constants that set requirements for allocation and
> management of such chunks. Also define a helper to easily detect sparse
> inode chunks.
> 
> The granularity of a sparse chunk is defined by the the 16-bit holemask
> field in the inode record. Assuming 64 inodes per full chunk, a single
> holemask bit accounts for 4 inodes. The minimum allocation requirement
> for a sparse inode chunk is defined as the minimum number of blocks
> required to meet the 4 inode granularity.
> 
> Signed-off-by: Brian Foster <bfoster@xxxxxxxxxx>
> ---
>  fs/xfs/libxfs/xfs_format.h | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h
> index 39022d9..0baad50 100644
> --- a/fs/xfs/libxfs/xfs_format.h
> +++ b/fs/xfs/libxfs/xfs_format.h
> @@ -211,6 +211,11 @@ typedef  __uint64_t      xfs_inofree_t;
>  #define      XFS_INOBT_ALL_FREE              ((xfs_inofree_t)-1)
>  #define      XFS_INOBT_MASK(i)               ((xfs_inofree_t)1 << (i))
>  
> +#define XFS_INODES_PER_SPCHUNK               \
> +     (XFS_INODES_PER_CHUNK / (NBBY * sizeof(__uint16_t)))
> +#define XFS_INOBT_MIN_SPCHUNKLEN(sb) \
> +     (roundup(XFS_INODES_PER_SPCHUNK, sb.sb_inopblock) / sb.sb_inopblock)

static inline.

-Dave.

-- 
Dave Chinner
david@xxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>