[lkml]   [2010]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subject[PATCH 0/4] tcm: Add WriteCache + FUA Write support to TCM/FILEIO
From: Nicholas Bellinger <>

Greetings hch, tejun and Co,

This patch series adds WriteCache + FUA Write emulation support into TCM v4 Core and
ConfigFS generic code at lio-core-2.6.git/lio-4.0. The series changes the TCM
subsystem plugin API at include/target/target_core_transport.h:struct se_subsystem_api
that allows SYNCHRONIZE_CACHE emulation to be shared amoungst multiple TCM subsystem
plugins (eg: FILEIO, IBLOCK, RAMDISK). This series includes initial support for
WCE=1 and DPOFUA=1 using the TCM/FILEIO subsystem plugin.

This first patch adds the device attribute infrastructure emulation into
target_core_transport.c and target_core_device.c, and adds four new configfs attributes
that appear in /sys/kernel/config/target/core/fileio_$ID/$DEV/attrib/

The second patch adds SYNCHRONIZE_CACHE and SYNCHRONIZE_CACHE_16 emulation code
capable of LBA + Range (Number of Blocks) context flushing in target_core_transport.c:
transport_generic_synchronize_cache(). This function uses the new struct se_subsystem_api
->do_sync_cache() and ->do_sync_cache_range() function pointers to make the calls out
into TCM subsystem plugin dependent code.

The third patch updates the MODE_SENSE* emulation for TYPE_DISK to change the
Caching Control Page to set WCE=1, and device type specific area for DPOFUA=1
for the FUA Write emulation bit. And the final patch modifies TCM/FILEIO to use
the new struct se_subsystem_api callers using fs/sync.c:vfs_fsync() and
vfs_fsync_range() from below transport_generic_synchronize_cache()

Here are the remaining item(s) on the TODO:

*) Support FUA READs..?
*) Support for DPO aside from FUA WRITE/READ (is this possible..?)
*) Using kernel level fcntl() to enable/disable O_SYNC using
emulate_write_cache configfs attribute (see patch #4)
*) Add sense data for failed FUA WRITE task case in TCM/FILEIO

Comments are welcome,


Signed-off-by: Nicholas A. Bellinger <>

Nicholas Bellinger (4):
tcm: Add WriteCache and FUADPO infrastructure and attributes
tcm: Add SYNCHRONIZE_CACHE* CDB infrastructure and emulation
tcm: Add WriteCache and DPOFUA emulation bits to MODE_SENSE
tcm/fileio: Add WriteCache and Forced Unit Access WRITE emulation

drivers/target/target_core_configfs.c | 16 +++
drivers/target/target_core_device.c | 84 +++++++++++++++++
drivers/target/target_core_file.c | 159 +++++++++++++++++++++++++++++++-
drivers/target/target_core_transport.c | 156 ++++++++++++++++++++++++++++---
include/target/target_core_base.h | 7 ++
include/target/target_core_device.h | 4 +
include/target/target_core_transport.h | 39 ++++++++
7 files changed, 450 insertions(+), 15 deletions(-)

 \ /
  Last update: 2010-08-27 06:35    [W:0.035 / U:0.168 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site