summaryrefslogtreecommitdiffstats
path: root/xlators/storage/bd/src
diff options
context:
space:
mode:
authorGluster Ant <bugzilla-bot@gluster.org>2018-09-12 17:22:48 +0530
committerNigel Babu <nigelb@redhat.com>2018-09-12 17:22:48 +0530
commit45a71c0548b6fd2c757aa2e7b7671a1411948894 (patch)
tree2a5a9b73bae47ab53a41166fd041a06612587f48 /xlators/storage/bd/src
parentbe77dbbda692792335a8e9e7c02e0c281f003c40 (diff)
Land clang-format changes
Change-Id: I6f5d8140a06f3c1b2d196849299f8d483028d33b
Diffstat (limited to 'xlators/storage/bd/src')
-rw-r--r--xlators/storage/bd/src/bd-aio.h22
-rw-r--r--xlators/storage/bd/src/bd-mem-types.h15
-rw-r--r--xlators/storage/bd/src/bd.h191
3 files changed, 126 insertions, 102 deletions
diff --git a/xlators/storage/bd/src/bd-aio.h b/xlators/storage/bd/src/bd-aio.h
index 82386e0b072..1332622050d 100644
--- a/xlators/storage/bd/src/bd-aio.h
+++ b/xlators/storage/bd/src/bd-aio.h
@@ -23,14 +23,18 @@
/* Maximum number of completed IO operations to reap per getevents syscall */
#define BD_AIO_MAX_NR_GETEVENTS 16
-int bd_aio_on (xlator_t *this);
-int bd_aio_off (xlator_t *this);
-
-int bd_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
- off_t offset, uint32_t flags, dict_t *xdata);
-
-int bd_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
- struct iovec *vector, int32_t count, off_t offset,
- uint32_t flags, struct iobref *iobref, dict_t *xdata);
+int
+bd_aio_on(xlator_t *this);
+int
+bd_aio_off(xlator_t *this);
+
+int
+bd_readv(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
+ off_t offset, uint32_t flags, dict_t *xdata);
+
+int
+bd_writev(call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector,
+ int32_t count, off_t offset, uint32_t flags, struct iobref *iobref,
+ dict_t *xdata);
#endif /* !_BD_AIO_H */
diff --git a/xlators/storage/bd/src/bd-mem-types.h b/xlators/storage/bd/src/bd-mem-types.h
index 58b44834247..a63df819754 100644
--- a/xlators/storage/bd/src/bd-mem-types.h
+++ b/xlators/storage/bd/src/bd-mem-types.h
@@ -8,20 +8,19 @@
cases as published by the Free Software Foundation.
*/
-
#ifndef __BD_MEM_TYPES_H__
#define __BD_MEM_TYPES_H__
#include "mem-types.h"
enum gf_bd_mem_types_ {
- gf_bd_private = gf_common_mt_end + 1,
- gf_bd_attr,
- gf_bd_fd,
- gf_bd_loc_t,
- gf_bd_int32_t,
- gf_bd_aio_cb,
- gf_bd_mt_end
+ gf_bd_private = gf_common_mt_end + 1,
+ gf_bd_attr,
+ gf_bd_fd,
+ gf_bd_loc_t,
+ gf_bd_int32_t,
+ gf_bd_aio_cb,
+ gf_bd_mt_end
};
#endif
diff --git a/xlators/storage/bd/src/bd.h b/xlators/storage/bd/src/bd.h
index bdaf6f032d9..769affbb70c 100644
--- a/xlators/storage/bd/src/bd.h
+++ b/xlators/storage/bd/src/bd.h
@@ -38,18 +38,18 @@
#define ALIGN_SIZE 4096
-#define BD_CAPS_BD 0x01
-#define BD_CAPS_THIN 0x02
-#define BD_CAPS_OFFLOAD_COPY 0x04
+#define BD_CAPS_BD 0x01
+#define BD_CAPS_THIN 0x02
+#define BD_CAPS_OFFLOAD_COPY 0x04
#define BD_CAPS_OFFLOAD_SNAPSHOT 0x08
-#define BD_CAPS_OFFLOAD_ZERO 0x20
+#define BD_CAPS_OFFLOAD_ZERO 0x20
#define BD_CLONE "clone"
#define BD_SNAPSHOT "snapshot"
#define BD_MERGE "merge"
#define BD_ORIGIN "list-origin"
-#define IOV_NR 4
+#define IOV_NR 4
#define IOV_SIZE (64 * 1024)
#define ALIGN_SIZE 4096
@@ -57,29 +57,29 @@
#define MAX_NO_VECT 1024
-
-#define BD_VALIDATE_MEM_ALLOC(buff, op_errno, label) \
- if (!buff) { \
- op_errno = ENOMEM; \
- gf_log (this->name, GF_LOG_ERROR, "out of memory"); \
- goto label; \
- }
-
-#define BD_VALIDATE_LOCAL_OR_GOTO(local, op_errno, label) \
- if (!local) { \
- op_errno = EINVAL; \
- goto label; \
- }
-
-#define BD_STACK_UNWIND(typ, frame, args ...) do { \
- bd_local_t *__local = frame->local; \
- xlator_t *__this = frame->this; \
- \
- frame->local = NULL; \
- STACK_UNWIND_STRICT (typ, frame, args); \
- if (__local) \
- bd_local_free (__this, __local); \
- } while (0)
+#define BD_VALIDATE_MEM_ALLOC(buff, op_errno, label) \
+ if (!buff) { \
+ op_errno = ENOMEM; \
+ gf_log(this->name, GF_LOG_ERROR, "out of memory"); \
+ goto label; \
+ }
+
+#define BD_VALIDATE_LOCAL_OR_GOTO(local, op_errno, label) \
+ if (!local) { \
+ op_errno = EINVAL; \
+ goto label; \
+ }
+
+#define BD_STACK_UNWIND(typ, frame, args...) \
+ do { \
+ bd_local_t *__local = frame->local; \
+ xlator_t *__this = frame->this; \
+ \
+ frame->local = NULL; \
+ STACK_UNWIND_STRICT(typ, frame, args); \
+ if (__local) \
+ bd_local_free(__this, __local); \
+ } while (0)
typedef char bd_gfid_t[GF_UUID_BUF_SIZE];
@@ -87,82 +87,103 @@ typedef char bd_gfid_t[GF_UUID_BUF_SIZE];
* bd_fd - internal structure
*/
typedef struct bd_fd {
- int fd;
- int32_t flag;
- int odirect;
+ int fd;
+ int32_t flag;
+ int odirect;
} bd_fd_t;
typedef struct bd_priv {
- lvm_t handle;
- char *vg;
- char *pool;
- int caps;
- gf_boolean_t aio_init_done;
- gf_boolean_t aio_capable;
- gf_boolean_t aio_configured;
+ lvm_t handle;
+ char *vg;
+ char *pool;
+ int caps;
+ gf_boolean_t aio_init_done;
+ gf_boolean_t aio_capable;
+ gf_boolean_t aio_configured;
#ifdef HAVE_LIBAIO
- io_context_t ctxp;
- pthread_t aiothread;
+ io_context_t ctxp;
+ pthread_t aiothread;
#endif
} bd_priv_t;
-
typedef enum bd_type {
- BD_TYPE_NONE,
- BD_TYPE_LV,
+ BD_TYPE_NONE,
+ BD_TYPE_LV,
} bd_type_t;
typedef struct {
- struct iatt iatt;
- char *type;
+ struct iatt iatt;
+ char *type;
} bd_attr_t;
typedef enum {
- BD_OF_NONE,
- BD_OF_CLONE,
- BD_OF_SNAPSHOT,
- BD_OF_MERGE,
+ BD_OF_NONE,
+ BD_OF_CLONE,
+ BD_OF_SNAPSHOT,
+ BD_OF_MERGE,
} bd_offload_t;
typedef struct {
- dict_t *dict;
- bd_attr_t *bdatt;
- inode_t *inode;
- loc_t loc;
- fd_t *fd;
- data_t *data; /* for setxattr */
- bd_offload_t offload;
- uint64_t size;
- loc_t *dloc;
+ dict_t *dict;
+ bd_attr_t *bdatt;
+ inode_t *inode;
+ loc_t loc;
+ fd_t *fd;
+ data_t *data; /* for setxattr */
+ bd_offload_t offload;
+ uint64_t size;
+ loc_t *dloc;
} bd_local_t;
/* Prototypes */
-int bd_inode_ctx_set (inode_t *inode, xlator_t *this, bd_attr_t *ctx);
-int bd_inode_ctx_get (inode_t *inode, xlator_t *this, bd_attr_t **ctx);
-int bd_scan_vg (xlator_t *this, bd_priv_t *priv);
-bd_local_t *bd_local_init (call_frame_t *frame, xlator_t *this);
-void bd_local_free (xlator_t *this, bd_local_t *local);
-int bd_fd_ctx_get (xlator_t *this, fd_t *fd, bd_fd_t **bdfd);
-char *page_aligned_alloc (size_t size, char **aligned_buf);
-int bd_validate_bd_xattr (xlator_t *this, char *bd, char **type,
- uint64_t *lv_size, uuid_t uuid);
-uint64_t bd_get_default_extent (bd_priv_t *priv);
-uint64_t bd_adjust_size (bd_priv_t *priv, size_t size);
-int bd_create (uuid_t uuid, uint64_t size, char *type, bd_priv_t *priv);
-int bd_resize (bd_priv_t *priv, uuid_t uuid, size_t size);
-int bd_delete_lv (bd_priv_t *priv, const char *lv_name, int *op_errno);
-int bd_snapshot_create (bd_local_t *local, bd_priv_t *priv);
-int bd_clone (bd_local_t *local, bd_priv_t *priv);
-
-int bd_merge (bd_priv_t *priv, uuid_t gfid);
-int bd_get_origin (bd_priv_t *priv, loc_t *loc, fd_t *fd, dict_t *dict);
-void bd_update_amtime(struct iatt *iatt, int flag);
-int bd_snapshot_create (bd_local_t *local, bd_priv_t *priv);
-int bd_clone (bd_local_t *local, bd_priv_t *priv);
-int bd_merge (bd_priv_t *priv, uuid_t gfid);
-int bd_get_origin (bd_priv_t *priv, loc_t *loc, fd_t *fd, dict_t *dict);
-int bd_do_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd,
- off_t offset, size_t len, struct iatt *prebuf,
- struct iatt *postbuf);
+int
+bd_inode_ctx_set(inode_t *inode, xlator_t *this, bd_attr_t *ctx);
+int
+bd_inode_ctx_get(inode_t *inode, xlator_t *this, bd_attr_t **ctx);
+int
+bd_scan_vg(xlator_t *this, bd_priv_t *priv);
+bd_local_t *
+bd_local_init(call_frame_t *frame, xlator_t *this);
+void
+bd_local_free(xlator_t *this, bd_local_t *local);
+int
+bd_fd_ctx_get(xlator_t *this, fd_t *fd, bd_fd_t **bdfd);
+char *
+page_aligned_alloc(size_t size, char **aligned_buf);
+int
+bd_validate_bd_xattr(xlator_t *this, char *bd, char **type, uint64_t *lv_size,
+ uuid_t uuid);
+uint64_t
+bd_get_default_extent(bd_priv_t *priv);
+uint64_t
+bd_adjust_size(bd_priv_t *priv, size_t size);
+int
+bd_create(uuid_t uuid, uint64_t size, char *type, bd_priv_t *priv);
+int
+bd_resize(bd_priv_t *priv, uuid_t uuid, size_t size);
+int
+bd_delete_lv(bd_priv_t *priv, const char *lv_name, int *op_errno);
+int
+bd_snapshot_create(bd_local_t *local, bd_priv_t *priv);
+int
+bd_clone(bd_local_t *local, bd_priv_t *priv);
+
+int
+bd_merge(bd_priv_t *priv, uuid_t gfid);
+int
+bd_get_origin(bd_priv_t *priv, loc_t *loc, fd_t *fd, dict_t *dict);
+void
+bd_update_amtime(struct iatt *iatt, int flag);
+int
+bd_snapshot_create(bd_local_t *local, bd_priv_t *priv);
+int
+bd_clone(bd_local_t *local, bd_priv_t *priv);
+int
+bd_merge(bd_priv_t *priv, uuid_t gfid);
+int
+bd_get_origin(bd_priv_t *priv, loc_t *loc, fd_t *fd, dict_t *dict);
+int
+bd_do_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
+ size_t len, struct iatt *prebuf, struct iatt *postbuf);
#endif