Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1823077ybl; Thu, 5 Dec 2019 07:34:55 -0800 (PST) X-Google-Smtp-Source: APXvYqxzhgWtU89i1Wzp5kcHwO7ssRN/zXcc9GWifd4SjUDwgY1oCGq+z0u/DCOxP0zX/R6PbtOC X-Received: by 2002:aca:fc06:: with SMTP id a6mr1749945oii.12.1575560095415; Thu, 05 Dec 2019 07:34:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575560095; cv=none; d=google.com; s=arc-20160816; b=vOP7RXT1C+um2nShykcY9Hfd+LnNNSt5NGFjxq7+OOzy/moruiHmwjclUHqlAEyCsb y7m7GGzOD4V4auorBMdm9wDNvAzimjDeAdPjpu15mFigC6YJntRKZls3bxjXg29VKhLD 9kNKo11y0PR7EwW5h7aro4ZE5qIkj2BjIXKCz1mIC7r/9MaxdfNjgJL7DPMDM3j1bISh eVX55Owxnv5wVl5P4YLISdUnRTrunqv7+D8j0C/6WH7o6V3ZDr6KjIdaCHMaGwPxuhuh DTVsYOcwv5vVnaSlLlcYyWydSl4WHq+MEdG3MbiNPqu7mLcgE6N2sW1/bsBdGDWHZOB4 aJzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date; bh=LC6DDS7dzR3mgMabSVrO4Lfc9Ry73+/2Egm44NEkV5Y=; b=Zoi08WpHNh0rD1KeQ/FuzskJ+sOh7O9WGSImW6WC97LyT8cj3zicxQ3A0JTm5aZwOF QhJQRD76V8/o5Gm6OoMxp9YHouiehODR4WE0dxt5UFkxNp1C323xA3x90SEiZ/QiVaro jr5ifX+3ABAzbJuhZDTf7vH65mQr9TFGWxsjvwd+rvYKidN/HlfNRuq6ZnCeyFo7bm7n Iu5HSnI2GVblcscQvQvY0umURJwwwVxE+9H6m8qgVDsrdy+bQ2xDUSa5QUFZcJPJiRIh tZk7J6FM29O97kS3aSeoOy+uWIGHUPZ6LsXOGZFU7/Ov+ao2BVApcgGwbo3wOWxOykS9 TfAg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s8si5120978otr.166.2019.12.05.07.34.42; Thu, 05 Dec 2019 07:34:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729817AbfLEP3S (ORCPT + 99 others); Thu, 5 Dec 2019 10:29:18 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:39695 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726028AbfLEP3S (ORCPT ); Thu, 5 Dec 2019 10:29:18 -0500 Received: from mail-wr1-f70.google.com ([209.85.221.70]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1ict48-0005VA-1Z for linux-kernel@vger.kernel.org; Thu, 05 Dec 2019 15:29:16 +0000 Received: by mail-wr1-f70.google.com with SMTP id l20so1691069wrc.13 for ; Thu, 05 Dec 2019 07:29:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=LC6DDS7dzR3mgMabSVrO4Lfc9Ry73+/2Egm44NEkV5Y=; b=PVmHzoTZv3sB8f072jDZCsNlhWa0tciFZXr/NX/oVhWX4HHrV/evlx9GqFNP5XK+G4 35ax2Fy6VpStqwixcMwbQOml2RMmHY2wTnd5Z3n5VPxvHKHzjyANybNsROtSDepskuqC ocNvBsQwergOf3ZXmlGx2wvlgaB6nbD4k8jD4PARAz/lxACXOy8NMOSkTl+s7sbqpBjU XjELi/kfPS7ERt9AyZkMMAdsDWnzj+GFhtRo+KhNIRdrkvUA3VJY5/YlIonuhpK3LMJk MVseV8ezc3OBfUHluImBL+s9emBHXs9L1uVbwLO0+GVEyjgIIai5yp2U0tb1JYxqjB3C bsCA== X-Gm-Message-State: APjAAAWA8i3kimNzatQSp8/q7f/D9GTVXq6hwLbx7enFuqvq4MXxyYEJ vypaszDBQ+TjmVu/jJljdkfgeC0MqKKInxkBhJwQ2iXBiLzmcHDU/+3zEaE6wzPM6OZAmx/yko7 kOXVmeF8Og+wjzrkS44H1NcHmifH/AXqM11CsBFizCQ== X-Received: by 2002:a5d:4281:: with SMTP id k1mr11236638wrq.72.1575559755763; Thu, 05 Dec 2019 07:29:15 -0800 (PST) X-Received: by 2002:a5d:4281:: with SMTP id k1mr11236599wrq.72.1575559755411; Thu, 05 Dec 2019 07:29:15 -0800 (PST) Received: from localhost (host40-61-dynamic.57-82-r.retail.telecomitalia.it. [82.57.61.40]) by smtp.gmail.com with ESMTPSA id g74sm179791wme.5.2019.12.05.07.29.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Dec 2019 07:29:14 -0800 (PST) Date: Thu, 5 Dec 2019 16:29:13 +0100 From: Andrea Righi To: Valdis Kletnieks Cc: Greg Kroah-Hartman , linux-fsdevel@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] staging: exfat: properly support discard in clr_alloc_bitmap() Message-ID: <20191205152913.GJ3276@xps-13> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently the discard code in clr_alloc_bitmap() is just dead code. Move code around so that the discard operation is properly attempted when enabled. Signed-off-by: Andrea Righi --- drivers/staging/exfat/exfat_core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/exfat/exfat_core.c b/drivers/staging/exfat/exfat_core.c index d2d3447083c7..463eb89c676a 100644 --- a/drivers/staging/exfat/exfat_core.c +++ b/drivers/staging/exfat/exfat_core.c @@ -192,8 +192,6 @@ static s32 clr_alloc_bitmap(struct super_block *sb, u32 clu) exfat_bitmap_clear((u8 *)p_fs->vol_amap[i]->b_data, b); - return sector_write(sb, sector, p_fs->vol_amap[i], 0); - #ifdef CONFIG_EXFAT_DISCARD if (opts->discard) { ret = sb_issue_discard(sb, START_SECTOR(clu), @@ -202,9 +200,13 @@ static s32 clr_alloc_bitmap(struct super_block *sb, u32 clu) if (ret == -EOPNOTSUPP) { pr_warn("discard not supported by device, disabling"); opts->discard = 0; + } else { + return ret; } } #endif /* CONFIG_EXFAT_DISCARD */ + + return sector_write(sb, sector, p_fs->vol_amap[i], 0); } static u32 test_alloc_bitmap(struct super_block *sb, u32 clu) -- 2.20.1