summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2014-10-06 13:18:28 +0000
committermav <mav@FreeBSD.org>2014-10-06 13:18:28 +0000
commit143513e3769cf73d4a3f40777b1a10a27193e3b0 (patch)
treea7005038adf7908c139ad5b71fe81cb86acc12b7
parentdf8c240c190af94bace52f5a233537cc4ceb4b08 (diff)
downloadFreeBSD-src-143513e3769cf73d4a3f40777b1a10a27193e3b0.zip
FreeBSD-src-143513e3769cf73d4a3f40777b1a10a27193e3b0.tar.gz
MFC r271505:
Add "readcache" and "writecache" LUN options to control default behavior. Default values are "on". Disabling requires backend to support IO_DIRECT and IO_SYNC flags respectively, or some alternatives.
-rw-r--r--sys/cam/ctl/ctl.c22
-rw-r--r--usr.sbin/ctladm/ctladm.88
2 files changed, 20 insertions, 10 deletions
diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c
index 8de3796..3e01f0d 100644
--- a/sys/cam/ctl/ctl.c
+++ b/sys/cam/ctl/ctl.c
@@ -4097,6 +4097,7 @@ ctl_init_page_index(struct ctl_lun *lun)
int i;
struct ctl_page_index *page_index;
struct ctl_softc *softc;
+ const char *value;
memcpy(&lun->mode_pages.index, page_index_template,
sizeof(page_index_template));
@@ -4246,26 +4247,31 @@ ctl_init_page_index(struct ctl_lun *lun)
break;
}
case SMS_CACHING_PAGE: {
+ struct scsi_caching_page *caching_page;
if (page_index->subpage != SMS_SUBPAGE_PAGE_0)
panic("invalid subpage value %d",
page_index->subpage);
- /*
- * Defaults should be okay here, no calculations
- * needed.
- */
- memcpy(&lun->mode_pages.caching_page[CTL_PAGE_CURRENT],
+ memcpy(&lun->mode_pages.caching_page[CTL_PAGE_DEFAULT],
&caching_page_default,
sizeof(caching_page_default));
memcpy(&lun->mode_pages.caching_page[
CTL_PAGE_CHANGEABLE], &caching_page_changeable,
sizeof(caching_page_changeable));
- memcpy(&lun->mode_pages.caching_page[CTL_PAGE_DEFAULT],
- &caching_page_default,
- sizeof(caching_page_default));
memcpy(&lun->mode_pages.caching_page[CTL_PAGE_SAVED],
&caching_page_default,
sizeof(caching_page_default));
+ caching_page = &lun->mode_pages.caching_page[
+ CTL_PAGE_SAVED];
+ value = ctl_get_opt(&lun->be_lun->options, "writecache");
+ if (value != NULL && strcmp(value, "off") == 0)
+ caching_page->flags1 &= ~SCP_WCE;
+ value = ctl_get_opt(&lun->be_lun->options, "readcache");
+ if (value != NULL && strcmp(value, "off") == 0)
+ caching_page->flags1 |= SCP_RCD;
+ memcpy(&lun->mode_pages.caching_page[CTL_PAGE_CURRENT],
+ &lun->mode_pages.caching_page[CTL_PAGE_SAVED],
+ sizeof(caching_page_default));
page_index->page_data =
(uint8_t *)lun->mode_pages.caching_page;
break;
diff --git a/usr.sbin/ctladm/ctladm.8 b/usr.sbin/ctladm/ctladm.8
index ae1b20c..3951e5f 100644
--- a/usr.sbin/ctladm/ctladm.8
+++ b/usr.sbin/ctladm/ctladm.8
@@ -34,7 +34,7 @@
.\" $Id: //depot/users/kenm/FreeBSD-test2/usr.sbin/ctladm/ctladm.8#3 $
.\" $FreeBSD$
.\"
-.Dd July 9, 2014
+.Dd September 13, 2014
.Dt CTLADM 8
.Os
.Sh NAME
@@ -959,8 +959,12 @@ Setting to "on" allows EXTENDED COPY command sent to this LUN access
other LUNs on this host, not accessible otherwise.
This allows to offload copying between different iSCSI targets residing
on the same host in trusted environments.
+.It Va readcache
+Set to "off", disables read caching for the LUN, if supported by the backend.
.It Va unmap
-Set to "on", enables UNMAP support for the LUN.
+Set to "on", enables UNMAP support for the LUN, if supported by the backend.
+.It Va writecache
+Set to "off", disables write caching for the LUN, if supported by the backend.
.El
.Pp
Options specific for block backend:
OpenPOWER on IntegriCloud