Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755963AbcCWP0z (ORCPT ); Wed, 23 Mar 2016 11:26:55 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:54794 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755721AbcCWP0R (ORCPT ); Wed, 23 Mar 2016 11:26:17 -0400 From: Jens Axboe To: , , CC: Jens Axboe Subject: [PATCH 6/8] sd: inform block layer of write cache state Date: Wed, 23 Mar 2016 09:25:48 -0600 Message-ID: <1458746750-9213-7-git-send-email-axboe@fb.com> X-Mailer: git-send-email 2.4.1.168.g1ea28e1 In-Reply-To: <1458746750-9213-1-git-send-email-axboe@fb.com> References: <1458746750-9213-1-git-send-email-axboe@fb.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [192.168.54.13] X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-03-23_08:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 888 Lines: 37 Signed-off-by: Jens Axboe --- drivers/scsi/sd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 5a5457ac9cdb..049f424fb4ad 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -192,6 +192,7 @@ cache_type_store(struct device *dev, struct device_attribute *attr, sdkp->WCE = wce; sdkp->RCD = rcd; sd_set_flush_flag(sdkp); + blk_queue_write_cache(sdp->request_queue, wce != 0); return count; } @@ -2571,7 +2572,7 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer) sdkp->DPOFUA ? "supports DPO and FUA" : "doesn't support DPO or FUA"); - return; + goto done; } bad_sense: @@ -2596,6 +2597,8 @@ defaults: } sdkp->RCD = 0; sdkp->DPOFUA = 0; +done: + blk_queue_write_cache(sdp->request_queue, sdkp->WCE != 0); } /* -- 2.4.1.168.g1ea28e1