Commit 13d2c10b authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Darrick J. Wong
Browse files

xfs: move the di_size field to struct xfs_inode



In preparation of removing the historic icinode struct, move the on-disk
size field into the containing xfs_inode structure.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
parent ceaf603c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1440,7 +1440,7 @@ xfs_bmap_last_offset(

/*
 * Returns whether the selected fork of the inode has exactly one
 * block or not.  For the data fork we check this matches di_size,
 * block or not.  For the data fork we check this matches i_disk_size,
 * implying the file's range is 0..bsize-1.
 */
int					/* 1=>1 block, 0=>otherwise */
+7 −7
Original line number Diff line number Diff line
@@ -179,9 +179,9 @@ xfs_dir_isempty(
	xfs_dir2_sf_hdr_t	*sfp;

	ASSERT(S_ISDIR(VFS_I(dp)->i_mode));
	if (dp->i_d.di_size == 0)	/* might happen during shutdown. */
	if (dp->i_disk_size == 0)	/* might happen during shutdown. */
		return 1;
	if (dp->i_d.di_size > XFS_IFORK_DSIZE(dp))
	if (dp->i_disk_size > XFS_IFORK_DSIZE(dp))
		return 0;
	sfp = (xfs_dir2_sf_hdr_t *)dp->i_df.if_u1.if_data;
	return !sfp->count;
@@ -584,8 +584,8 @@ xfs_dir2_grow_inode(
		xfs_fsize_t	size;		/* directory file (data) size */

		size = XFS_FSB_TO_B(mp, bno + count);
		if (size > dp->i_d.di_size) {
			dp->i_d.di_size = size;
		if (size > dp->i_disk_size) {
			dp->i_disk_size = size;
			xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE);
		}
	}
@@ -608,7 +608,7 @@ xfs_dir2_isblock(
	rval = XFS_FSB_TO_B(args->dp->i_mount, last) == args->geo->blksize;
	if (XFS_IS_CORRUPT(args->dp->i_mount,
			   rval != 0 &&
			   args->dp->i_d.di_size != args->geo->blksize))
			   args->dp->i_disk_size != args->geo->blksize))
		return -EFSCORRUPTED;
	*vp = rval;
	return 0;
@@ -687,7 +687,7 @@ xfs_dir2_shrink_inode(
	/*
	 * If the block isn't the last one in the directory, we're done.
	 */
	if (dp->i_d.di_size > xfs_dir2_db_off_to_byte(args->geo, db + 1, 0))
	if (dp->i_disk_size > xfs_dir2_db_off_to_byte(args->geo, db + 1, 0))
		return 0;
	bno = da;
	if ((error = xfs_bmap_last_before(tp, dp, &bno, XFS_DATA_FORK))) {
@@ -703,7 +703,7 @@ xfs_dir2_shrink_inode(
	/*
	 * Set the size to the new last block.
	 */
	dp->i_d.di_size = XFS_FSB_TO_B(mp, bno);
	dp->i_disk_size = XFS_FSB_TO_B(mp, bno);
	xfs_trans_log_inode(tp, dp, XFS_ILOG_CORE);
	return 0;
}
+5 −5
Original line number Diff line number Diff line
@@ -961,7 +961,7 @@ xfs_dir2_leaf_to_block(
	 * been left behind during no-space-reservation operations.
	 * These will show up in the leaf bests table.
	 */
	while (dp->i_d.di_size > args->geo->blksize) {
	while (dp->i_disk_size > args->geo->blksize) {
		int hdrsz;

		hdrsz = args->geo->data_entry_offset;
@@ -1097,13 +1097,13 @@ xfs_dir2_sf_to_block(
	trace_xfs_dir2_sf_to_block(args);

	ASSERT(ifp->if_flags & XFS_IFINLINE);
	ASSERT(dp->i_d.di_size >= offsetof(struct xfs_dir2_sf_hdr, parent));
	ASSERT(dp->i_disk_size >= offsetof(struct xfs_dir2_sf_hdr, parent));

	oldsfp = (xfs_dir2_sf_hdr_t *)ifp->if_u1.if_data;

	ASSERT(ifp->if_bytes == dp->i_d.di_size);
	ASSERT(ifp->if_bytes == dp->i_disk_size);
	ASSERT(ifp->if_u1.if_data != NULL);
	ASSERT(dp->i_d.di_size >= xfs_dir2_sf_hdr_size(oldsfp->i8count));
	ASSERT(dp->i_disk_size >= xfs_dir2_sf_hdr_size(oldsfp->i8count));
	ASSERT(dp->i_df.if_nextents == 0);

	/*
@@ -1115,7 +1115,7 @@ xfs_dir2_sf_to_block(

	xfs_idata_realloc(dp, -ifp->if_bytes, XFS_DATA_FORK);
	xfs_bmap_local_to_extents_empty(tp, dp, XFS_DATA_FORK);
	dp->i_d.di_size = 0;
	dp->i_disk_size = 0;

	/*
	 * Add block 0 to the inode.
+1 −1
Original line number Diff line number Diff line
@@ -152,7 +152,7 @@ xfs_dir3_leaf_check_int(
	/*
	 * XXX (dgc): This value is not restrictive enough.
	 * Should factor in the size of the bests table as well.
	 * We can deduce a value for that from di_size.
	 * We can deduce a value for that from i_disk_size.
	 */
	if (hdr->count > geo->leaf_max_ents)
		return __this_address;
+1 −1
Original line number Diff line number Diff line
@@ -441,7 +441,7 @@ xfs_dir2_leaf_to_node(
	leaf = lbp->b_addr;
	ltp = xfs_dir2_leaf_tail_p(args->geo, leaf);
	if (be32_to_cpu(ltp->bestcount) >
				(uint)dp->i_d.di_size / args->geo->blksize) {
				(uint)dp->i_disk_size / args->geo->blksize) {
		xfs_buf_mark_corrupt(lbp);
		return -EFSCORRUPTED;
	}
Loading