From patchwork Wed Mar 30 15:07:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 8697961 Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A5BA3C0553 for ; Wed, 30 Mar 2016 15:08:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D1C112026F for ; Wed, 30 Mar 2016 15:08:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E489820389 for ; Wed, 30 Mar 2016 15:08:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754465AbcC3PIP (ORCPT ); Wed, 30 Mar 2016 11:08:15 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:15592 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754396AbcC3PIO (ORCPT ); Wed, 30 Mar 2016 11:08:14 -0400 Received: from pps.filterd (m0089730.ppops.net [127.0.0.1]) by m0089730.ppops.net (8.16.0.11/8.16.0.11) with SMTP id u2UF6GrH006106; Wed, 30 Mar 2016 08:08:12 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=JJwsPT4BunpP4OTHlVy0PSHRimYQvqPeaGhOZLoBw24=; b=pTniAiT24F8xUzF9JCbv0ZgEr/E0negTeHc3kZbTzB2MkiZhmjxj1pXH5685WYHN4Rkt tZCl84z3jGschralpVUyyG6MESnXsP0RGb6o7aMho+ciXI0vXym309l11wgJMrhF7XVG ciFm7Asac5j7CuBKerBQSRKVGfjXofbCjy4= Received: from mail.thefacebook.com ([199.201.64.23]) by m0089730.ppops.net with ESMTP id 22037dp8hy-5 (version=TLSv1 cipher=AES128-SHA bits=128 verify=NOT); Wed, 30 Mar 2016 08:08:12 -0700 Received: from localhost.localdomain (192.168.54.13) by mail.thefacebook.com (192.168.16.22) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 30 Mar 2016 08:08:08 -0700 From: Jens Axboe To: , , CC: Jens Axboe Subject: [PATCH 6/9] sd: inform block layer of write cache state Date: Wed, 30 Mar 2016 09:07:54 -0600 Message-ID: <1459350477-16404-7-git-send-email-axboe@fb.com> X-Mailer: git-send-email 2.8.0.rc4.6.g7e4ba36 In-Reply-To: <1459350477-16404-1-git-send-email-axboe@fb.com> References: <1459350477-16404-1-git-send-email-axboe@fb.com> MIME-Version: 1.0 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-30_08:, , signatures=0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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); } /*