> + * 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