Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754954AbdDDXzC (ORCPT ); Tue, 4 Apr 2017 19:55:02 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:55777 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751856AbdDDXzA (ORCPT ); Tue, 4 Apr 2017 19:55:00 -0400 X-IronPort-AV: E=Sophos;i="5.36,276,1486396800"; d="scan'208";a="8621903" From: Bart Van Assche To: "martin.petersen@oracle.com" CC: "jejb@linux.vnet.ibm.com" , "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "steve@digidescorp.com" , "steve.magnani@digidescorp.com" Subject: Re: [PATCH] sd: close hole in > 2T device rejection when !CONFIG_LBDAF Thread-Topic: [PATCH] sd: close hole in > 2T device rejection when !CONFIG_LBDAF Thread-Index: AQHSkStgK6fJ6m1ZXUaiD5hjEeDqtqG2FeNmgAAFfYA= Date: Tue, 4 Apr 2017 23:54:55 +0000 Message-ID: <1491350095.12081.3.camel@sandisk.com> References: <1488208949-3811-1-git-send-email-steve@digidescorp.com> <1488211985.2656.1.camel@sandisk.com> <3a6783ec-200d-5df5-2e1e-756c7e8b7c22@digidescorp.com> <1488221849.2656.8.camel@sandisk.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: oracle.com; dkim=none (message not signed) header.d=none;oracle.com; dmarc=none action=none header.from=sandisk.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [63.163.107.100] x-microsoft-exchange-diagnostics: 1;BY1PR0401MB1532;7:GSAhfvBRxb2+FdHbEuiHO304rqqWHmbqb8xwDSqDOI3udyazdJic009PDV4wrAW4zgvkEvrq7JYc3vWpvDa6sJOokvDhXFQhBedps/OBz9E0iAK5j9ab72r9VOAWizanIlLkQo4kb4w7d0sZsGW7/+OZfVtDRuqJJUhnkkYbTXPb1AdqjIZ/1tdWq3t3m+Ykjf8kQj5yJ5pCjkrc0LT3wMdqim6Pcylj3kpA+ozhw9Vu55ol0AuW5OHXRtAlk3r7y762EWmoBlQUDTBrrUIPXBSfQc0KAoMJzVviuVsbYsfTrpLNe8vnMt7xfX5hjHPwbxGL3pJ/+vkUhO3ZYi7wbA==;20:M8JR/JpXt5Wfvi7dnqruyCtQDbSgPF9rqk5WQIgUTXbWCid3UC2A0NW3Ent4bJVq7M1syz1lTl4ZIaiO1hQG2pjIApf+h3zvcduJsm5ebR4kVrEbhOdguqhKbvPoF+TSUpUZf5O72uhNTX5s3Xlkpae/WvM5CU4L3e7H4GQ1ZYg= x-ms-office365-filtering-correlation-id: b87f535a-9ec8-4b8a-221e-08d47bb5fe95 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030254075)(48565401081)(201703131423075)(201703031133081);SRVR:BY1PR0401MB1532; wdcipoutbound: EOP-TRUE x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(6055026)(6041248)(20161123564025)(20161123562025)(20161123555025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(6072148);SRVR:BY1PR0401MB1532;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0401MB1532; x-forefront-prvs: 0267E514F9 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(39410400002)(39860400002)(39840400002)(39450400003)(39400400002)(39850400002)(377424004)(24454002)(86362001)(54906002)(575784001)(2906002)(3660700001)(4326008)(189998001)(6246003)(36756003)(2351001)(6506006)(6916009)(2950100002)(3280700002)(53936002)(99286003)(6512007)(110136004)(81166006)(2501003)(8676002)(38730400002)(25786009)(229853002)(66066001)(8936002)(6116002)(102836003)(103116003)(93886004)(6436002)(54356999)(5640700003)(76176999)(50986999)(2900100001)(77096006)(33646002)(3846002)(305945005)(5660300001)(122556002)(7736002)(6486002);DIR:OUT;SFP:1102;SCL:1;SRVR:BY1PR0401MB1532;H:BY1PR0401MB1532.namprd04.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-ID: MIME-Version: 1.0 X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Apr 2017 23:54:55.5144 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0401MB1532 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id v34NtKmi029368 Content-Length: 1008 Lines: 30 On Tue, 2017-04-04 at 19:35 -0400, Martin K. Petersen wrote: > diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c > index fb9b4d29af0b..6084c415c070 100644 > --- a/drivers/scsi/sd.c > +++ b/drivers/scsi/sd.c > @@ -2102,6 +2102,16 @@ static void read_capacity_error(struct scsi_disk *sdkp, struct scsi_device *sdp, > > #define READ_CAPACITY_RETRIES_ON_RESET 10 > > +static bool sd_addressable_capacity(u64 lba, unsigned int sector_size) > +{ > + u64 last_sector = lba + 1ULL << ilog2(sector_size) - 9; > + > + if (sizeof(sector_t) == 4 && last_sector > 0xffffffffULL) > + return false; > + > + return true; > +} Hello Martin, How about replacing 0xffffffffULL with U32_MAX, adding parentheses in the last_sector computation to make clear that + and - have precedence over << and adding a comment above?sd_addressable_capacity() that explains its purpose and also that the shift operation must not be replaced with a call to logical_to_sectors()? Otherwise this patch looks fine to me. Thanks, Bart.