From owner-freebsd-scsi@FreeBSD.ORG Wed Sep 17 03:04:49 2014 Return-Path: Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 060A6A12 for ; Wed, 17 Sep 2014 03:04:49 +0000 (UTC) Received: from mail-pd0-x232.google.com (mail-pd0-x232.google.com [IPv6:2607:f8b0:400e:c02::232]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CF78A5E8 for ; Wed, 17 Sep 2014 03:04:48 +0000 (UTC) Received: by mail-pd0-f178.google.com with SMTP id p10so1115233pdj.37 for ; Tue, 16 Sep 2014 20:04:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=WcBBFALocmkx2nPBp+UFhkKiXT9rfPTuFB1trJZttG8=; b=EGXPnLLY1JoNGlkfElL2/UdAe50g9H/0kM4vlDGjyeJIhX14rkmUnZzLdW8Abd/Qb1 LkLEyNXuN67YnHczcSmT31Vdlo9Mat2er3gis55N7exfHkTUHPGPrMMduAu05YTjGpH6 uAYYgV01hwNyWOuA8FaVn2R0dHmrbMJto4oPqdzsMQjfI9gFg40SanDU2iLZQD4OPnso qHKiLO9cn9L9ESCE2fhoBvDvKVf5mpY0xT7FATjNAuwX4oCBcBE9NN6JfyYBSCxaN7m5 V9alllGIm92Gm5WeszoBoHW9M8IVKY8X9gXi8YnebPUY7P65TEZmxycI/pbrkYIcgGw0 gdnQ== X-Received: by 10.70.64.166 with SMTP id p6mr636443pds.139.1410923088397; Tue, 16 Sep 2014 20:04:48 -0700 (PDT) Received: from Peters-MacAir.local ([106.39.255.231]) by mx.google.com with ESMTPSA id xt10sm15863848pab.44.2014.09.16.20.04.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 16 Sep 2014 20:04:48 -0700 (PDT) Message-ID: <5418FA4A.1050707@gmail.com> Date: Wed, 17 Sep 2014 11:04:42 +0800 From: Xu Zhe User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: d@delphij.net, freebsd-scsi@freebsd.org Subject: Re: How to disable hard disk write cache? References: <541804B0.7070407@gmail.com> <54184484.1070304@delphij.net> In-Reply-To: <54184484.1070304@delphij.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Sep 2014 03:04:49 -0000 于 14-9-16 22:09, Xin Li 写道: > On 9/16/14 5:36 PM, Xu Zhe wrote: >> > Hi, all, >> > >> > Does anyone knows how to disable write cache of hard disk? >> > >> > I have found some hints here at Freebsd website: >> > >> > https://www.freebsd.org/doc/handbook/configtuning-disk.html >> > >> > However, this seems only work for ATA devices, what about SAS/NLSAS >> > devices (Meanwhile, it seems that there is no such sysctl in latest >> > Freebsd release, which is 10.0)? >> > >> > Any hints are welcomed! > Why do you want to disable write cache in the first place? It's not > needed for most configurations nowadays. > > Modern SATA/SAS/SCSI devices usually comes with the capability of > tagged commands, allowing the OS to know when a write buffer is on > stable storage. With this, file systems can easily implement the > right semantics and recover from e.g. a power outage, etc. > > Cheers, Hi, Xin, Thanks for the reply. My final goal is not to disable write cache. I just want to do a simple test to see how would the IOPS drop when write cache disabled (I suppose without disk write cache, the value should be the same as IOPS of random read, both using O_DIRECT flag to avoid system cache, etc.). Meanwhile, what I really want to know is that, how could I make sure IO is persistent as long as I got reply from hard disk? Since I suppose all file systems require this assumption to achieve self consistency. I have googled about the "tagged command" but only found something related to TCQ, which mainly talks about the queueing but not anything related to cache sync. Any more hints? I saw some pages that mentioned about SATA FUA command support on Linux (Which I guess is what I am looking for): https://www.kernel.org/doc/Documentation/block/writeback_cache_control.txt However, I have not found useful information related to Freebsd. :( Peter