Deleted Added
full compact
secondary.c (246922) secondary.c (247281)
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 246922 2013-02-17 21:12:34Z pjd $");
32__FBSDID("$FreeBSD: head/sbin/hastd/secondary.c 247281 2013-02-25 20:09:07Z 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>

--- 719 unchanged lines hidden (view full) ---

760 pjdlog_warning("Unable to allocate memory to clear local activemap.");
761 break;
762 }
763 if (pwrite(res->hr_localfd, map, mapsize,
764 METADATA_SIZE) != (ssize_t)mapsize) {
765 pjdlog_errno(LOG_WARNING,
766 "Unable to store cleared activemap");
767 free(map);
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>

--- 719 unchanged lines hidden (view full) ---

760 pjdlog_warning("Unable to allocate memory to clear local activemap.");
761 break;
762 }
763 if (pwrite(res->hr_localfd, map, mapsize,
764 METADATA_SIZE) != (ssize_t)mapsize) {
765 pjdlog_errno(LOG_WARNING,
766 "Unable to store cleared activemap");
767 free(map);
768 res->hr_stat_activemap_write_error++;
768 break;
769 }
770 free(map);
771 clear_activemap = false;
772 pjdlog_debug(1, "Local activemap cleared.");
773 break;
774 }
775 reqlog(LOG_DEBUG, 2, -1, hio, "disk: (%p) Got request: ", hio);

--- 102 unchanged lines hidden (view full) ---

878 case HIO_WRITE:
879 data = NULL;
880 length = 0;
881 break;
882 default:
883 PJDLOG_ABORT("Unexpected command (cmd=%hhu).",
884 hio->hio_cmd);
885 }
769 break;
770 }
771 free(map);
772 clear_activemap = false;
773 pjdlog_debug(1, "Local activemap cleared.");
774 break;
775 }
776 reqlog(LOG_DEBUG, 2, -1, hio, "disk: (%p) Got request: ", hio);

--- 102 unchanged lines hidden (view full) ---

879 case HIO_WRITE:
880 data = NULL;
881 length = 0;
882 break;
883 default:
884 PJDLOG_ABORT("Unexpected command (cmd=%hhu).",
885 hio->hio_cmd);
886 }
886 if (hio->hio_error != 0)
887 if (hio->hio_error != 0) {
888 switch (hio->hio_cmd) {
889 case HIO_READ:
890 res->hr_stat_read_error++;
891 break;
892 case HIO_WRITE:
893 res->hr_stat_write_error++;
894 break;
895 case HIO_DELETE:
896 res->hr_stat_delete_error++;
897 break;
898 case HIO_FLUSH:
899 res->hr_stat_flush_error++;
900 break;
901 }
887 nv_add_int16(nvout, hio->hio_error, "error");
902 nv_add_int16(nvout, hio->hio_error, "error");
903 }
888 if (hast_proto_send(res, res->hr_remoteout, nvout, data,
889 length) == -1) {
890 secondary_exit(EX_TEMPFAIL, "Unable to send reply");
891 }
892 nv_free(nvout);
893 pjdlog_debug(2, "send: (%p) Moving request to the free queue.",
894 hio);
895 hio_clear(hio);
896 QUEUE_INSERT(free, hio);
897 }
898 /* NOTREACHED */
899 return (NULL);
900}
904 if (hast_proto_send(res, res->hr_remoteout, nvout, data,
905 length) == -1) {
906 secondary_exit(EX_TEMPFAIL, "Unable to send reply");
907 }
908 nv_free(nvout);
909 pjdlog_debug(2, "send: (%p) Moving request to the free queue.",
910 hio);
911 hio_clear(hio);
912 QUEUE_INSERT(free, hio);
913 }
914 /* NOTREACHED */
915 return (NULL);
916}