Bug 105861 - lookahead is reflected in cache mode page as DRA but cannot be set through it
Summary: lookahead is reflected in cache mode page as DRA but cannot be set through it
Status: RESOLVED CODE_FIX
Alias: None
Product: IO/Storage
Classification: Unclassified
Component: Serial ATA (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Tejun Heo
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-13 02:41 UTC by Tom Yan
Modified: 2016-07-19 11:30 UTC (History)
0 users

See Also:
Kernel Version: 4.2.2
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Tom Yan 2015-10-13 02:41:18 UTC
As you can see, WCE is 1 and DRA is 0 when write cache and look ahead is enabled:

[tom@localhost ~]$ sudo smartctl -g all /dev/sda
smartctl 6.4 2015-06-04 r4109 [x86_64-linux-4.2.2-1-ARCH] (local build)
Copyright (C) 2002-15, Bruce Allen, Christian Franke, www.smartmontools.org

AAM feature is:   Unavailable
APM level is:     254 (maximum performance)
Rd look-ahead is: Enabled
Write cache is:   Enabled
ATA Security is:  Disabled, frozen [SEC2]
[tom@localhost ~]$ sudo sdparm -p ca --long /dev/sda
    /dev/sda: ATA       INTEL SSDSC2BW24  DC32
    Direct access device specific parameters: WP=0  DPOFUA=0
Caching (SBC) [ca] mode page:
  IC          0  [cha: n, def:  0]  Initiator control
  ABPF        0  [cha: n, def:  0]  Abort pre-fetch
  CAP         0  [cha: n, def:  0]  Caching analysis permitted
  DISC        0  [cha: n, def:  0]  Discontinuity
  SIZE        0  [cha: n, def:  0]  Size enable
  WCE         1  [cha: y, def:  1]  Write cache enable
  MF          0  [cha: n, def:  0]  Multiplication factor
  RCD         0  [cha: n, def:  0]  Read cache disable
  DRRP        0  [cha: n, def:  0]  Demand read retention priority
  WRP         0  [cha: n, def:  0]  Write retention priority
  DPTL        0  [cha: n, def:  0]  Disable pre-fetch transfer length
  MIPF        0  [cha: n, def:  0]  Minimum pre-fetch
  MAPF        0  [cha: n, def:  0]  Maximum pre-fetch
  MAPFC       0  [cha: n, def:  0]  Maximum pre-fetch ceiling
  FSW         0  [cha: n, def:  0]  Force sequential write
  LBCSS       0  [cha: n, def:  0]  Logical block cache segment size
  DRA         0  [cha: n, def:  0]  Disable read ahead
  SYNC_PROG   0  [cha: n, def:  0]  Synchronous cache progress indication
  NV_DIS      0  [cha: n, def:  0]  Non-volatile cache disable
  NCS         0  [cha: n, def:  0]  Number of cache segments
  CSS         0  [cha: n, def:  0]  Cache segment size

And WCE is 0 and DRA is 1 when write cache and look ahead is disabled:

[tom@localhost ~]$ sudo smartctl --set lookahead,off --set wcache,off /dev/sda
smartctl 6.4 2015-06-04 r4109 [x86_64-linux-4.2.2-1-ARCH] (local build)
Copyright (C) 2002-15, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF ENABLE/DISABLE COMMANDS SECTION ===
Read look-ahead disabled
Write cache disabled

[tom@localhost ~]$ sudo smartctl -g all /dev/sda
smartctl 6.4 2015-06-04 r4109 [x86_64-linux-4.2.2-1-ARCH] (local build)
Copyright (C) 2002-15, Bruce Allen, Christian Franke, www.smartmontools.org

AAM feature is:   Unavailable
APM level is:     254 (maximum performance)
Rd look-ahead is: Disabled
Write cache is:   Disabled
ATA Security is:  Disabled, frozen [SEC2]
[tom@localhost ~]$ sudo sdparm -p ca --long /dev/sda
    /dev/sda: ATA       INTEL SSDSC2BW24  DC32
    Direct access device specific parameters: WP=0  DPOFUA=0
Caching (SBC) [ca] mode page:
  IC          0  [cha: n, def:  0]  Initiator control
  ABPF        0  [cha: n, def:  0]  Abort pre-fetch
  CAP         0  [cha: n, def:  0]  Caching analysis permitted
  DISC        0  [cha: n, def:  0]  Discontinuity
  SIZE        0  [cha: n, def:  0]  Size enable
  WCE         0  [cha: y, def:  0]  Write cache enable
  MF          0  [cha: n, def:  0]  Multiplication factor
  RCD         0  [cha: n, def:  0]  Read cache disable
  DRRP        0  [cha: n, def:  0]  Demand read retention priority
  WRP         0  [cha: n, def:  0]  Write retention priority
  DPTL        0  [cha: n, def:  0]  Disable pre-fetch transfer length
  MIPF        0  [cha: n, def:  0]  Minimum pre-fetch
  MAPF        0  [cha: n, def:  0]  Maximum pre-fetch
  MAPFC       0  [cha: n, def:  0]  Maximum pre-fetch ceiling
  FSW         0  [cha: n, def:  0]  Force sequential write
  LBCSS       0  [cha: n, def:  0]  Logical block cache segment size
  DRA         1  [cha: n, def:  1]  Disable read ahead
  SYNC_PROG   0  [cha: n, def:  0]  Synchronous cache progress indication
  NV_DIS      0  [cha: n, def:  0]  Non-volatile cache disable
  NCS         0  [cha: n, def:  0]  Number of cache segments
  CSS         0  [cha: n, def:  0]  Cache segment size

However, I can only set WCE but not DRA "through scsi":

[tom@localhost ~]$ sudo sdparm --set WCE=1 /dev/sda
    /dev/sda: ATA       INTEL SSDSC2BW24  DC32
[tom@localhost ~]$ sudo sdparm --set DRA=0 /dev/sda
    /dev/sda: ATA       INTEL SSDSC2BW24  DC32
change_mode_page: failed setting page: Caching (SBC)
[tom@localhost ~]$ sudo smartctl -g all /dev/sda
smartctl 6.4 2015-06-04 r4109 [x86_64-linux-4.2.2-1-ARCH] (local build)
Copyright (C) 2002-15, Bruce Allen, Christian Franke, www.smartmontools.org

AAM feature is:   Unavailable
APM level is:     254 (maximum performance)
Rd look-ahead is: Disabled
Write cache is:   Enabled
ATA Security is:  Disabled, frozen [SEC2]
[tom@localhost ~]$ sudo sdparm -p ca --long /dev/sda
    /dev/sda: ATA       INTEL SSDSC2BW24  DC32
    Direct access device specific parameters: WP=0  DPOFUA=0
Caching (SBC) [ca] mode page:
  IC          0  [cha: n, def:  0]  Initiator control
  ABPF        0  [cha: n, def:  0]  Abort pre-fetch
  CAP         0  [cha: n, def:  0]  Caching analysis permitted
  DISC        0  [cha: n, def:  0]  Discontinuity
  SIZE        0  [cha: n, def:  0]  Size enable
  WCE         1  [cha: y, def:  1]  Write cache enable
  MF          0  [cha: n, def:  0]  Multiplication factor
  RCD         0  [cha: n, def:  0]  Read cache disable
  DRRP        0  [cha: n, def:  0]  Demand read retention priority
  WRP         0  [cha: n, def:  0]  Write retention priority
  DPTL        0  [cha: n, def:  0]  Disable pre-fetch transfer length
  MIPF        0  [cha: n, def:  0]  Minimum pre-fetch
  MAPF        0  [cha: n, def:  0]  Maximum pre-fetch
  MAPFC       0  [cha: n, def:  0]  Maximum pre-fetch ceiling
  FSW         0  [cha: n, def:  0]  Force sequential write
  LBCSS       0  [cha: n, def:  0]  Logical block cache segment size
  DRA         1  [cha: n, def:  1]  Disable read ahead
  SYNC_PROG   0  [cha: n, def:  0]  Synchronous cache progress indication
  NV_DIS      0  [cha: n, def:  0]  Non-volatile cache disable
  NCS         0  [cha: n, def:  0]  Number of cache segments
  CSS         0  [cha: n, def:  0]  Cache segment size
Comment 1 Tom Yan 2015-10-16 19:02:16 UTC
Actually DRA is only reflected after WCE is touched:

[tom@localhost ~]$ sudo smartctl --get all /dev/sda
smartctl 6.4 2015-06-04 r4109 [x86_64-linux-4.2.3-1-ARCH] (local build)
Copyright (C) 2002-15, Bruce Allen, Christian Franke, www.smartmontools.org

AAM feature is:   Unavailable
APM level is:     254 (maximum performance)
Rd look-ahead is: Enabled
Write cache is:   Enabled
ATA Security is:  Disabled, NOT FROZEN [SEC1]
[tom@localhost ~]$ sudo sdparm -p ca --long /dev/sda
    /dev/sda: ATA       INTEL SSDSC2BW24  DC32
    Direct access device specific parameters: WP=0  DPOFUA=0
Caching (SBC) [ca] mode page:
  IC          0  [cha: n, def:  0]  Initiator control
  ABPF        0  [cha: n, def:  0]  Abort pre-fetch
  CAP         0  [cha: n, def:  0]  Caching analysis permitted
  DISC        0  [cha: n, def:  0]  Discontinuity
  SIZE        0  [cha: n, def:  0]  Size enable
  WCE         1  [cha: y, def:  1]  Write cache enable
  MF          0  [cha: n, def:  0]  Multiplication factor
  RCD         0  [cha: n, def:  0]  Read cache disable
  DRRP        0  [cha: n, def:  0]  Demand read retention priority
  WRP         0  [cha: n, def:  0]  Write retention priority
  DPTL        0  [cha: n, def:  0]  Disable pre-fetch transfer length
  MIPF        0  [cha: n, def:  0]  Minimum pre-fetch
  MAPF        0  [cha: n, def:  0]  Maximum pre-fetch
  MAPFC       0  [cha: n, def:  0]  Maximum pre-fetch ceiling
  FSW         0  [cha: n, def:  0]  Force sequential write
  LBCSS       0  [cha: n, def:  0]  Logical block cache segment size
  DRA         0  [cha: n, def:  0]  Disable read ahead
  SYNC_PROG   0  [cha: n, def:  0]  Synchronous cache progress indication
  NV_DIS      0  [cha: n, def:  0]  Non-volatile cache disable
  NCS         0  [cha: n, def:  0]  Number of cache segments
  CSS         0  [cha: n, def:  0]  Cache segment size
[tom@localhost ~]$ sudo smartctl --set lookahead,off /dev/sda
smartctl 6.4 2015-06-04 r4109 [x86_64-linux-4.2.3-1-ARCH] (local build)
Copyright (C) 2002-15, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF ENABLE/DISABLE COMMANDS SECTION ===
Read look-ahead disabled

[tom@localhost ~]$ sudo sdparm -p ca --long /dev/sda
    /dev/sda: ATA       INTEL SSDSC2BW24  DC32
    Direct access device specific parameters: WP=0  DPOFUA=0
Caching (SBC) [ca] mode page:
  IC          0  [cha: n, def:  0]  Initiator control
  ABPF        0  [cha: n, def:  0]  Abort pre-fetch
  CAP         0  [cha: n, def:  0]  Caching analysis permitted
  DISC        0  [cha: n, def:  0]  Discontinuity
  SIZE        0  [cha: n, def:  0]  Size enable
  WCE         1  [cha: y, def:  1]  Write cache enable
  MF          0  [cha: n, def:  0]  Multiplication factor
  RCD         0  [cha: n, def:  0]  Read cache disable
  DRRP        0  [cha: n, def:  0]  Demand read retention priority
  WRP         0  [cha: n, def:  0]  Write retention priority
  DPTL        0  [cha: n, def:  0]  Disable pre-fetch transfer length
  MIPF        0  [cha: n, def:  0]  Minimum pre-fetch
  MAPF        0  [cha: n, def:  0]  Maximum pre-fetch
  MAPFC       0  [cha: n, def:  0]  Maximum pre-fetch ceiling
  FSW         0  [cha: n, def:  0]  Force sequential write
  LBCSS       0  [cha: n, def:  0]  Logical block cache segment size
  DRA         0  [cha: n, def:  0]  Disable read ahead
  SYNC_PROG   0  [cha: n, def:  0]  Synchronous cache progress indication
  NV_DIS      0  [cha: n, def:  0]  Non-volatile cache disable
  NCS         0  [cha: n, def:  0]  Number of cache segments
  CSS         0  [cha: n, def:  0]  Cache segment size
[tom@localhost ~]$ sudo smartctl --set wcache,on /dev/sda
smartctl 6.4 2015-06-04 r4109 [x86_64-linux-4.2.3-1-ARCH] (local build)
Copyright (C) 2002-15, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF ENABLE/DISABLE COMMANDS SECTION ===
Write cache enabled

[tom@localhost ~]$ sudo sdparm -p ca --long /dev/sda
    /dev/sda: ATA       INTEL SSDSC2BW24  DC32
    Direct access device specific parameters: WP=0  DPOFUA=0
Caching (SBC) [ca] mode page:
  IC          0  [cha: n, def:  0]  Initiator control
  ABPF        0  [cha: n, def:  0]  Abort pre-fetch
  CAP         0  [cha: n, def:  0]  Caching analysis permitted
  DISC        0  [cha: n, def:  0]  Discontinuity
  SIZE        0  [cha: n, def:  0]  Size enable
  WCE         1  [cha: y, def:  1]  Write cache enable
  MF          0  [cha: n, def:  0]  Multiplication factor
  RCD         0  [cha: n, def:  0]  Read cache disable
  DRRP        0  [cha: n, def:  0]  Demand read retention priority
  WRP         0  [cha: n, def:  0]  Write retention priority
  DPTL        0  [cha: n, def:  0]  Disable pre-fetch transfer length
  MIPF        0  [cha: n, def:  0]  Minimum pre-fetch
  MAPF        0  [cha: n, def:  0]  Maximum pre-fetch
  MAPFC       0  [cha: n, def:  0]  Maximum pre-fetch ceiling
  FSW         0  [cha: n, def:  0]  Force sequential write
  LBCSS       0  [cha: n, def:  0]  Logical block cache segment size
  DRA         1  [cha: n, def:  1]  Disable read ahead
  SYNC_PROG   0  [cha: n, def:  0]  Synchronous cache progress indication
  NV_DIS      0  [cha: n, def:  0]  Non-volatile cache disable
  NCS         0  [cha: n, def:  0]  Number of cache segments
  CSS         0  [cha: n, def:  0]  Cache segment size
Comment 2 Tom Yan 2016-05-02 19:13:49 UTC
Or even more clearly:

[tom@localhost ~]$ sudo smartctl --set lookahead,off /dev/sdb
smartctl 6.4 2015-06-04 r4109 [x86_64-linux-4.5.1-1-ARCH] (local build)
Copyright (C) 2002-15, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF ENABLE/DISABLE COMMANDS SECTION ===
Read look-ahead disabled

[tom@localhost ~]$ sudo sdparm --get=DRA /dev/sdb
    /dev/sdb: ATA       INTEL SSDSC2BW24  DC32
DRA         0  [cha: n, def:  0]
[tom@localhost ~]$ sudo smartctl --set wcache,on /dev/sdb
smartctl 6.4 2015-06-04 r4109 [x86_64-linux-4.5.1-1-ARCH] (local build)
Copyright (C) 2002-15, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF ENABLE/DISABLE COMMANDS SECTION ===
Write cache enabled

[tom@localhost ~]$ sudo sdparm --get=DRA /dev/sdb
    /dev/sdb: ATA       INTEL SSDSC2BW24  DC32
DRA         1  [cha: n, def:  1]
[tom@localhost ~]$ sudo smartctl --set lookahead,on /dev/sdb
smartctl 6.4 2015-06-04 r4109 [x86_64-linux-4.5.1-1-ARCH] (local build)
Copyright (C) 2002-15, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF ENABLE/DISABLE COMMANDS SECTION ===
Read look-ahead enabled

[tom@localhost ~]$ sudo sdparm --get=DRA /dev/sdb
    /dev/sdb: ATA       INTEL SSDSC2BW24  DC32
DRA         1  [cha: n, def:  1]
[tom@localhost ~]$ sudo smartctl --set wcache,on /dev/sdb
smartctl 6.4 2015-06-04 r4109 [x86_64-linux-4.5.1-1-ARCH] (local build)
Copyright (C) 2002-15, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF ENABLE/DISABLE COMMANDS SECTION ===
Write cache enabled

[tom@localhost ~]$ sudo sdparm --get=DRA /dev/sdb
    /dev/sdb: ATA       INTEL SSDSC2BW24  DC32
DRA         0  [cha: n, def:  0]
Comment 3 Tom Yan 2016-07-19 11:30:47 UTC
Commit 0c12735e8abf ("libata-scsi: fix SET FEATURES "filtering" for ata_msense_caching()") applied to libata/for-4.8

Note You need to log in before you can comment on or make changes to this bug.