Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3529697imm; Sun, 19 Aug 2018 23:36:02 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzX8mSbIUpjhjcfY6cG6aMciWi30hpkeVzbW64YHuECzM7RU4ONihYINhxOSQylpaiJeYHM X-Received: by 2002:a17:902:758b:: with SMTP id j11-v6mr44150973pll.29.1534746962440; Sun, 19 Aug 2018 23:36:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534746962; cv=none; d=google.com; s=arc-20160816; b=IvDFIsnN5PHnFHRSSOdlxyPhKZtj6ojnHbMoBpmpgnfZXRne/3ZJlNFzoOUpNY+y4r 6HkUg55LNQOau0wO5D8eiI6xzP6oQ3n2fe2rFyCw+ZjLIVtFSTm5adu7lOgRiyAaFxy4 SfIRmmy3tBNqiyMxi/bvmaw1hwhpkDPzJSS05sT6mK2K1c93jjAXuKWEp5uGWSDG30x6 q6roWjf+8+YnzKmJOu9lo48lk7PYV3R85/CS5A2fRG0ZGCoij3IXUIF22RsTDDGgi99b ozco0Ut4xzWFOAkHmk4nrvL6IdEQjitjmGO7nJ5BPxhYJ4r2tJBIieGAQ04vRBISW04s PYjw== 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:arc-authentication-results; bh=p+L3ahkmcmhMfPyWkMfYJNMfSa61g7ydiRD5Vg/edQo=; b=F+GFjUbHfqYWkwgpC4++zIZHw6E+IZZDvf6Rfd5vL+bRQKrvk20Ey9Yqn5VZjjY7v9 /GhH7qT0tYSw63OefmfBYHywcxODK2nB/ImdEkdTxImKVYmU4SGkuqKk7VUB72/YDHBY PgdkFvZ4Y7KBCw2RGgzYaHKfgmPhrr+uImKZyE8MpqXF6UPiGBAqUD+dBtbo4gtZpKTx bH0YWVREer24fnYRMEsl+Z+9uo8INvwv4l3JKkY9/vij6QW80uqiu8OOKVUhZfpSFuzD ZgKBTj3cOGUZKkr2tzMz4nIxaS/O/JTyIFK9Nt33nuxB9ggiDbE9XFoEWEkNoXN9/F5o AlCA== 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 q74-v6si9551327pfq.32.2018.08.19.23.35.46; Sun, 19 Aug 2018 23:36:02 -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 S1726106AbeHTJsz (ORCPT + 99 others); Mon, 20 Aug 2018 05:48:55 -0400 Received: from mx2.suse.de ([195.135.220.15]:51156 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725948AbeHTJsz (ORCPT ); Mon, 20 Aug 2018 05:48:55 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 32809AD27; Mon, 20 Aug 2018 06:34:31 +0000 (UTC) Subject: Re: [PATCH 2/5] nvme: register ns_id attributes as default sysfs groups To: Bart Van Assche , "hch@lst.de" Cc: "linux-kernel@vger.kernel.org" , "linux-block@vger.kernel.org" , "sagi@grimberg.me" , "axboe@kernel.dk" , "hare@suse.com" , "linux-nvme@lists.infradead.org" , "keith.busch@intel.com" References: <20180814073305.87255-1-hare@suse.de> <20180814073305.87255-3-hare@suse.de> <5a4aab8b5f509d8090ad10107b01d11285fe1528.camel@wdc.com> <20180817070013.GD11170@lst.de> From: Hannes Reinecke Message-ID: <57d23cf3-b408-434c-9a20-dfa4eb309677@suse.de> Date: Mon, 20 Aug 2018 08:34:29 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/17/2018 10:04 PM, Bart Van Assche wrote: > On Fri, 2018-08-17 at 09:00 +0200, hch@lst.de wrote: >> On Tue, Aug 14, 2018 at 03:44:57PM +0000, Bart Van Assche wrote: >>> On Tue, 2018-08-14 at 17:39 +0200, Hannes Reinecke wrote: >>>> While I have considered having nvme_nvm_register_sysfs() returning a >>>> pointer I would then have to remove the 'static' declaration from the >>>> nvm_dev_attr_group_12/20. >>>> Which I didn't really like, either. >>> >>> Hmm ... I don't see why the static declaration would have to be removed from >>> nvm_dev_attr_group_12/20 if nvme_nvm_register_sysfs() would return a pointer? >>> Am I perhaps missing something? >> >> No, I think that would be the preferable approach IFF patching the global >> table of groups would be viable. I don't think it is, though - we can >> have both normal NVMe and LightNVM devices in the same system, so we >> can't just patch it over. >> >> So we'll need three different attribut group arrays: >> >> const struct attribute_group *nvme_ns_id_attr_groups[] = { >> &nvme_ns_id_attr_group, >> NULL, >> }; >> >> const struct attribute_group *lightnvm12_ns_id_attr_groups[] = { >> &nvme_ns_id_attr_group, >> &nvm_dev_attr_group_12, >> NULL, >> }; >> >> const struct attribute_group *lightnvm20_ns_id_attr_groups[] = { >> &nvme_ns_id_attr_group, >> &nvm_dev_attr_group_20, >> NULL, >> }; >> >> and a function to select which one to use. > > Hello Christoph, > > How about applying the patch below on top of Hannes' patch? The patch below > has the advantage that it completely separates the open channel sysfs > attributes from the NVMe core sysfs attributes - the open channel code > doesn't have to know anything about the NVMe core sysfs attributes and the > NVMe core does not have to know anything about the open channel sysfs > attributes. > Yes, this looks like the best approach. I'll fold it into my patchset. Cheers, Hannes -- Dr. Hannes Reinecke Teamlead Storage & Networking hare@suse.de +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg)