Re: [PATCH 15/71] xfs: create refcount update intent log items

Christoph Hellwig <[email protected]>
Newsgroups gmane.comp.file-systems.xfs.general
Message-ID <[email protected]>
> +/*
> + * This is the structure used to lay out a cui log item in the
> + * log.  The cui_extents field is a variable size array whose
> + * size is given by cui_nextents.
> + */
> +struct xfs_cui_log_format {
> +	__uint16_t		cui_type;	/* cui log item type */
> +	__uint16_t		cui_size;	/* size of this item */
> +	__uint32_t		cui_nextents;	/* # extents to free */
> +	__uint64_t		cui_id;		/* cui identifier */
> +	struct xfs_phys_extent	cui_extents[1];	/* array of extents */

Please define this as a proper variable length extent, e.g.

	struct xfs_phys_extent	cui_extents[];

and get rid of the one-off arithmentics in xfs_cui_copy_format and
xfs_cui_init.

> +int
> +xfs_cui_copy_format(
> +	struct xfs_log_iovec		*buf,
> +	struct xfs_cui_log_format	*dst_cui_fmt)
> +{
> +	struct xfs_cui_log_format	*src_cui_fmt;
> +	uint				len;
> +
> +	src_cui_fmt = buf->i_addr;
> +	len = sizeof(struct xfs_cui_log_format) +
> +			(src_cui_fmt->cui_nextents - 1) *
> +			sizeof(struct xfs_phys_extent);
> +
> +	if (buf->i_len == len) {
> +		memcpy((char *)dst_cui_fmt, (char *)src_cui_fmt, len);
> +		return 0;
> +	}
> +	return -EFSCORRUPTED;


Wouldn't life be a simpler if we simply opencoded this in
xlog_recover_cui_pass2?  Also no need for the casts in the memcpy
arguments.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.