Skip to content

Commit d3cc8b1

Browse files
wcabehlendorf
authored andcommitted
Illumos #3742
3742 zfs comments need cleaner, more consistent style Reviewed by: Matthew Ahrens <mahrens@delphix.com> Reviewed by: George Wilson <george.wilson@delphix.com> Reviewed by: Eric Schrock <eric.schrock@delphix.com> Approved by: Christopher Siden <christopher.siden@delphix.com> References: https://www.illumos.org/issues/3742 illumos/illumos-gate@f717074 Ported-by: Richard Yao <ryao@gentoo.org> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Issue #1775 Porting notes: 1. The change to zfs_vfsops.c was dropped because it involves zfs_mount_label_policy, which does not exist in the Linux port.
1 parent e49f1e2 commit d3cc8b1

37 files changed

+182
-201
lines changed

include/sys/ddt.h

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,15 @@ enum ddt_class {
6363
*/
6464
typedef struct ddt_key {
6565
zio_cksum_t ddk_cksum; /* 256-bit block checksum */
66-
uint64_t ddk_prop; /* LSIZE, PSIZE, compression */
66+
/*
67+
* Encoded with logical & physical size, and compression, as follows:
68+
* +-------+-------+-------+-------+-------+-------+-------+-------+
69+
* | 0 | 0 | 0 | comp | PSIZE | LSIZE |
70+
* +-------+-------+-------+-------+-------+-------+-------+-------+
71+
*/
72+
uint64_t ddk_prop;
6773
} ddt_key_t;
6874

69-
/*
70-
* ddk_prop layout:
71-
*
72-
* +-------+-------+-------+-------+-------+-------+-------+-------+
73-
* | 0 | 0 | 0 | comp | PSIZE | LSIZE |
74-
* +-------+-------+-------+-------+-------+-------+-------+-------+
75-
*/
7675
#define DDK_GET_LSIZE(ddk) \
7776
BF64_GET_SB((ddk)->ddk_prop, 0, 16, SPA_MINBLOCKSHIFT, 1)
7877
#define DDK_SET_LSIZE(ddk, x) \

include/sys/dnode.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,8 @@ typedef struct dnode_phys {
145145

146146
typedef struct dnode {
147147
/*
148-
* dn_struct_rwlock protects the structure of the dnode,
149-
* including the number of levels of indirection (dn_nlevels),
150-
* dn_maxblkid, and dn_next_*
148+
* Protects the structure of the dnode, including the number of levels
149+
* of indirection (dn_nlevels), dn_maxblkid, and dn_next_*
151150
*/
152151
krwlock_t dn_struct_rwlock;
153152

include/sys/dsl_pool.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ typedef struct dsl_pool {
112112

113113
/*
114114
* Protects administrative changes (properties, namespace)
115+
*
115116
* It is only held for write in syncing context. Therefore
116117
* syncing context does not need to ever have it for read, since
117118
* nobody else could possibly have it for write.

include/sys/sa_impl.h

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ struct sa_os {
150150

151151
/*
152152
* header for all bonus and spill buffers.
153+
*
153154
* The header has a fixed portion with a variable number
154155
* of "lengths" depending on the number of variable sized
155156
* attribues which are determined by the "layout number"
@@ -158,29 +159,27 @@ struct sa_os {
158159
#define SA_MAGIC 0x2F505A /* ZFS SA */
159160
typedef struct sa_hdr_phys {
160161
uint32_t sa_magic;
161-
uint16_t sa_layout_info; /* Encoded with hdrsize and layout number */
162+
/*
163+
* Encoded with hdrsize and layout number as follows:
164+
* 16 10 0
165+
* +--------+-------+
166+
* | hdrsz |layout |
167+
* +--------+-------+
168+
*
169+
* Bits 0-10 are the layout number
170+
* Bits 11-16 are the size of the header.
171+
* The hdrsize is the number * 8
172+
*
173+
* For example.
174+
* hdrsz of 1 ==> 8 byte header
175+
* 2 ==> 16 byte header
176+
*
177+
*/
178+
uint16_t sa_layout_info;
162179
uint16_t sa_lengths[1]; /* optional sizes for variable length attrs */
163180
/* ... Data follows the lengths. */
164181
} sa_hdr_phys_t;
165182

166-
/*
167-
* sa_hdr_phys -> sa_layout_info
168-
*
169-
* 16 10 0
170-
* +--------+-------+
171-
* | hdrsz |layout |
172-
* +--------+-------+
173-
*
174-
* Bits 0-10 are the layout number
175-
* Bits 11-16 are the size of the header.
176-
* The hdrsize is the number * 8
177-
*
178-
* For example.
179-
* hdrsz of 1 ==> 8 byte header
180-
* 2 ==> 16 byte header
181-
*
182-
*/
183-
184183
#define SA_HDR_LAYOUT_NUM(hdr) BF32_GET(hdr->sa_layout_info, 0, 10)
185184
#define SA_HDR_SIZE(hdr) BF32_GET_SB(hdr->sa_layout_info, 10, 6, 3, 0)
186185
#define SA_HDR_LAYOUT_INFO_ENCODE(x, num, size) \

include/sys/spa_impl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ struct spa {
239239
spa_stats_t spa_stats; /* assorted spa statistics */
240240

241241
/*
242-
* spa_refcnt & spa_config_lock must be the last elements
242+
* spa_refcount & spa_config_lock must be the last elements
243243
* because refcount_t changes size based on compilation options.
244244
* In order for the MDB module to function correctly, the other
245245
* fields must remain in the same location.

include/sys/space_map.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ struct space_map_ops {
9494
* 63 62 60 59 50 49 0
9595
*
9696
*
97-
*
9897
* non-debug entry
9998
*
10099
* 1 47 1 15

include/sys/unique.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
#ifndef _SYS_UNIQUE_H
2727
#define _SYS_UNIQUE_H
2828

29-
30-
3129
#include <sys/zfs_context.h>
3230

3331
#ifdef __cplusplus
@@ -42,7 +40,7 @@ void unique_fini(void);
4240

4341
/*
4442
* Return a new unique value (which will not be uniquified against until
45-
* it is unique_insert()-ed.
43+
* it is unique_insert()-ed).
4644
*/
4745
uint64_t unique_create(void);
4846

include/sys/vdev_impl.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,12 +254,13 @@ typedef struct vdev_label {
254254
#define VDD_METASLAB 0x01
255255
#define VDD_DTL 0x02
256256

257+
/* Offset of embedded boot loader region on each label */
258+
#define VDEV_BOOT_OFFSET (2 * sizeof (vdev_label_t))
257259
/*
258-
* Size and offset of embedded boot loader region on each label.
260+
* Size of embedded boot loader region on each label.
259261
* The total size of the first two labels plus the boot area is 4MB.
260262
*/
261-
#define VDEV_BOOT_OFFSET (2 * sizeof (vdev_label_t))
262-
#define VDEV_BOOT_SIZE (7ULL << 19) /* 3.5M */
263+
#define VDEV_BOOT_SIZE (7ULL << 19) /* 3.5M */
263264

264265
/*
265266
* Size of label regions at the start and end of each leaf device.
@@ -326,8 +327,9 @@ extern uint64_t vdev_get_min_asize(vdev_t *vd);
326327
extern void vdev_set_min_asize(vdev_t *vd);
327328

328329
/*
329-
* zdb uses this tunable, so it must be declared here to make lint happy.
330+
* Global variables
330331
*/
332+
/* zdb uses this tunable, so it must be declared here to make lint happy. */
331333
extern int zfs_vdev_cache_size;
332334

333335
#ifdef __cplusplus

include/sys/zap.h

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -86,18 +86,22 @@ extern "C" {
8686
#endif
8787

8888
/*
89-
* The matchtype specifies which entry will be accessed.
90-
* MT_EXACT: only find an exact match (non-normalized)
91-
* MT_FIRST: find the "first" normalized (case and Unicode
92-
* form) match; the designated "first" match will not change as long
93-
* as the set of entries with this normalization doesn't change
94-
* MT_BEST: if there is an exact match, find that, otherwise find the
95-
* first normalized match
89+
* Specifies matching criteria for ZAP lookups.
9690
*/
9791
typedef enum matchtype
9892
{
93+
/* Only find an exact match (non-normalized) */
9994
MT_EXACT,
95+
/*
96+
* If there is an exact match, find that, otherwise find the
97+
* first normalized match.
98+
*/
10099
MT_BEST,
100+
/*
101+
* Find the "first" normalized (case and Unicode form) match;
102+
* the designated "first" match will not change as long as the
103+
* set of entries with this normalization doesn't change.
104+
*/
101105
MT_FIRST
102106
} matchtype_t;
103107

@@ -174,25 +178,28 @@ int zap_destroy(objset_t *ds, uint64_t zapobj, dmu_tx_t *tx);
174178
* call will fail and return EINVAL.
175179
*
176180
* If 'integer_size' is equal to or larger than the attribute's integer
177-
* size, the call will succeed and return 0. * When converting to a
178-
* larger integer size, the integers will be treated as unsigned (ie. no
179-
* sign-extension will be performed).
181+
* size, the call will succeed and return 0.
182+
*
183+
* When converting to a larger integer size, the integers will be treated as
184+
* unsigned (ie. no sign-extension will be performed).
180185
*
181186
* 'num_integers' is the length (in integers) of 'buf'.
182187
*
183188
* If the attribute is longer than the buffer, as many integers as will
184189
* fit will be transferred to 'buf'. If the entire attribute was not
185190
* transferred, the call will return EOVERFLOW.
186-
*
191+
*/
192+
int zap_lookup(objset_t *ds, uint64_t zapobj, const char *name,
193+
uint64_t integer_size, uint64_t num_integers, void *buf);
194+
195+
/*
187196
* If rn_len is nonzero, realname will be set to the name of the found
188197
* entry (which may be different from the requested name if matchtype is
189198
* not MT_EXACT).
190199
*
191200
* If normalization_conflictp is not NULL, it will be set if there is
192201
* another name with the same case/unicode normalized form.
193202
*/
194-
int zap_lookup(objset_t *ds, uint64_t zapobj, const char *name,
195-
uint64_t integer_size, uint64_t num_integers, void *buf);
196203
int zap_lookup_norm(objset_t *ds, uint64_t zapobj, const char *name,
197204
uint64_t integer_size, uint64_t num_integers, void *buf,
198205
matchtype_t mt, char *realname, int rn_len,

include/sys/zap_leaf.h

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ typedef enum zap_chunk_type {
101101
*/
102102
typedef struct zap_leaf_phys {
103103
struct zap_leaf_header {
104+
/* Public to ZAP */
104105
uint64_t lh_block_type; /* ZBT_LEAF */
105106
uint64_t lh_pad1;
106107
uint64_t lh_prefix; /* hash prefix of this leaf */
@@ -109,8 +110,7 @@ typedef struct zap_leaf_phys {
109110
uint16_t lh_nentries; /* number of entries */
110111
uint16_t lh_prefix_len; /* num bits used to id this */
111112

112-
/* above is accessable to zap, below is zap_leaf private */
113-
113+
/* Private to zap_leaf */
114114
uint16_t lh_freelist; /* chunk head of free list */
115115
uint8_t lh_flags; /* ZLF_* flags */
116116
uint8_t lh_pad2[11];
@@ -161,13 +161,13 @@ typedef struct zap_leaf {
161161

162162

163163
typedef struct zap_entry_handle {
164-
/* below is set by zap_leaf.c and is public to zap.c */
164+
/* Set by zap_leaf and public to ZAP */
165165
uint64_t zeh_num_integers;
166166
uint64_t zeh_hash;
167167
uint32_t zeh_cd;
168168
uint8_t zeh_integer_size;
169169

170-
/* below is private to zap_leaf.c */
170+
/* Private to zap_leaf */
171171
uint16_t zeh_fakechunk;
172172
uint16_t *zeh_chunkp;
173173
zap_leaf_t *zeh_leaf;
@@ -202,7 +202,7 @@ extern int zap_entry_read_name(struct zap *zap, const zap_entry_handle_t *zeh,
202202
/*
203203
* Replace the value of an existing entry.
204204
*
205-
* zap_entry_update may fail if it runs out of space (ENOSPC).
205+
* May fail if it runs out of space (ENOSPC).
206206
*/
207207
extern int zap_entry_update(zap_entry_handle_t *zeh,
208208
uint8_t integer_size, uint64_t num_integers, const void *buf);
@@ -221,10 +221,7 @@ extern int zap_entry_create(zap_leaf_t *l, struct zap_name *zn, uint32_t cd,
221221
uint8_t integer_size, uint64_t num_integers, const void *buf,
222222
zap_entry_handle_t *zeh);
223223

224-
/*
225-
* Return true if there are additional entries with the same normalized
226-
* form.
227-
*/
224+
/* Determine whether there is another entry with the same normalized form. */
228225
extern boolean_t zap_entry_normalization_conflict(zap_entry_handle_t *zeh,
229226
struct zap_name *zn, const char *name, struct zap *zap);
230227

0 commit comments

Comments
 (0)