Re: how to deactiate the cache of an cached fileio-device?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Oliver,

On Thu, 28 Apr 2016 19:42:21 +0200, Oliver Rath wrote :
> is it possible, to "decache" a fileio-device without destroying it?
> 
> I have an (deactivated) cached fileio-device here:
> 
> # cat info
> Status: DEACTIVATED  Max Queue Depth: 0  SectorSize: 0  HwMaxSectors:
> 0 TCM FILEIO ID: 0        File: /dev/dm-8  Size: 5368709120  Mode:
> Buffered-WCE
> 
> but flushing the buffer (or just deactivating) doesnt work:
> 
> # echo "fd_buffered_io=0" > control
> bash: echo: write error: Invalid argument
> 
> And dmesg tells me:
> 
> [101828.839116] bogus fd_buffered_io=0 value
> 
> 
> Is it not possible to deactivate buffer without destroying the fileio?

I think the proper way to disable the write cache is to set the
emulate_write_cache attribute of your fileio backstore to 0:

With `targetcli`:

  /backstores/fileio/file1> set attribute emulate_write_cache=0
  Parameter emulate_write_cache is now '0'.

Or from the shell in configfs:

  $ sudo sh -c  'echo 0 > attrib/emulate_write_cache'


> The other direction seems to work:
> 
> # echo
> "fd_dev_path=/dev/dm-9,fd_dev_name=/dev/dm-9,fd_dev_size=$(blockdev
> --getsize64 /dev/dm-9)" > control
> # cat info
> Status: DEACTIVATED  Max Queue Depth: 0  SectorSize: 0  HwMaxSectors:
> 0 TCM FILEIO ID: 0        File: /dev/dm-9  Size: 7516192768  Mode:
> O_DSYNC
> 
> # echo "fd_buffered_io=1" > control
> # cat info
> Status: DEACTIVATED  Max Queue Depth: 0  SectorSize: 0  HwMaxSectors:
> 0 TCM FILEIO ID: 0        File: /dev/dm-9  Size: 7516192768  Mode:
> Buffered-WCE

Looking at the code, it seems that "fd_buffered_io", if specified, must
be set to 1. Other values are not accepted.

  http://lxr.free-electrons.com/source/drivers/target/target_core_file.c#L661

Hope that helps,

-- 
Christophe Vu-Brugier
--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux