From patchwork Fri Aug 18 21:00:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Brace X-Patchwork-Id: 9909929 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A63EC60385 for ; Fri, 18 Aug 2017 21:00:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 97A2228CCA for ; Fri, 18 Aug 2017 21:00:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8C33B28CD9; Fri, 18 Aug 2017 21:00:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA3F428D2A for ; Fri, 18 Aug 2017 21:00:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752060AbdHRVAd (ORCPT ); Fri, 18 Aug 2017 17:00:33 -0400 Received: from mail-sn1nam02on0052.outbound.protection.outlook.com ([104.47.36.52]:58982 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751695AbdHRVAc (ORCPT ); Fri, 18 Aug 2017 17:00:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mscc365.onmicrosoft.com; s=selector1-microsemi-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=FS7naeGjui6VpSqqfBSohujI57xJiQuPFwoeGxW0ndA=; b=jLoRbkV8ecnTQI6h0ueBRtWNocgI11oilHnPgmthNVtLq0/y/oWgikJNKyK7dVKqC4VUHyYLfpEtHlGbo5CRwJNE229PeEmL03+Po2KlwdkAdiyR1f4cSRA1pyxuYMIWp2XJZr2WYetLAR8DtFb3W2nRkNg2kyA9wE4RwNu+JFo= Received: from SN4PR0201CA0065.namprd02.prod.outlook.com (10.171.31.155) by BN3PR0201MB0932.namprd02.prod.outlook.com (10.160.155.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1362.18; Fri, 18 Aug 2017 21:00:29 +0000 Received: from BN1BFFO11FD040.protection.gbl (2a01:111:f400:7c10::1:170) by SN4PR0201CA0065.outlook.office365.com (2603:10b6:803:20::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1341.21 via Frontend Transport; Fri, 18 Aug 2017 21:00:28 +0000 Received-SPF: Pass (protection.outlook.com: domain of microsemi.com designates 208.19.100.21 as permitted sender) receiver=protection.outlook.com; client-ip=208.19.100.21; helo=avsrvexchhts1.microsemi.net; Received: from avsrvexchhts1.microsemi.net (208.19.100.21) by BN1BFFO11FD040.mail.protection.outlook.com (10.58.144.103) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.1341.15 via Frontend Transport; Fri, 18 Aug 2017 21:00:28 +0000 Received: from [127.0.1.1] (10.238.32.34) by avsrvexchhts1.microsemi.net (10.100.34.105) with Microsoft SMTP Server id 14.3.361.1; Fri, 18 Aug 2017 14:00:27 -0700 Subject: [PATCH] sd: preserve sysfs updates to max_sectors_kb From: Don Brace To: , , , , , , , , , , , , CC: Date: Fri, 18 Aug 2017 16:00:25 -0500 Message-ID: <150309002518.8999.15900049133748830764.stgit@brunhilda> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:208.19.100.21; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(39860400002)(2980300002)(438002)(189002)(199003)(5660300001)(106466001)(69596002)(8676002)(81156014)(81166006)(356003)(8936002)(33646002)(23676002)(2906002)(15650500001)(83506001)(626005)(47776003)(54356999)(50986999)(4326008)(2201001)(189998001)(97736004)(9686003)(68736007)(50466002)(53936002)(230700001)(33716001)(104016004)(478600001)(305945005)(86362001)(103116003)(77096006)(4001350100001)(921003)(1121003)(2101003)(83996005); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR0201MB0932; H:avsrvexchhts1.microsemi.net; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD040; 1:yY65TteSI0wGZN0VPSvLC+1YyL5AZADLePmSblzHQA/BTYyzmWO3mOzEe23InwIuzqE/nN0/1+ThvVBub1ULEziEHwQSuZRiyWzmcrcinDUqC0VqZYGdg259ZkTfqyCa X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2bd47c1c-798d-4c8d-680c-08d4e67c27f3 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(8251501002)(300000503095)(300135400095)(2017052603157)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BN3PR0201MB0932; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0201MB0932; 3:eR0he0GtkO3asUT0lMY1leSaCW0ha2q6yxfHXvowl2IRCvGxb083JIcIgpaY4FM11BorAQYSCQXj9FAsOzBnGk6hUke7wIu9LJGj0KGUFMHbwmWXwIcegOlENml9QRp1Wo31DjDApkzsDJ5A+N0fO9mJhOngwa2gvrVxdj7B0yEY4xOVsd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FrvHkypwsMEybd/jtHJqvz2tt+SIZ7Ow5XR+xUBnvbHtqDSCPEwQbDDVa4F8HIfM6OU3XTs7Vv6CqF20RoGZgXuN2uv4OPznJskq08joZXe3TLBjjhceCb2wxgtd5VgeHQeVQsBlA2v0ogfNCjAauiLn2mcDcrlrby+k4PTNk5mSctrBvkSrCp5EfAdSRFaENaODWbiGdg3l7wq+tFTqnqaNoBAljVIvEvIENuRy7sH3VB9rznUOoVukQ1g7GuRJ5YX+kLN1abUuLlRle/eh X-Exchange-Antispam-Report-Test: UriScan:(72170198267865); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(13018025)(5005006)(13016025)(3002001)(93006095)(93004095)(100000703101)(100105400095)(10201501046)(6055026)(6041248)(20161123560025)(20161123555025)(20161123562025)(20161123564025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN3PR0201MB0932; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN3PR0201MB0932; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0201MB0932; 4:aNAhqhrHxbLu517FX+DVdlrNldtzmn65MKa4j5BZhSC8tko9y0pIiQuIsElfaSGhTzud2KsW3knaVIRiLZ1crGloBH2S7hf3wak5t189iNcONpdOBX3jhmdwRXpDSGzjM7B72efhVsQlB2SghWaN32tJvYbze646B6gYf9S82XDp0mvP4fNemMpiV7Lj6AtYoW110r/URAo3LDB+k5w9WpgZvAs7Xi4la44wRI1+GzdWPDGH3ZoBZ/Qy/jHQ0MZ8AklU9ZqTCHaLR0dxMd+DVEZjgke1yjaSoSyEMdpbjaU= X-Forefront-PRVS: 040359335D X-Micros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yqnqew==; 5:0sG1ovAfWvdCuLjyYUic1HT9TY8WVsV/rjqhCMVMnxJuFufeHcVpiat1rQ2YJOkHM2leM7zjKAXq2i84pClzaNoHViAENzwtgf1eKYyxnQZD5FvkrG3si1/WPzubPr0L248i055v6EItVX39qus6bg==; 24:K6Q6HPCCAg0/u+WwOZNMRh8h8PZlm/ULc1fsMpjTsW6g/MftnMnNiY+f9egF3CDg3R85dMl0nbHRtg3CyXVlF9B/EWP+GGUh9PGxi4m/cl0=; 7:w+YPY8vglz5KeFMqZ4HorX02Ru9WCiQHnJKPEG2op2GuBWQ8zUqNHpgnrEeM9OO5ClnAtNICXWZDkWaaOMGdlLkZ/ZyJsvpfjHGmg3+FUpL7a+jj6e/mAkbe9gZt7MBbYsBcsd47vgXuqnSVD8GAhR9TgFSdjpwP8KdMkS2eFd9BrnY02vnTYcFMt5sGDtn3VYYgXunEDz5idnKyyVRTH7piK+TVePebVykcI7rHrDM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: microsemi.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Aug 2017 21:00:28.3091 (UTC) X-MS-Exchange-CrossTenant-Id: f267a5c8-86d8-4cc9-af71-1fd2c67c8fad X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f267a5c8-86d8-4cc9-af71-1fd2c67c8fad; Ip=[208.19.100.21]; Helo=[avsrvexchhts1.microsemi.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0201MB0932 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP prevent systemd-udevd from changing a device's sysfs entry max_sectors_kb back to the default value. - max_sectors_kb can be tweaked for better performance. - udev can be triggered by sg_logs -t or scsi_temperature, ... - sd_revalidate_disk is called from udev by ioctl BLKRRPART Reviewed-by: Scott Teel Signed-off-by: Don Brace --- drivers/scsi/sd.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index bea36ad..457dc7c 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -3055,6 +3055,7 @@ static int sd_revalidate_disk(struct gendisk *disk) sector_t old_capacity = sdkp->capacity; unsigned char *buffer; unsigned int dev_max, rw_max; + unsigned int max_sectors; SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, "sd_revalidate_disk\n")); @@ -3128,9 +3129,14 @@ static int sd_revalidate_disk(struct gendisk *disk) rw_max = min_not_zero(logical_to_sectors(sdp, dev_max), (sector_t)BLK_DEF_MAX_SECTORS); - /* Combine with controller limits */ - q->limits.max_sectors = min(rw_max, queue_max_hw_sectors(q)); + /* Check for max_sectors_kb update through sysfs */ + if (q->limits.max_sectors < min(rw_max, queue_max_hw_sectors(q))) + max_sectors = q->limits.max_sectors; + else + max_sectors = min(rw_max, queue_max_hw_sectors(q)); + /* Combine with controller limits */ + q->limits.max_sectors = max_sectors; set_capacity(disk, logical_to_sectors(sdp, sdkp->capacity)); sd_config_write_same(sdkp); kfree(buffer);