UFS cannot disable WCE

Hi all,
I'm running UFS ona virtual machine, and apparently I cannot disable WCE:

Code:
# echo "WCE: 0" | camcontrol modepage da0 -m 0x08 -e
camcontrol: error sending mode select command
# camcontrol modepage da0 -m 0x08 | grep WCE
WCE:  1

I am not sure if this is a problem of the disk being on a virtual machine or if I'm making something wrong. Any idea?
I'm running 12.2-RELEASE.
 
That looks correct. There might/should be an error reported by the kernel - that would go onto the console (or console.log or /var/log/messages as configured).
 
Probably the virtualized disk does not implement WC itself, but passes it through to the physical drive. Consequently, guests systems are not allowed to change the WCE flag of the physical drive, because that would also affect other guests on the same host.
 
I don't have any error in the logs, I double checked it.
Therefore, I think it is a problem of the virtualization system (virtualbox). Even chaning the disk properties to writethru does not enable me to disable WCE.
 
It should be possible to clear the drive’s WCE flag (thus disabling WC) on the host system.
 
It should be possible to clear the drive’s WCE flag (thus disabling WC) on the host system.

No way, at least I tried to disable the wirte cache on the linux host (!) but FreeBSD still refuses to switch WCE off.
What I did on Linux host:

Code:
% sudo hdparm -W 0 /dev/sda

then restarted the FreeBSD virtual machine and executed the WCE disabling again, same error.
 
No way, at least I tried to disable the wirte cache on the linux host (!) but FreeBSD still refuses to switch WCE off.
What I did on Linux host:

Code:
% sudo hdparm -W 0 /dev/sda

then restarted the FreeBSD virtual machine and executed the WCE disabling again, same error.
Well, did the hdparm command on the Linux host succeed? If it did, then WC on the drive should be disabled, no matter what you see in the FreeBSD VM. I guess the virtualized disk does not really display the physical drive’s WCE flag, but just makes it up, so it has no real meaning. In other words, you can safely ignore the error message.
 
I made a few test, and apparently I'm not able to understand what is going on.

I ran bonnie++ on the host several times with similar results. This is what happens with write cache enabled on the Linux host, that in turns virtualize the FreeBSD machine:

Code:
Version  1.98       ------Sequential Output------ --Sequential Input- --Random-
                    -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Name:Size etc        /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
miguel           1G 1023k  99 32.0m   6 36.3m   9 1095k  94  134m  27 221.0  11
Latency             24065us     486ms     278ms   92844us   85294us    1943ms
Version  1.98       ------Sequential Create------ --------Random Create--------
miguel              -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                 16 +++++ +++ +++++ +++ +++++ +++ 30969.883333  72 +++++ +++ 29029.930262  77
Latency             43377us    1912us    7171us     152ms    1623us   17341us

and this is an example of result obtained after disabling write cache on the Linux host (i.e., executing hdparm):


Code:
Version  1.98       ------Sequential Output------ --Sequential Input- --Random-
                    -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Name:Size etc        /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
miguel           1G  461k  98 79.2m  15 34.7m   8  834k  98  136m  14 218.1  10
Latency             64146us     100ms   99472us   32809us   83879us    3306ms
Version  1.98       ------Sequential Create------ --------Random Create--------
miguel              -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                 16 19898.588451  31 +++++ +++ +++++ +++ 11198.685079  13 +++++ +++ +++++ +++
Latency               222ms     252us     366us     513ms     339us   78882us

The latency increases?

And besides, I don't see any particular change. I've also rebooted the virtual machine to be sure it has felt the change in the cache.
I've checked in the virtual box media manager and the disk is labeled as "write thru".
Any idea?
 
I have to admit that I’m not sure what kind of results you are expecting to see.
What problem are you trying to solve?
 
I have to admit that I’m not sure what kind of results you are expecting to see.
What problem are you trying to solve?
I am trying to do some benchmarking and experiments against a PostgreSQL database. The fact is that I would like to see write-thru, and that's why I'm trying to disable cache. And since I did not find any difference in disabling it on the virtual machine host, I'm trying to understand if that works by means of an I/O benchmarking. Am I looking at the wrong numbers?
 
I don’t think that the WCE flag is still useful nowadays; it was only meaningful in the old days when disks were still using the IDE interface, and when operating systems were using FAT file systems. I think that disk drives ignore the WCE flag when command-queuing is being used. Also, modern SMR drives cannot perform write-through because of the way they work. And for SSD drives there is no such thing as write-through anyway.
 
well you have to mount your filesystems -o sync otherwise the os cache will interfere with your benchmarking mitigating the absence of wce
database commits should force sync writes to the transactions logs anyway but i doubt bonnie does anything like this
 
Back
Top