| To: | "Darrick J. Wong" <darrick.wong@xxxxxxxxxx> |
|---|---|
| Subject: | Re: [PATCH 15/71] xfs: create refcount update intent log items |
| From: | Christoph Hellwig <hch@xxxxxxxxxxxxx> |
| Date: | Tue, 6 Sep 2016 08:16:03 -0700 |
| Cc: | david@xxxxxxxxxxxxx, linux-xfs@xxxxxxxxxxxxxxx, xfs@xxxxxxxxxxx |
| Delivered-to: | xfs@xxxxxxxxxxx |
| In-reply-to: | <147216801436.867.13017543869659604138.stgit@xxxxxxxxxxxxxxxx> |
| References: | <147216791538.867.12413509832420924168.stgit@xxxxxxxxxxxxxxxx> <147216801436.867.13017543869659604138.stgit@xxxxxxxxxxxxxxxx> |
| User-agent: | Mutt/1.6.1 (2016-04-27) |
> +/*
> + * 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.
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: [PATCH 14/71] xfs: add refcount btree operations, Christoph Hellwig |
|---|---|
| Next by Date: | Re: [PATCH 16/71] xfs: log refcount intent items, Christoph Hellwig |
| Previous by Thread: | Re: [PATCH 14/71] xfs: add refcount btree operations, Christoph Hellwig |
| Next by Thread: | Re: [PATCH 15/71] xfs: create refcount update intent log items, Darrick J. Wong |
| Indexes: | [Date] [Thread] [Top] [All Lists] |