From owner-svn-src-all@freebsd.org Mon Oct 5 10:41:10 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 647FA9B161B; Mon, 5 Oct 2015 10:41:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 565E9976; Mon, 5 Oct 2015 10:41:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t95AfApu071848; Mon, 5 Oct 2015 10:41:10 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t95Af9PT071844; Mon, 5 Oct 2015 10:41:09 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201510051041.t95Af9PT071844@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 5 Oct 2015 10:41:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r288774 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Oct 2015 10:41:10 -0000 Author: mav Date: Mon Oct 5 10:41:08 2015 New Revision: 288774 URL: https://svnweb.freebsd.org/changeset/base/288774 Log: MFC r287967: Relax serseq option operation for reads. Previously, with serseq enabled, next command was unblocked only after previous completed. With this change, for read operations, next command is unblocked as soon as last media read completed. This is important for frontends that actually wait for data move completion (like camtgt), or when data are moved through the HA link, or especially when both. Modified: stable/10/sys/cam/ctl/ctl.c stable/10/sys/cam/ctl/ctl.h stable/10/sys/cam/ctl/ctl_backend_block.c stable/10/sys/cam/ctl/ctl_io.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Mon Oct 5 10:40:15 2015 (r288773) +++ stable/10/sys/cam/ctl/ctl.c Mon Oct 5 10:41:08 2015 (r288774) @@ -10594,6 +10594,8 @@ ctl_extent_check(union ctl_io *io1, unio if (ctl_get_lba_len(io1, &lba1, &len1) != 0) return (CTL_ACTION_ERROR); + if (io1->io_hdr.flags & CTL_FLAG_SERSEQ_DONE) + seq = FALSE; return (ctl_extent_check_lba(lba1, len1, lba2, len2, seq)); } @@ -10603,6 +10605,8 @@ ctl_extent_check_seq(union ctl_io *io1, uint64_t lba1, lba2; uint64_t len1, len2; + if (io1->io_hdr.flags & CTL_FLAG_SERSEQ_DONE) + return (CTL_ACTION_PASS); if (ctl_get_lba_len(io1, &lba1, &len1) != 0) return (CTL_ACTION_ERROR); if (ctl_get_lba_len(io2, &lba2, &len2) != 0) @@ -13220,6 +13224,21 @@ ctl_done_timer_wakeup(void *arg) #endif /* CTL_IO_DELAY */ void +ctl_serseq_done(union ctl_io *io) +{ + struct ctl_lun *lun; + + lun = (struct ctl_lun *)io->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; + if (lun->be_lun == NULL || + lun->be_lun->serseq == CTL_LUN_SERSEQ_OFF) + return; + mtx_lock(&lun->lun_lock); + io->io_hdr.flags |= CTL_FLAG_SERSEQ_DONE; + ctl_check_blocked(lun); + mtx_unlock(&lun->lun_lock); +} + +void ctl_done(union ctl_io *io) { Modified: stable/10/sys/cam/ctl/ctl.h ============================================================================== --- stable/10/sys/cam/ctl/ctl.h Mon Oct 5 10:40:15 2015 (r288773) +++ stable/10/sys/cam/ctl/ctl.h Mon Oct 5 10:41:08 2015 (r288774) @@ -172,6 +172,7 @@ int ctl_sap_log_sense_handler(struct ctl int pc); int ctl_config_move_done(union ctl_io *io); void ctl_datamove(union ctl_io *io); +void ctl_serseq_done(union ctl_io *io); void ctl_done(union ctl_io *io); void ctl_data_submit_done(union ctl_io *io); void ctl_config_read_done(union ctl_io *io); Modified: stable/10/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_backend_block.c Mon Oct 5 10:40:15 2015 (r288773) +++ stable/10/sys/cam/ctl/ctl_backend_block.c Mon Oct 5 10:41:08 2015 (r288774) @@ -565,8 +565,10 @@ ctl_be_block_biodone(struct bio *bio) ctl_complete_beio(beio); } else { if ((ARGS(io)->flags & CTL_LLF_READ) && - beio->beio_cont == NULL) + beio->beio_cont == NULL) { ctl_set_success(&io->scsiio); + ctl_serseq_done(io); + } #ifdef CTL_TIME_IO getbintime(&io->io_hdr.dma_start_bt); #endif @@ -785,8 +787,10 @@ ctl_be_block_dispatch_file(struct ctl_be ctl_complete_beio(beio); } else { if ((ARGS(io)->flags & CTL_LLF_READ) && - beio->beio_cont == NULL) + beio->beio_cont == NULL) { ctl_set_success(&io->scsiio); + ctl_serseq_done(io); + } #ifdef CTL_TIME_IO getbintime(&io->io_hdr.dma_start_bt); #endif @@ -954,8 +958,10 @@ ctl_be_block_dispatch_zvol(struct ctl_be ctl_complete_beio(beio); } else { if ((ARGS(io)->flags & CTL_LLF_READ) && - beio->beio_cont == NULL) + beio->beio_cont == NULL) { ctl_set_success(&io->scsiio); + ctl_serseq_done(io); + } #ifdef CTL_TIME_IO getbintime(&io->io_hdr.dma_start_bt); #endif Modified: stable/10/sys/cam/ctl/ctl_io.h ============================================================================== --- stable/10/sys/cam/ctl/ctl_io.h Mon Oct 5 10:40:15 2015 (r288773) +++ stable/10/sys/cam/ctl/ctl_io.h Mon Oct 5 10:41:08 2015 (r288774) @@ -115,7 +115,8 @@ typedef enum { CTL_FLAG_FAILOVER = 0x04000000, /* Killed by a failover */ CTL_FLAG_IO_ACTIVE = 0x08000000, /* I/O active on this SC */ - CTL_FLAG_STATUS_SENT = 0x10000000 /* Status sent by datamove */ + CTL_FLAG_STATUS_SENT = 0x10000000, /* Status sent by datamove */ + CTL_FLAG_SERSEQ_DONE = 0x20000000 /* All storage I/O started */ } ctl_io_flags;