Skip to content

Commit

Permalink
5038 Remove "old-style" flexible array usage in ZFS.
Browse files Browse the repository at this point in the history
Reviewed by: Matthew Ahrens <[email protected]>
Reviewed by: Josef 'Jeff' Sipek <[email protected]>
Approved by: Richard Lowe <[email protected]>
  • Loading branch information
Justin T. Gibbs authored and Christopher Siden committed Aug 2, 2014
1 parent 539eed8 commit 7f18da4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions usr/src/uts/common/fs/zfs/dnode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,7 @@ dnode_buf_pageout(dmu_buf_t *db, void *arg)
dnh->dnh_dnode = NULL;
}
kmem_free(children_dnodes, sizeof (dnode_children_t) +
(epb - 1) * sizeof (dnode_handle_t));
epb * sizeof (dnode_handle_t));
}

/*
Expand Down Expand Up @@ -1106,7 +1106,7 @@ dnode_hold_impl(objset_t *os, uint64_t object, int flag,
int i;
dnode_children_t *winner;
children_dnodes = kmem_alloc(sizeof (dnode_children_t) +
(epb - 1) * sizeof (dnode_handle_t), KM_SLEEP);
epb * sizeof (dnode_handle_t), KM_SLEEP);
children_dnodes->dnc_count = epb;
dnh = &children_dnodes->dnc_children[0];
for (i = 0; i < epb; i++) {
Expand All @@ -1121,7 +1121,7 @@ dnode_hold_impl(objset_t *os, uint64_t object, int flag,
}

kmem_free(children_dnodes, sizeof (dnode_children_t) +
(epb - 1) * sizeof (dnode_handle_t));
epb * sizeof (dnode_handle_t));
children_dnodes = winner;
}
}
Expand Down
2 changes: 1 addition & 1 deletion usr/src/uts/common/fs/zfs/sys/dnode.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ typedef struct dnode_handle {

typedef struct dnode_children {
size_t dnc_count; /* number of children */
dnode_handle_t dnc_children[1]; /* sized dynamically */
dnode_handle_t dnc_children[]; /* sized dynamically */
} dnode_children_t;

typedef struct free_range {
Expand Down

0 comments on commit 7f18da4

Please sign in to comment.