Deleted Added
full compact
ctl_backend_block.c (287868) ctl_backend_block.c (287875)
1/*-
2 * Copyright (c) 2003 Silicon Graphics International Corp.
3 * Copyright (c) 2009-2011 Spectra Logic Corporation
4 * Copyright (c) 2012 The FreeBSD Foundation
5 * All rights reserved.
6 *
7 * Portions of this software were developed by Edward Tomasz Napierala
8 * under sponsorship from the FreeBSD Foundation.

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

35 * $Id: //depot/users/kenm/FreeBSD-test2/sys/cam/ctl/ctl_backend_block.c#5 $
36 */
37/*
38 * CAM Target Layer driver backend for block devices.
39 *
40 * Author: Ken Merry <ken@FreeBSD.org>
41 */
42#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2003 Silicon Graphics International Corp.
3 * Copyright (c) 2009-2011 Spectra Logic Corporation
4 * Copyright (c) 2012 The FreeBSD Foundation
5 * All rights reserved.
6 *
7 * Portions of this software were developed by Edward Tomasz Napierala
8 * under sponsorship from the FreeBSD Foundation.

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

35 * $Id: //depot/users/kenm/FreeBSD-test2/sys/cam/ctl/ctl_backend_block.c#5 $
36 */
37/*
38 * CAM Target Layer driver backend for block devices.
39 *
40 * Author: Ken Merry <ken@FreeBSD.org>
41 */
42#include <sys/cdefs.h>
43__FBSDID("$FreeBSD: head/sys/cam/ctl/ctl_backend_block.c 287868 2015-09-16 18:33:04Z mav $");
43__FBSDID("$FreeBSD: head/sys/cam/ctl/ctl_backend_block.c 287875 2015-09-16 21:43:51Z mav $");
44
45#include <sys/param.h>
46#include <sys/systm.h>
47#include <sys/kernel.h>
48#include <sys/types.h>
49#include <sys/kthread.h>
50#include <sys/bio.h>
51#include <sys/fcntl.h>

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

627static void
628ctl_be_block_dispatch_file(struct ctl_be_block_lun *be_lun,
629 struct ctl_be_block_io *beio)
630{
631 struct ctl_be_block_filedata *file_data;
632 union ctl_io *io;
633 struct uio xuio;
634 struct iovec *xiovec;
44
45#include <sys/param.h>
46#include <sys/systm.h>
47#include <sys/kernel.h>
48#include <sys/types.h>
49#include <sys/kthread.h>
50#include <sys/bio.h>
51#include <sys/fcntl.h>

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

627static void
628ctl_be_block_dispatch_file(struct ctl_be_block_lun *be_lun,
629 struct ctl_be_block_io *beio)
630{
631 struct ctl_be_block_filedata *file_data;
632 union ctl_io *io;
633 struct uio xuio;
634 struct iovec *xiovec;
635 int flags;
636 int error, i;
635 size_t s;
636 int error, flags, i;
637
638 DPRINTF("entered\n");
639
640 file_data = &be_lun->backend.file;
641 io = beio->io;
642 flags = 0;
643 if (ARGS(io)->flags & CTL_LLF_DPO)
644 flags |= IO_DIRECT;

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

689 * ZFS pays attention to IO_SYNC (which translates into the
690 * Solaris define FRSYNC for zfs_read()) for reads. It
691 * attempts to sync the file before reading.
692 */
693 error = VOP_READ(be_lun->vn, &xuio, flags, file_data->cred);
694
695 VOP_UNLOCK(be_lun->vn, 0);
696 SDT_PROBE(cbb, kernel, read, file_done, 0, 0, 0, 0, 0);
637
638 DPRINTF("entered\n");
639
640 file_data = &be_lun->backend.file;
641 io = beio->io;
642 flags = 0;
643 if (ARGS(io)->flags & CTL_LLF_DPO)
644 flags |= IO_DIRECT;

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

689 * ZFS pays attention to IO_SYNC (which translates into the
690 * Solaris define FRSYNC for zfs_read()) for reads. It
691 * attempts to sync the file before reading.
692 */
693 error = VOP_READ(be_lun->vn, &xuio, flags, file_data->cred);
694
695 VOP_UNLOCK(be_lun->vn, 0);
696 SDT_PROBE(cbb, kernel, read, file_done, 0, 0, 0, 0, 0);
697 if (error == 0 && xuio.uio_resid > 0) {
698 /*
699 * If we red less then requested (EOF), then
700 * we should clean the rest of the buffer.
701 */
702 s = beio->io_len - xuio.uio_resid;
703 for (i = 0; i < beio->num_segs; i++) {
704 if (s >= beio->sg_segs[i].len) {
705 s -= beio->sg_segs[i].len;
706 continue;
707 }
708 bzero((uint8_t *)beio->sg_segs[i].addr + s,
709 beio->sg_segs[i].len - s);
710 s = 0;
711 }
712 }
697 } else {
698 struct mount *mountpoint;
699 int lock_flags;
700
701 (void)vn_start_write(be_lun->vn, &mountpoint, V_WAIT);
702
703 if (MNT_SHARED_WRITES(mountpoint)
704 || ((mountpoint == NULL)

--- 2268 unchanged lines hidden ---
713 } else {
714 struct mount *mountpoint;
715 int lock_flags;
716
717 (void)vn_start_write(be_lun->vn, &mountpoint, V_WAIT);
718
719 if (MNT_SHARED_WRITES(mountpoint)
720 || ((mountpoint == NULL)

--- 2268 unchanged lines hidden ---