Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1401414ybf; Thu, 27 Feb 2020 10:14:52 -0800 (PST) X-Google-Smtp-Source: APXvYqwXDNS/BQQDVsIqSki+gyK1G+n+0Rcjw0WCKrFrx8BKVRozKZe8FuWZ6r+2Tn26t4E0xaWt X-Received: by 2002:aca:c3d5:: with SMTP id t204mr268751oif.80.1582827292750; Thu, 27 Feb 2020 10:14:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582827292; cv=none; d=google.com; s=arc-20160816; b=xF+x7nG+pM1NbgZsOKmtpVA/oEZH1m1VucLKeK5dQ9bGcVeLkWN/iPzZJsR/4oeYB3 xSv9VxLpojusEFBXcpBgtd7hAHytKGnieewbggKZyvUYIf0qhvRhayIcfJ4GVTSbeL9m Ldto31Uqnpy2pZH2IOoSuDYZkn7v3FL0IMNrCx3TPiTIXk6uaj07z+a72h1mEZdkRo/f DuylG4/zOM+rCQkqBZEErYturgtsyeqhTGFxAuUFUX6gIGF8V5LkYzxPnG8Lxfhz/D6H gdUXwa2FeUKraGCSgcTjzQA3UJyUNtpQg4iCfcY9uEVGIbUAA5HIuGceJ+VKy00VYNfl 29zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=qxeohmUcwpwsnIr8sHlzjR3GNnNKdFee7m8sNWo7zJQ=; b=LodPF24yfD9pTLOiDK8ohCknRf6lJnKd18a7vu+sSgoxSXKtOXJ1Yw9dj5vvAcK2FJ riLIoNpJNa5PPED7oxETyJ9ZDEQlIoTvfga+NqAc9N8n78Th76+Fb4gTMLZhFH/JxJxB Qt7GMCuO3YoSrZkn0/AmlAnGMRjhdqO0FnGo31+G6IN8zeGfC8pjyP+1Nzgfag8qawy+ TqBfS2TXywsMYwqO1FlKqJRQAnxUXKzw0KUY4OX95XIVlHvAuO9HCtk5yq8Im7J0u9EH MIVQRl6SZ90ZMWehwE4FZiXOE4C85kkVkjdurrXNGfCCGZj19t+idJiyt0dLZF2Wq+im ACYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sT4dmVR9; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d20si1901660oti.311.2020.02.27.10.14.37; Thu, 27 Feb 2020 10:14:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sT4dmVR9; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729501AbgB0SOO (ORCPT + 99 others); Thu, 27 Feb 2020 13:14:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:37036 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726877AbgB0SOO (ORCPT ); Thu, 27 Feb 2020 13:14:14 -0500 Received: from sol.localdomain (c-107-3-166-239.hsd1.ca.comcast.net [107.3.166.239]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 02F29246B0; Thu, 27 Feb 2020 18:14:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582827253; bh=DfvmaQgMZxcqfEpHuvrrlNTCaevj5uxdnW4bw4l/cwQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=sT4dmVR9UsPbGMcknWI3bgOsjSvrPsgtUAmdt1lWngGDPvi6tYTXfp8zAlivAVVGE Nodjsd6dayZE3c3DVdI5DxqXH1cs4fq2TQNuuy1ir3hHqyCE3C9nGSpbDbR7iyczgy thWQWFpyhElDDeVDwp9+De4JDQO1/TZDUfWsjIts= Date: Thu, 27 Feb 2020 10:14:11 -0800 From: Eric Biggers To: Christoph Hellwig Cc: Satya Tangirala , linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, linux-fscrypt@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-ext4@vger.kernel.org, Barani Muthukumaran , Kuohong Wang , Kim Boojin Subject: Re: [PATCH v7 1/9] block: Keyslot Manager for Inline Encryption Message-ID: <20200227181411.GB877@sol.localdomain> References: <20200221115050.238976-1-satyat@google.com> <20200221115050.238976-2-satyat@google.com> <20200221170434.GA438@infradead.org> <20200221173118.GA30670@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200221173118.GA30670@infradead.org> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Fri, Feb 21, 2020 at 09:31:18AM -0800, Christoph Hellwig wrote: > On Fri, Feb 21, 2020 at 09:04:34AM -0800, Christoph Hellwig wrote: > > Given that blk_ksm_get_slot_for_key returns a signed keyslot that > > can return errors, and the only callers stores it in a signed variable > > I think this function should take a signed slot as well, and the check > > for a non-negative slot should be moved here from the only caller. > > Actually looking over the code again I think it might be better to > return only the error code (and that might actually be a blk_status_t), > and then use an argument to return a pointer to the actual struct > keyslot. That gives us much easier to understand code and better > type safety. That doesn't make sense because the caller only cares about the keyslot number, not the 'struct keyslot'. The 'struct keyslot' is internal to keyslot-manager.c, as it only contains keyslot management information. Your earlier suggestion of making blk_ksm_put_slot() be a no-op on a negative keyslot number sounds fine though. - Eric