summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-volgen.h
blob: 2f0ab8bdbd05dfdac3efcc50f04c653ad9777b00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/*
  Copyright (c) 2006-2009 Gluster, Inc. <http://www.gluster.com>
  This file is part of GlusterFS.

  GlusterFS is free software; you can redistribute it and/or modify
  it under the terms of the GNU Affero General Public License as published
  by the Free Software Foundation; either version 3 of the License,
  or (at your option) any later version.

  GlusterFS is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Affero General Public License for more details.

  You should have received a copy of the GNU Affero General Public License
  along with this program.  If not, see
  <http://www.gnu.org/licenses/>.
*/

#ifndef _GLUSTERD_VOLGEN_H_
#define _GLUSTERD_VOLGEN_H_

#ifndef _CONFIG_H
#define _CONFIG_H
#include "config.h"
#endif
#include "xlator.h"
#include "protocol-common.h"
#include "glusterd.h"
#include "defaults.h"
#include "list.h"
#include "dict.h"
#include "compat.h"
#include "compat-errno.h"
#include "glusterd-sm.h"
#include "glusterd-op-sm.h"
#include "cli1.h"
#include "glusterd-mem-types.h"

#define VOLGEN_GET_NFS_DIR(path)                                      \
        do {                                                            \
                glusterd_conf_t *priv = THIS->private;                  \
                snprintf (path, PATH_MAX, "%s/nfs", priv->workdir);\
        } while (0);                                                    \

#define VOLGEN_GET_VOLUME_DIR(path, volinfo)                            \
        do {                                                            \
                glusterd_conf_t *priv = THIS->private;                  \
                snprintf (path, PATH_MAX, "%s/vols/%s", priv->workdir,  \
                          volinfo->volname);                            \
        } while (0);                                                    \


#define VOLGEN_GET_BRICK_DIR(path, volinfo)                             \
        do {                                                            \
                glusterd_conf_t *priv = THIS->private;                  \
                snprintf (path, PATH_MAX, "%s/%s/%s/%s", priv->workdir, \
                          GLUSTERD_VOLUME_DIR_PREFIX, volinfo->volname, \
                          GLUSTERD_BRICK_INFO_DIR);                     \
        } while (0);                                                    \


#define VOLGEN_GENERATE_VOLNAME(str, volname, subvol)             \
        do {                                                      \
                snprintf (str, 2048, "%s-%s", volname, subvol);   \
        } while (0);                                              \

#define VOLGEN_POSIX_OPTION_ODIRECT "volgen_posix_option_statfssize"
#define VOLGEN_POSIX_OPTION_STATFSSIZE "volgen_posix_option_statfssize"
#define VOLGEN_POSIX_OPTION_MANDATTR "volgen_posix_option_mandattr"
#define VOLGEN_POSIX_OPTION_SPANDEVICES "volgen_posix_option_spandevices"
#define VOLGEN_POSIX_OPTION_BCKUNLINK "volgen_posix_option_bckunlink"

#define VOLGEN_LOCKS_OPTION_TRACE "volgen_locks_option_trace"
#define VOLGEN_LOCKS_OPTION_MAND "volgen_locks_option_mand"

#define VOLGEN_CLIENT_OPTION_TRANSTYPE "volgen_client_option_transtype"
#define VOLGEN_CLIENT_OPTION_NODELAY "volgen_client_option_nodelay"

#define VOLGEN_IOT_OPTION_THREADCOUNT "volgen_iot_option_threadcount"
#define VOLGEN_IOT_OPTION_AUTOSCALING "volgen_iot_option_autoscaling"
#define VOLGEN_IOT_OPTION_MINTHREADS "volgen_iot_option_minthreads"
#define VOLGEN_IOT_OPTION_MAXTHREADS "volgen_iot_option_maxthreads"

#define VOLGEN_SERVER_OPTION_TRANSTYPE "volgen_server_option_transtype"
#define VOLGEN_SERVER_OPTION_NODELAY "volgen_server_option_nodelay"

#define VOLGEN_REPLICATE_OPTION_READSUBVOL "volgen_replicate_option_readsubvol"
#define VOLGEN_REPLICATE_OPTION_FAVCHILD "volgen_replicate_option_favchild"
#define VOLGEN_REPLICATE_OPTION_BCKSHCOUNT "volgen_replicate_option_bckshcount"
#define VOLGEN_REPLICATE_OPTION_DATASH "volgen_replicate_option_datash"
#define VOLGEN_REPLICATE_OPTION_DATASHALGO "volgen_replicate_option_datashalgo"
#define VOLGEN_REPLICATE_OPTION_SHWINDOWSIZE "volgen_replicate_option_shwindowsize"
#define VOLGEN_REPLICATE_OPTION_METASH "volgen_replicate_option_metash"
#define VOLGEN_REPLICATE_OPTION_ENTRYSH "volgen_replicate_option_entrysh"
#define VOLGEN_REPLICATE_OPTION_DATACHANGELOG "volgen_replicate_option_datachangelog"
#define VOLGEN_REPLICATE_OPTION_METADATACHANGELOG "volgen_replicate_option_metadatachangelog"
#define VOLGEN_REPLICATE_OPTION_ENTRYCHANGELOG "volgen_replicate_option_entrychangelog"
#define VOLGEN_REPLICATE_OPTION_STRICTREADDIR "volgen_replicate_option_strictreaddir"

#define VOLGEN_STRIPE_OPTION_BLOCKSIZE "volgen_stripe_option_blocksize"
#define VOLGEN_STRIPE_OPTION_USEXATTR  "volgen_stripe_option_usexattr"

#define VOLGEN_DHT_OPTION_LOOKUPUNHASH "volgen_dht_option_lookupunhash"
#define VOLGEN_DHT_OPTION_MINFREEDISK "volgen_dht_option_minfreedisk"
#define VOLGEN_DHT_OPTION_UNHASHSTICKY "volgen_dht_option_unhashsticky"

#define VOLGEN_WB_OPTION_FLUSHBEHIND "volgen_wb_option_flushbehind"
#define VOLGEN_WB_OPTION_CACHESIZE "volgen_wb_option_cachesize"
#define VOLGEN_WB_OPTION_DISABLENBYTES "volgen_wb_option_disablenbytes"
#define VOLGEN_WB_OPTION_OSYNC "volgen_wb_option_osync"
#define VOLGEN_WB_OPTION_TRICKLINGWRITES "volgen_wb_option_tricklingwrites"

#define VOLGEN_RA_OPTION_ATIME "volgen_ra_option_atime"
#define VOLGEN_RA_OPTION_PAGECOUNT "volgen_ra_option_pagecount"

#define VOLGEN_IOCACHE_OPTION_PRIORITY "volgen_iocache_option_priority"
#define VOLGEN_IOCACHE_OPTION_TIMEOUT "volgen_iocache_option_timeout"
#define VOLGEN_IOCACHE_OPTION_CACHESIZE "volgen_iocache_option_cachesize"
#define VOLGEN_IOCACHE_OPTION_MINFILESIZE "volgen_iocache_option_minfilesize"
#define VOLGEN_IOCACHE_OPTION_MAXFILESIZE "volgen_iocache_option_maxfilesize"

#define VOLGEN_QR_OPTION_PRIORITY "volgen_qr_option_priority"
#define VOLGEN_QR_OPTION_TIMEOUT "volgen_qr_option_timeout"
#define VOLGEN_QR_OPTION_CACHESIZE "volgen_qr_option_cachesize"
#define VOLGEN_QR_OPTION_MAXFILESIZE "volgen_qr_option_maxfilesize"

#define VOLGEN_IOS_OPTION_DUMP_FD_STATS   "dump-fd-stats"
#define VOLGEN_IOS_OPTION_MEASURE_LATENCY "latency-measurement"

int
glusterd_create_volfiles (glusterd_volinfo_t *volinfo);

int
glusterd_delete_volfile (glusterd_volinfo_t *volinfo,
                         glusterd_brickinfo_t *brickinfo);

int32_t
glusterd_default_xlator_options (glusterd_volinfo_t *volinfo);

char *
glusterd_get_nfs_filepath ();

int
volgen_generate_nfs_volfile (glusterd_volinfo_t *volinfo);

int
uncomment_option( char *opt_str,char *comment_str);
#endif