secondary.c (222228) | secondary.c (223181) |
---|---|
1/*- 2 * Copyright (c) 2009-2010 The FreeBSD Foundation 3 * Copyright (c) 2010 Pawel Jakub Dawidek <pjd@FreeBSD.org> 4 * All rights reserved. 5 * 6 * This software was developed by Pawel Jakub Dawidek under sponsorship from 7 * the FreeBSD Foundation. 8 * --- 15 unchanged lines hidden (view full) --- 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 */ 30 31#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2009-2010 The FreeBSD Foundation 3 * Copyright (c) 2010 Pawel Jakub Dawidek <pjd@FreeBSD.org> 4 * All rights reserved. 5 * 6 * This software was developed by Pawel Jakub Dawidek under sponsorship from 7 * the FreeBSD Foundation. 8 * --- 15 unchanged lines hidden (view full) --- 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 */ 30 31#include <sys/cdefs.h> |
32__FBSDID("$FreeBSD: head/sbin/hastd/secondary.c 222228 2011-05-23 21:15:19Z pjd $"); | 32__FBSDID("$FreeBSD: head/sbin/hastd/secondary.c 223181 2011-06-17 07:07:26Z trociny $"); |
33 34#include <sys/param.h> 35#include <sys/time.h> 36#include <sys/bio.h> 37#include <sys/disk.h> 38#include <sys/stat.h> 39 40#include <err.h> --- 137 unchanged lines hidden (view full) --- 178static void 179init_remote(struct hast_resource *res, struct nv *nvin) 180{ 181 uint64_t resuid; 182 struct nv *nvout; 183 unsigned char *map; 184 size_t mapsize; 185 | 33 34#include <sys/param.h> 35#include <sys/time.h> 36#include <sys/bio.h> 37#include <sys/disk.h> 38#include <sys/stat.h> 39 40#include <err.h> --- 137 unchanged lines hidden (view full) --- 178static void 179init_remote(struct hast_resource *res, struct nv *nvin) 180{ 181 uint64_t resuid; 182 struct nv *nvout; 183 unsigned char *map; 184 size_t mapsize; 185 |
186#ifdef notyet |
|
186 /* Setup direction. */ 187 if (proto_send(res->hr_remoteout, NULL, 0) == -1) 188 pjdlog_errno(LOG_WARNING, "Unable to set connection direction"); | 187 /* Setup direction. */ 188 if (proto_send(res->hr_remoteout, NULL, 0) == -1) 189 pjdlog_errno(LOG_WARNING, "Unable to set connection direction"); |
190#endif |
|
189 190 map = NULL; 191 mapsize = 0; 192 nvout = nv_alloc(); 193 nv_add_int64(nvout, (int64_t)res->hr_datasize, "datasize"); 194 nv_add_int32(nvout, (int32_t)res->hr_extentsize, "extentsize"); 195 resuid = nv_get_uint64(nvin, "resuid"); 196 res->hr_primary_localcnt = nv_get_uint64(nvin, "localcnt"); --- 149 unchanged lines hidden (view full) --- 346 nv_add_uint32(nvout, (uint32_t)mapsize, "mapsize"); 347 if (hast_proto_send(res, res->hr_remotein, nvout, map, mapsize) < 0) { 348 pjdlog_exit(EX_TEMPFAIL, "Unable to send activemap to %s", 349 res->hr_remoteaddr); 350 } 351 if (map != NULL) 352 free(map); 353 nv_free(nvout); | 191 192 map = NULL; 193 mapsize = 0; 194 nvout = nv_alloc(); 195 nv_add_int64(nvout, (int64_t)res->hr_datasize, "datasize"); 196 nv_add_int32(nvout, (int32_t)res->hr_extentsize, "extentsize"); 197 resuid = nv_get_uint64(nvin, "resuid"); 198 res->hr_primary_localcnt = nv_get_uint64(nvin, "localcnt"); --- 149 unchanged lines hidden (view full) --- 348 nv_add_uint32(nvout, (uint32_t)mapsize, "mapsize"); 349 if (hast_proto_send(res, res->hr_remotein, nvout, map, mapsize) < 0) { 350 pjdlog_exit(EX_TEMPFAIL, "Unable to send activemap to %s", 351 res->hr_remoteaddr); 352 } 353 if (map != NULL) 354 free(map); 355 nv_free(nvout); |
356#ifdef notyet |
|
354 /* Setup direction. */ 355 if (proto_recv(res->hr_remotein, NULL, 0) == -1) 356 pjdlog_errno(LOG_WARNING, "Unable to set connection direction"); | 357 /* Setup direction. */ 358 if (proto_recv(res->hr_remotein, NULL, 0) == -1) 359 pjdlog_errno(LOG_WARNING, "Unable to set connection direction"); |
360#endif |
|
357 if (res->hr_secondary_localcnt > res->hr_primary_remotecnt && 358 res->hr_primary_localcnt > res->hr_secondary_remotecnt) { 359 /* Exit on split-brain. */ 360 event_send(res, EVENT_SPLITBRAIN); 361 exit(EX_CONFIG); 362 } 363} 364 --- 444 unchanged lines hidden --- | 361 if (res->hr_secondary_localcnt > res->hr_primary_remotecnt && 362 res->hr_primary_localcnt > res->hr_secondary_remotecnt) { 363 /* Exit on split-brain. */ 364 event_send(res, EVENT_SPLITBRAIN); 365 exit(EX_CONFIG); 366 } 367} 368 --- 444 unchanged lines hidden --- |