From owner-freebsd-hackers@FreeBSD.ORG Fri Feb 1 19:04:54 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 40DC6273 for ; Fri, 1 Feb 2013 19:04:54 +0000 (UTC) (envelope-from dieterbsd@gmail.com) Received: from mail-ia0-x22f.google.com (ia-in-x022f.1e100.net [IPv6:2607:f8b0:4001:c02::22f]) by mx1.freebsd.org (Postfix) with ESMTP id E59D69B1 for ; Fri, 1 Feb 2013 19:04:53 +0000 (UTC) Received: by mail-ia0-f175.google.com with SMTP id r4so5802537iaj.34 for ; Fri, 01 Feb 2013 11:04:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=Y/Kwr7/4vFPZy0EiJb9dIbsdttrFjjvswIEq3zbDHGM=; b=JgGDfeONtE60b2W4jVtYKRIT0Xu/xcS0zi1Vifpuiu/M5hMRXBvqWQYXJvDFCL81pG JkMLLWLkthtzCd3rG/2Ncd/O+TLH1xp/hkLdGDL+LKh0thDMf03AFI4g6yWKGgTRABlc duk5ecqg/mF19WUxQ1Hgq2tg3rj4fym+4UX4prxebObI7FPKGAbcjAVhhvx912wpyHRG nFYsujrXFwcb3115LvGDGHc8KBR79eL+tBHO4S/QmoFftMM77lXq4TOt0L+UWzznCVE3 3Me+0tPQ8tC4l21Lkjq4sRvDyOhGvqKWe5FGGMOMWegph3WWeRfTZ6RFfnLcPN+R2qkE GfAQ== MIME-Version: 1.0 X-Received: by 10.50.185.229 with SMTP id ff5mr1881494igc.82.1359745488115; Fri, 01 Feb 2013 11:04:48 -0800 (PST) Received: by 10.64.107.196 with HTTP; Fri, 1 Feb 2013 11:04:47 -0800 (PST) Date: Fri, 1 Feb 2013 11:04:47 -0800 Message-ID: Subject: Re: HDD write cache From: Dieter BSD To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Feb 2013 19:04:54 -0000 Wojciech writes: > after reading quite recent topics about disabling/enabling write cache, i > tried to test in on desktop 3.5" drive > > kern.cam.ada.write_cache: 1 > kern.cam.ada.read_ahead: 1 > kern.cam.ada.0.read_ahead: -1 > kern.cam.ada.0.write_cache: -1 > > i tried writing 1 or 0 to kern.cam.ada.0.write_cache, and there were > exactly no differences at all, and disk seems to do always write caching. > > Does that drive lie and ignore commands or i do it wrong? > > this is my disk. > > ada0 at ahcich0 bus 0 scbus0 target 0 lun 0 > ada0: ATA-8 SATA 2.x device > ada0: 300.000MB/s transfers (SATA 2.x, UDMA6, PIO 8192bytes) > ada0: Command Queueing enabled > ada0: 476940MB (976773168 512 byte sectors: 16H 63S/T 16383C) 1) See the other followups about making sure this change actually takes effect. 2) How, exactly, are you testing this? With Command Queueing enabled, (and assuming that it is working properly) you will not see any difference in speed with a casual test. Does ata(4) support your controller? Last time I looked, ata did not support NCQ. :-( So turning the write cache on/off gives a huge difference in speed. When ahci and siis came out, NCQ was so fast that it looked like the write cache was on. I had to write a special pathological test to be able to tell the difference between having the write cache on and using NCQ. I needed to verify that the write cache was really off so that my data was safe. In anything resembling normal use, NCQ with the write cache off is just as fast as having the write cache on. You really get the best of both worlds, speed and safety. Now all we need is NCQ support for all the controllers that have it.