Skip to content

Commit

Permalink
codebase style improvements for OpenZFS 6459 port
Browse files Browse the repository at this point in the history
  • Loading branch information
gmelikov authored and behlendorf committed Jan 22, 2017
1 parent ec441a9 commit 4ea3f86
Show file tree
Hide file tree
Showing 46 changed files with 202 additions and 135 deletions.
12 changes: 8 additions & 4 deletions cmd/zpool/zpool_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2953,7 +2953,8 @@ struct stat_array {
};

static uint64_t
stat_histo_max(struct stat_array *nva, unsigned int len) {
stat_histo_max(struct stat_array *nva, unsigned int len)
{
uint64_t max = 0;
int i;
for (i = 0; i < len; i++)
Expand All @@ -2969,7 +2970,8 @@ stat_histo_max(struct stat_array *nva, unsigned int len) {
*/
static int
nvpair64_to_stat_array(nvlist_t *nvl, const char *name,
struct stat_array *nva) {
struct stat_array *nva)
{
nvpair_t *tmp;
int ret;

Expand Down Expand Up @@ -3871,7 +3873,8 @@ is_pool(char *name)

/* Are all our argv[] strings pool names? If so return 1, 0 otherwise. */
static int
are_all_pools(int argc, char **argv) {
are_all_pools(int argc, char **argv)
{
if ((argc == 0) || !*argv)
return (0);

Expand Down Expand Up @@ -3952,7 +3955,8 @@ get_interval_count_filter_guids(int *argc, char **argv, float *interval,
* seconds.
*/
static void
fsleep(float sec) {
fsleep(float sec)
{
struct timespec req;
req.tv_sec = floor(sec);
req.tv_nsec = (sec - (float)req.tv_sec) * NANOSEC;
Expand Down
6 changes: 4 additions & 2 deletions cmd/zpool/zpool_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ num_logs(nvlist_t *nv)

/* Find the max element in an array of uint64_t values */
uint64_t
array64_max(uint64_t array[], unsigned int len) {
array64_max(uint64_t array[], unsigned int len)
{
uint64_t max = 0;
int i;
for (i = 0; i < len; i++)
Expand All @@ -102,7 +103,8 @@ array64_max(uint64_t array[], unsigned int len) {
* floating point numbers.
*/
int
isnumber(char *str) {
isnumber(char *str)
{
for (; *str; str++)
if (!(isdigit(*str) || (*str == '.')))
return (0);
Expand Down
12 changes: 8 additions & 4 deletions include/linux/vfs_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ zpl_posix_acl_release(struct posix_acl *acl)
#define zpl_forget_cached_acl(ip, ty) forget_cached_acl(ip, ty)
#else
static inline void
zpl_set_cached_acl(struct inode *ip, int type, struct posix_acl *newer) {
zpl_set_cached_acl(struct inode *ip, int type, struct posix_acl *newer)
{
struct posix_acl *older = NULL;

spin_lock(&ip->i_lock);
Expand All @@ -250,7 +251,8 @@ zpl_set_cached_acl(struct inode *ip, int type, struct posix_acl *newer) {
}

static inline void
zpl_forget_cached_acl(struct inode *ip, int type) {
zpl_forget_cached_acl(struct inode *ip, int type)
{
zpl_set_cached_acl(ip, type, (struct posix_acl *)ACL_NOT_CACHED);
}
#endif /* HAVE_SET_CACHED_ACL_USABLE */
Expand All @@ -261,7 +263,8 @@ zpl_forget_cached_acl(struct inode *ip, int type) {
#define __posix_acl_create(acl, gfp, mode) posix_acl_create(acl, gfp, mode)
#else
static inline int
__posix_acl_chmod(struct posix_acl **acl, int flags, umode_t umode) {
__posix_acl_chmod(struct posix_acl **acl, int flags, umode_t umode)
{
struct posix_acl *oldacl = *acl;
mode_t mode = umode;
int error;
Expand All @@ -282,7 +285,8 @@ __posix_acl_chmod(struct posix_acl **acl, int flags, umode_t umode) {
}

static inline int
__posix_acl_create(struct posix_acl **acl, int flags, umode_t *umodep) {
__posix_acl_create(struct posix_acl **acl, int flags, umode_t *umodep)
{
struct posix_acl *oldacl = *acl;
mode_t mode = *umodep;
int error;
Expand Down
2 changes: 2 additions & 0 deletions include/sys/trace_acl.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,11 @@ DECLARE_EVENT_CLASS(zfs_ace_class,
/* END CSTYLED */

#define DEFINE_ACE_EVENT(name) \
/* BEGIN CSTYLED */
DEFINE_EVENT(zfs_ace_class, name, \
TP_PROTO(znode_t *zn, zfs_ace_hdr_t *ace, uint32_t mask_matched), \
TP_ARGS(zn, ace, mask_matched))
/* END CSTYLED */
DEFINE_ACE_EVENT(zfs_zfs__ace__denies);
DEFINE_ACE_EVENT(zfs_zfs__ace__allows);

Expand Down
10 changes: 10 additions & 0 deletions include/sys/trace_arc.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,11 @@ DECLARE_EVENT_CLASS(zfs_arc_buf_hdr_class,
/* END CSTYLED */

#define DEFINE_ARC_BUF_HDR_EVENT(name) \
/* BEGIN CSTYLED */
DEFINE_EVENT(zfs_arc_buf_hdr_class, name, \
TP_PROTO(arc_buf_hdr_t *ab), \
TP_ARGS(ab))
/* END CSTYLED */
DEFINE_ARC_BUF_HDR_EVENT(zfs_arc__hit);
DEFINE_ARC_BUF_HDR_EVENT(zfs_arc__evict);
DEFINE_ARC_BUF_HDR_EVENT(zfs_arc__delete);
Expand Down Expand Up @@ -141,9 +143,11 @@ DECLARE_EVENT_CLASS(zfs_l2arc_rw_class,
/* END CSTYLED */

#define DEFINE_L2ARC_RW_EVENT(name) \
/* BEGIN CSTYLED */
DEFINE_EVENT(zfs_l2arc_rw_class, name, \
TP_PROTO(vdev_t *vd, zio_t *zio), \
TP_ARGS(vd, zio))
/* END CSTYLED */
DEFINE_L2ARC_RW_EVENT(zfs_l2arc__read);
DEFINE_L2ARC_RW_EVENT(zfs_l2arc__write);

Expand All @@ -166,9 +170,11 @@ DECLARE_EVENT_CLASS(zfs_l2arc_iodone_class,
/* END CSTYLED */

#define DEFINE_L2ARC_IODONE_EVENT(name) \
/* BEGIN CSTYLED */
DEFINE_EVENT(zfs_l2arc_iodone_class, name, \
TP_PROTO(zio_t *zio, l2arc_write_callback_t *cb), \
TP_ARGS(zio, cb))
/* END CSTYLED */
DEFINE_L2ARC_IODONE_EVENT(zfs_l2arc__iodone);


Expand Down Expand Up @@ -278,10 +284,12 @@ DECLARE_EVENT_CLASS(zfs_arc_miss_class,
/* END CSTYLED */

#define DEFINE_ARC_MISS_EVENT(name) \
/* BEGIN CSTYLED */
DEFINE_EVENT(zfs_arc_miss_class, name, \
TP_PROTO(arc_buf_hdr_t *hdr, \
const blkptr_t *bp, uint64_t size, const zbookmark_phys_t *zb), \
TP_ARGS(hdr, bp, size, zb))
/* END CSTYLED */
DEFINE_ARC_MISS_EVENT(zfs_arc__miss);

/*
Expand Down Expand Up @@ -337,10 +345,12 @@ DECLARE_EVENT_CLASS(zfs_l2arc_evict_class,
/* END CSTYLED */

#define DEFINE_L2ARC_EVICT_EVENT(name) \
/* BEGIN CSTYLED */
DEFINE_EVENT(zfs_l2arc_evict_class, name, \
TP_PROTO(l2arc_dev_t *dev, \
list_t *buflist, uint64_t taddr, boolean_t all), \
TP_ARGS(dev, buflist, taddr, all))
/* END CSTYLED */
DEFINE_L2ARC_EVICT_EVENT(zfs_l2arc__evict);

#endif /* _TRACE_ARC_H */
Expand Down
6 changes: 6 additions & 0 deletions include/sys/trace_dbgmsg.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,12 @@ DECLARE_EVENT_CLASS(zfs_dprintf_class,
/* END CSTYLED */

#define DEFINE_DPRINTF_EVENT(name) \
/* BEGIN CSTYLED */
DEFINE_EVENT(zfs_dprintf_class, name, \
TP_PROTO(const char *file, const char *function, int line, \
const char *msg), \
TP_ARGS(file, function, line, msg))
/* END CSTYLED */
DEFINE_DPRINTF_EVENT(zfs_zfs__dprintf);

/*
Expand Down Expand Up @@ -109,16 +111,20 @@ DECLARE_EVENT_CLASS(zfs_set_error_class,

#ifdef TP_CONDITION
#define DEFINE_SET_ERROR_EVENT(name) \
/* BEGIN CSTYLED */
DEFINE_EVENT_CONDITION(zfs_set_error_class, name, \
TP_PROTO(const char *file, const char *function, int line, \
uintptr_t error), \
TP_ARGS(file, function, line, error), \
TP_CONDITION(error))
/* END CSTYLED */
#else
#define DEFINE_SET_ERROR_EVENT(name) \
/* BEGIN CSTYLED */
DEFINE_EVENT(zfs_set_error_class, name, \
TP_PROTO(const char *file, const char *function, int line, \
uintptr_t error), \
TP_ARGS(file, function, line, error))
/* END CSTYLED */
#endif
DEFINE_SET_ERROR_EVENT(zfs_set__error);
8 changes: 8 additions & 0 deletions include/sys/trace_dbuf.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,32 +78,40 @@
__entry->db_blkid, __entry->db_offset, \
__entry->db_size, __entry->db_state, __entry->db_holds

/* BEGIN CSTYLED */
DECLARE_EVENT_CLASS(zfs_dbuf_class,
TP_PROTO(dmu_buf_impl_t *db, zio_t *zio),
TP_ARGS(db, zio),
TP_STRUCT__entry(DBUF_TP_STRUCT_ENTRY),
TP_fast_assign(DBUF_TP_FAST_ASSIGN),
TP_printk(DBUF_TP_PRINTK_FMT, DBUF_TP_PRINTK_ARGS)
);
/* END CSTYLED */

#define DEFINE_DBUF_EVENT(name) \
/* BEGIN CSTYLED */
DEFINE_EVENT(zfs_dbuf_class, name, \
TP_PROTO(dmu_buf_impl_t *db, zio_t *zio), \
TP_ARGS(db, zio))
/* END CSTYLED */
DEFINE_DBUF_EVENT(zfs_blocked__read);

/* BEGIN CSTYLED */
DECLARE_EVENT_CLASS(zfs_dbuf_evict_one_class,
TP_PROTO(dmu_buf_impl_t *db, multilist_sublist_t *mls),
TP_ARGS(db, mls),
TP_STRUCT__entry(DBUF_TP_STRUCT_ENTRY),
TP_fast_assign(DBUF_TP_FAST_ASSIGN),
TP_printk(DBUF_TP_PRINTK_FMT, DBUF_TP_PRINTK_ARGS)
);
/* END CSTYLED */

#define DEFINE_DBUF_EVICT_ONE_EVENT(name) \
/* BEGIN CSTYLED */
DEFINE_EVENT(zfs_dbuf_evict_one_class, name, \
TP_PROTO(dmu_buf_impl_t *db, multilist_sublist_t *mls), \
TP_ARGS(db, mls))
/* END CSTYLED */
DEFINE_DBUF_EVICT_ONE_EVENT(zfs_dbuf__evict__one);

#endif /* _TRACE_DBUF_H */
Expand Down
2 changes: 2 additions & 0 deletions include/sys/trace_dmu.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,11 @@ DECLARE_EVENT_CLASS(zfs_delay_mintime_class,
/* END CSTYLED */

#define DEFINE_DELAY_MINTIME_EVENT(name) \
/* BEGIN CSTYLED */
DEFINE_EVENT(zfs_delay_mintime_class, name, \
TP_PROTO(dmu_tx_t *tx, uint64_t dirty, uint64_t min_tx_time), \
TP_ARGS(tx, dirty, min_tx_time))
/* END CSTYLED */
DEFINE_DELAY_MINTIME_EVENT(zfs_delay__mintime);

#endif /* _TRACE_DMU_H */
Expand Down
2 changes: 2 additions & 0 deletions include/sys/trace_dnode.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,11 @@ DECLARE_EVENT_CLASS(zfs_dnode_move_class,
/* END CSTYLED */

#define DEFINE_DNODE_MOVE_EVENT(name) \
/* BEGIN CSTYLED */
DEFINE_EVENT(zfs_dnode_move_class, name, \
TP_PROTO(dnode_t *dn, int64_t refcount, uint32_t dbufs), \
TP_ARGS(dn, refcount, dbufs))
/* END CSTYLED */
DEFINE_DNODE_MOVE_EVENT(zfs_dnode__move);

#endif /* _TRACE_DNODE_H */
Expand Down
2 changes: 2 additions & 0 deletions include/sys/trace_multilist.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ DECLARE_EVENT_CLASS(zfs_multilist_insert_remove_class,
/* END CSTYLED */

#define DEFINE_MULTILIST_INSERT_REMOVE_EVENT(name) \
/* BEGIN CSTYLED */
DEFINE_EVENT(zfs_multilist_insert_remove_class, name, \
TP_PROTO(multilist_t *ml, unsigned int sublist_idx, void *obj), \
TP_ARGS(ml, sublist_idx, obj))
/* END CSTYLED */
DEFINE_MULTILIST_INSERT_REMOVE_EVENT(zfs_multilist__insert);
DEFINE_MULTILIST_INSERT_REMOVE_EVENT(zfs_multilist__remove);

Expand Down
2 changes: 2 additions & 0 deletions include/sys/trace_txg.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ DECLARE_EVENT_CLASS(zfs_txg_class,
/* END CSTYLED */

#define DEFINE_TXG_EVENT(name) \
/* BEGIN CSTYLED */
DEFINE_EVENT(zfs_txg_class, name, \
TP_PROTO(dsl_pool_t *dp, uint64_t txg), \
TP_ARGS(dp, txg))
/* END CSTYLED */
DEFINE_TXG_EVENT(zfs_dsl_pool_sync__done);
DEFINE_TXG_EVENT(zfs_txg__quiescing);
DEFINE_TXG_EVENT(zfs_txg__opened);
Expand Down
2 changes: 2 additions & 0 deletions include/sys/trace_zil.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,13 @@ DECLARE_EVENT_CLASS(zfs_zil_class,
/* END CSTYLED */

#define DEFINE_ZIL_EVENT(name) \
/* BEGIN CSTYLED */
DEFINE_EVENT(zfs_zil_class, name, \
TP_PROTO(zilog_t *zilog), \
TP_ARGS(zilog))
DEFINE_ZIL_EVENT(zfs_zil__cw1);
DEFINE_ZIL_EVENT(zfs_zil__cw2);
/* END CSTYLED */

#endif /* _TRACE_ZIL_H */

Expand Down
3 changes: 2 additions & 1 deletion lib/libnvpair/libnvpair.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,8 @@ NVLIST_PRINTCTL_AREPLACE(nvlist_array, nvlist_t **)
*/


static const struct nvlist_printops defprtops = {
static const struct nvlist_printops defprtops =
{
{ nvprint_boolean, NULL },
{ nvprint_boolean_value, NULL },
{ nvprint_byte, NULL },
Expand Down
6 changes: 4 additions & 2 deletions lib/libshare/libshare.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ libshare_init(void)
}

static void
parse_sharetab(sa_handle_impl_t impl_handle) {
parse_sharetab(sa_handle_impl_t impl_handle)
{
FILE *fp;
char line[512];
char *eol, *pathname, *resource, *fstype, *options, *description;
Expand Down Expand Up @@ -759,7 +760,8 @@ alloc_share(const char *sharepath)
}

static void
free_share(sa_share_impl_t impl_share) {
free_share(sa_share_impl_t impl_share)
{
sa_fstype_t *fstype;

fstype = fstypes;
Expand Down
12 changes: 8 additions & 4 deletions lib/libspl/include/sys/byteorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,22 +130,26 @@ extern in_port_t ntohs(in_port_t);

#ifdef _BIG_ENDIAN
static __inline__ uint64_t
htonll(uint64_t n) {
htonll(uint64_t n)
{
return (n);
}

static __inline__ uint64_t
ntohll(uint64_t n) {
ntohll(uint64_t n)
{
return (n);
}
#else
static __inline__ uint64_t
htonll(uint64_t n) {
htonll(uint64_t n)
{
return ((((uint64_t)htonl(n)) << 32) + htonl(n >> 32));
}

static __inline__ uint64_t
ntohll(uint64_t n) {
ntohll(uint64_t n)
{
return ((((uint64_t)ntohl(n)) << 32) + ntohl(n >> 32));
}
#endif
Expand Down
3 changes: 2 additions & 1 deletion lib/libspl/include/umem.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ umem_free(void *ptr, size_t size)
}

static inline void
umem_nofail_callback(umem_nofail_callback_t *cb) {}
umem_nofail_callback(umem_nofail_callback_t *cb)
{}

static inline umem_cache_t *
umem_cache_create(
Expand Down
2 changes: 1 addition & 1 deletion lib/libzpool/taskq.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ taskq_thread(void *arg)
/*ARGSUSED*/
taskq_t *
taskq_create(const char *name, int nthreads, pri_t pri,
int minalloc, int maxalloc, uint_t flags)
int minalloc, int maxalloc, uint_t flags)
{
taskq_t *tq = kmem_zalloc(sizeof (taskq_t), KM_SLEEP);
int t;
Expand Down
Loading

0 comments on commit 4ea3f86

Please sign in to comment.