Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2195936ybb; Thu, 2 Apr 2020 15:16:59 -0700 (PDT) X-Google-Smtp-Source: APiQypJOBUI70mDKVNkYvCkoaVU4n6TcJDecj1MMNLw3S6HCjXEHSkvVaV/4Y7QHbwjVRFLoCuJu X-Received: by 2002:a9d:d0a:: with SMTP id 10mr3644295oti.357.1585865819739; Thu, 02 Apr 2020 15:16:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585865819; cv=none; d=google.com; s=arc-20160816; b=YU1AyyA4TCpS4Wwqz6xIt/18jR0nhnrja4JwJr3B0AdpINdBm3fYTbqMi/el3n5XUO aiKXmbRjvNZBSsfUGhzpRfd9fJ+ixoMQsgjy6cGXEYswZoZxZdZHxbGQE4+yGM0HIv7W YmrsFx1qVYll6Aceqwqp7bJ64EpmcHzW4KnJKQmldEwoNztldj5HuG2TDXHNNFYUGn9V jlbcsxYLwTOeCli7sVuAUQsuKiibhL1MhyjmMytStMZKc6bYBbFjOTZfA2a4oaXOTKCx Mp+0biSUdR+lZuTBZHfU4Hl1kWTLeUraidXphoA3wEzmFjSRbbpgcUit1hgt0e9G+DTE m7yA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=fPUE5Ux6t1ZmXWbn6Wue8riIBLccyrWYZrJD4d05O54=; b=DVXqn1cPUCVFXMhDo88a+0hl+WHXpjYjk0A8unK+5t7QQCHLbFaZ9DLxnuI8phrJh6 sfCsCd8O+2EJTZnAENe1yMR9iZw/kjlQX3TYYvJfs3Z7CY4QGz9I4KXWadc3DOHJwwcz jrs0LlZcjiUwLwY2WEilNBcLA9ytXw/+dHkA3lpf0iXvPc+BRinaHq1cTl15KBmcSeGS DLhaQLv1wLCXwpCVx0GQxcfa5a7lGBM2tSBbHNZv+U6GKmL2E9F7V0PLMbRa1PADS3f7 rryat7m5UaUH3kIgflcoUiAROelVPp3+8rCHw6diP2mfWS5gGnDPRjHNwCGiCbBLa+0n 2Z7A== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w73si2833757oiw.206.2020.04.02.15.16.44; Thu, 02 Apr 2020 15:16:59 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389613AbgDBWOb (ORCPT + 99 others); Thu, 2 Apr 2020 18:14:31 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:34952 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389402AbgDBWOb (ORCPT ); Thu, 2 Apr 2020 18:14:31 -0400 Received: by mail-wm1-f66.google.com with SMTP id i19so5517340wmb.0 for ; Thu, 02 Apr 2020 15:14:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=fPUE5Ux6t1ZmXWbn6Wue8riIBLccyrWYZrJD4d05O54=; b=YHfxXZ/YE9EU4X7s6JYTgyhLrfTyBHfxbtnZSWUPHNdkdHqXkwtdghjziXnJmBB9rs JIDTR+hNOzCieeL3RyQLhLsFePR04J4rMpOcQSMkDIEZmqvpqTDxevq4YYWsZSBO0l4l 0c2S39JqfLaQu9rV8NXZHMM1En04RL+0Jx5qcuWBsJfkgxHLYYcyMLZieKb1MFKvQvqu neGsqQe8XALRgu50eXjyhQlF2A2PUrdaV8CpjfdenLEy9KFpL2Bw4FuLp0XHrWLgrphr a0nruGn4/40FlcuOq1JQEWOg2XSgtQtnisNiCfZWmxyE9NzkCuQCs47sURiBu+bzXMJg Z4Ww== X-Gm-Message-State: AGi0PuakBFXy1OPtbnaenb1+ESo0aJHJBWgMpCDqQxvI5Shm/Y4O2pJO Mnha4prgZMuK9qFJdmu2tN0yMxDN X-Received: by 2002:a1c:f213:: with SMTP id s19mr5375822wmc.116.1585865669036; Thu, 02 Apr 2020 15:14:29 -0700 (PDT) Received: from ?IPv6:2601:647:4802:9070:9069:e334:a021:3782? ([2601:647:4802:9070:9069:e334:a021:3782]) by smtp.gmail.com with ESMTPSA id n2sm9516018wro.25.2020.04.02.15.14.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Apr 2020 15:14:28 -0700 (PDT) Subject: Re: [PATCH] nvmet: add revalidation support to bdev and file backed namespaces To: Anthony Iliopoulos , Christoph Hellwig , Chaitanya Kulkarni Cc: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org References: <20200402193052.19935-1-ailiop@suse.com> From: Sagi Grimberg Message-ID: Date: Thu, 2 Apr 2020 15:14:25 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20200402193052.19935-1-ailiop@suse.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +void nvmet_bdev_ns_revalidate(struct nvmet_ns *ns) > +{ > + loff_t size; > + > + size = i_size_read(ns->bdev->bd_inode); > + > + if (ns->size != size) > + ns->size = size; Why is the if useful? > +} > + > static u16 blk_to_nvme_status(struct nvmet_req *req, blk_status_t blk_sts) > { > u16 status = NVME_SC_SUCCESS; > diff --git a/drivers/nvme/target/io-cmd-file.c b/drivers/nvme/target/io-cmd-file.c > index cd5670b83118..c102437db72a 100644 > --- a/drivers/nvme/target/io-cmd-file.c > +++ b/drivers/nvme/target/io-cmd-file.c > @@ -80,6 +80,20 @@ int nvmet_file_ns_enable(struct nvmet_ns *ns) > return ret; > } > > +void nvmet_file_ns_revalidate(struct nvmet_ns *ns) > +{ > + struct kstat stat; > + > + if (!ns->file) > + return; When is !ns->file expected?