Re: [PATCH 21/63] xfs: map an inode's offset to an exact physical block

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> + * For a remap operation, just "allocate" an extent at the address that the
> + * caller passed in, and ensure that the AGFL is the right size.  The caller
> + * will then map the "allocated" extent into the file somewhere.
> + */
> +STATIC int
> +xfs_bmap_remap_alloc(
> +	struct xfs_bmalloca	*ap)
> +{
> +	struct xfs_trans	*tp = ap->tp;
> +	struct xfs_mount	*mp = tp->t_mountp;
> +	xfs_agblock_t		bno;
> +	struct xfs_alloc_arg	args;
> +	int			error;
> +
> +	/*
> +	 * validate that the block number is legal - the enables us to detect
> +	 * and handle a silent filesystem corruption rather than crashing.
> +	 */
> +	memset(&args, 0, sizeof(struct xfs_alloc_arg));
> +	args.tp = ap->tp;
> +	args.mp = ap->tp->t_mountp;
> +	bno = *ap->firstblock;
> +	args.agno = XFS_FSB_TO_AGNO(mp, bno);
> +	ASSERT(args.agno < mp->m_sb.sb_agcount);
> +	args.agbno = XFS_FSB_TO_AGBNO(mp, bno);
> +	ASSERT(args.agbno < mp->m_sb.sb_agblocks);

Shouldn't this return -EFSCORRUPED instead?  Otherwise the comment
above isn't really true.

Otherwise this looks fine to me:

Reviewed-by: Christoph Hellwig <hch@xxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux