secondary.c (211877) | secondary.c (211882) |
---|---|
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 211877 2010-08-27 14:01:28Z pjd $"); | 32__FBSDID("$FreeBSD: head/sbin/hastd/secondary.c 211882 2010-08-27 14:26:37Z pjd $"); |
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 <assert.h> --- 367 unchanged lines hidden (view full) --- 408 case HIO_FLUSH: 409 (void)snprintf(msg + len, sizeof(msg) - len, "FLUSH."); 410 break; 411 case HIO_WRITE: 412 (void)snprintf(msg + len, sizeof(msg) - len, 413 "WRITE(%ju, %ju).", (uintmax_t)hio->hio_offset, 414 (uintmax_t)hio->hio_length); 415 break; | 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 <assert.h> --- 367 unchanged lines hidden (view full) --- 408 case HIO_FLUSH: 409 (void)snprintf(msg + len, sizeof(msg) - len, "FLUSH."); 410 break; 411 case HIO_WRITE: 412 (void)snprintf(msg + len, sizeof(msg) - len, 413 "WRITE(%ju, %ju).", (uintmax_t)hio->hio_offset, 414 (uintmax_t)hio->hio_length); 415 break; |
416 case HIO_KEEPALIVE: 417 (void)snprintf(msg + len, sizeof(msg) - len, "KEEPALIVE."); 418 break; |
|
416 default: 417 (void)snprintf(msg + len, sizeof(msg) - len, 418 "UNKNOWN(%u).", (unsigned int)hio->hio_cmd); 419 break; 420 } 421 } 422 pjdlog_common(loglevel, debuglevel, error, "%s", msg); 423} --- 4 unchanged lines hidden (view full) --- 428 429 hio->hio_cmd = nv_get_uint8(hio->hio_nv, "cmd"); 430 if (hio->hio_cmd == 0) { 431 pjdlog_error("Header contains no 'cmd' field."); 432 hio->hio_error = EINVAL; 433 goto end; 434 } 435 switch (hio->hio_cmd) { | 419 default: 420 (void)snprintf(msg + len, sizeof(msg) - len, 421 "UNKNOWN(%u).", (unsigned int)hio->hio_cmd); 422 break; 423 } 424 } 425 pjdlog_common(loglevel, debuglevel, error, "%s", msg); 426} --- 4 unchanged lines hidden (view full) --- 431 432 hio->hio_cmd = nv_get_uint8(hio->hio_nv, "cmd"); 433 if (hio->hio_cmd == 0) { 434 pjdlog_error("Header contains no 'cmd' field."); 435 hio->hio_error = EINVAL; 436 goto end; 437 } 438 switch (hio->hio_cmd) { |
439 case HIO_KEEPALIVE: 440 break; |
|
436 case HIO_READ: 437 case HIO_WRITE: 438 case HIO_DELETE: 439 hio->hio_offset = nv_get_uint64(hio->hio_nv, "offset"); 440 if (nv_error(hio->hio_nv) != 0) { 441 pjdlog_error("Header is missing 'offset' field."); 442 hio->hio_error = EINVAL; 443 goto end; --- 68 unchanged lines hidden (view full) --- 512 pjdlog_debug(2, 513 "recv: (%p) Moving request to the send queue.", 514 hio); 515 QUEUE_INSERT(send, hio); 516 continue; 517 } 518 reqlog(LOG_DEBUG, 2, -1, hio, 519 "recv: (%p) Got request header: ", hio); | 441 case HIO_READ: 442 case HIO_WRITE: 443 case HIO_DELETE: 444 hio->hio_offset = nv_get_uint64(hio->hio_nv, "offset"); 445 if (nv_error(hio->hio_nv) != 0) { 446 pjdlog_error("Header is missing 'offset' field."); 447 hio->hio_error = EINVAL; 448 goto end; --- 68 unchanged lines hidden (view full) --- 517 pjdlog_debug(2, 518 "recv: (%p) Moving request to the send queue.", 519 hio); 520 QUEUE_INSERT(send, hio); 521 continue; 522 } 523 reqlog(LOG_DEBUG, 2, -1, hio, 524 "recv: (%p) Got request header: ", hio); |
520 if (hio->hio_cmd == HIO_WRITE) { | 525 if (hio->hio_cmd == HIO_KEEPALIVE) { 526 pjdlog_debug(2, 527 "recv: (%p) Moving request to the free queue.", 528 hio); 529 nv_free(hio->hio_nv); 530 QUEUE_INSERT(free, hio); 531 continue; 532 } else if (hio->hio_cmd == HIO_WRITE) { |
521 if (hast_proto_recv_data(res, res->hr_remotein, 522 hio->hio_nv, hio->hio_data, MAXPHYS) < 0) { 523 pjdlog_exit(EX_TEMPFAIL, 524 "Unable to receive reply data"); 525 } 526 } 527 pjdlog_debug(2, "recv: (%p) Moving request to the disk queue.", 528 hio); --- 162 unchanged lines hidden --- | 533 if (hast_proto_recv_data(res, res->hr_remotein, 534 hio->hio_nv, hio->hio_data, MAXPHYS) < 0) { 535 pjdlog_exit(EX_TEMPFAIL, 536 "Unable to receive reply data"); 537 } 538 } 539 pjdlog_debug(2, "recv: (%p) Moving request to the disk queue.", 540 hio); --- 162 unchanged lines hidden --- |