Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3471302rdb; Wed, 13 Sep 2023 13:05:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHDzAztSO9MCdYJC3x4UlYj937dNm58YJwZaqC86Ry4/AVGRS1ABND+EHKLzKci/eFBjBKr X-Received: by 2002:a05:6a21:1f03:b0:148:6a9e:143f with SMTP id ry3-20020a056a211f0300b001486a9e143fmr2439182pzb.21.1694635538140; Wed, 13 Sep 2023 13:05:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694635538; cv=none; d=google.com; s=arc-20160816; b=pNH2U8uSvm4CX/X46g+hsEDAgEmkuyxuJjDYfqSpc9AXYiA1fatEgw+oL81bBIfDAU BF3dmSJl/DTF3Z6IM9q2ueOjJZOEJRj1N04bzhlP2rUnrulFDbmv8QqpGI2JdN1XYYpX qyvVRswjCIqb7mjZksGxI7jxSZYgRQsjwLNR3tPqD7lVna/H1+Ra4lqBPxw9c53gMnwY 9ERqLQugU8CzKctelCXW33D8P3/HOa3oX79PbkexGQRmBYw6QpOBiE4xa/VcWpL6pdmc KA3zSB/5aZwmf8AHTfvha21oSDifzYUDxJoopDUj6CCmBPPTh4bgkEbvW7CA+KtM202l oqFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:reply-to:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature; bh=qVk3/CE5e8fLZkZLh5KxyTgw7iuH+oU1qbI7sf/DAeU=; fh=xV9ZULmL4FnlOm7g61d/8mScCpdBUprrNIRAm8Y6dUg=; b=gcZs2waCDxVR1vaPjRbOekxDEJzV/V+tscIDN46jjzBRF1JekpIHUZZMk8SByH6Guq +HLks96qEYcG6S9d6FSYgecgx+5Fl2ykMIpdJJ+9I+TUU/c6AKUZ+7cXh4PBEsqvgpBx UYJMvtNFPshKMD+n8J/iOAeuO9hXwg/9E2vtV9v1uRTM91W7fpRrIuiBTc14Iy5tVSuk diOzv1ZOE+Qr2Cldgq8L0rYIH0EfytK+9gdsOAKEqOifrGMe/izerZqfgIGcOhhnLGul B/AuwVATPq4xD1O6iU+nIt8PNMn+lP8xu9Ag+IIEqAa+Sn37QakJQ/RipYEop/YuEge/ n3dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=ujGYJrZc; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id l5-20020a056a00140500b0068fcb9a7349si5920256pfu.349.2023.09.13.13.05.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 13:05:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=ujGYJrZc; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id E2A37848B32C; Wed, 13 Sep 2023 07:50:03 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234714AbjIMOuB (ORCPT + 99 others); Wed, 13 Sep 2023 10:50:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234203AbjIMOuA (ORCPT ); Wed, 13 Sep 2023 10:50:00 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BC6CAC; Wed, 13 Sep 2023 07:49:56 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id D312C21862; Wed, 13 Sep 2023 14:49:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1694616594; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=qVk3/CE5e8fLZkZLh5KxyTgw7iuH+oU1qbI7sf/DAeU=; b=ujGYJrZc9zUIGUE3kbhur5R1JRBiOC5Y5cCtY3pHeFKvHcIbY+8Kh2QSPMIebpOsyoqWM6 W9NBk3cRMBA6CZPJTLI6LxLmqTbWtHwJB36IAQnUY77Lp4hXlZnGhAwFdoxaZhv+2qjVxU XkXZQEfiQlO+jE8BDv7PrOljU0OHNDs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1694616594; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=qVk3/CE5e8fLZkZLh5KxyTgw7iuH+oU1qbI7sf/DAeU=; b=qSNADMRNpmcRg8OHB595Kv5Hl6z0BbNgbsYZnhWi3LQ17JCNk8QJstyYJqCZP+sgWvkCtz mFVnUObq9IlHNWDA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 9ABAA13440; Wed, 13 Sep 2023 14:49:54 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id spvwJBLMAWXobQAAMHmgww (envelope-from ); Wed, 13 Sep 2023 14:49:54 +0000 Date: Wed, 13 Sep 2023 16:49:52 +0200 From: David Sterba To: Johannes Thumshirn Cc: "dsterba@suse.cz" , Chris Mason , Josef Bacik , David Sterba , Christoph Hellwig , Naohiro Aota , Qu Wenruo , Damien Le Moal , "linux-btrfs@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v8 01/11] btrfs: add raid stripe tree definitions Message-ID: <20230913144951.GL20408@twin.jikos.cz> Reply-To: dsterba@suse.cz References: <20230911-raid-stripe-tree-v8-0-647676fa852c@wdc.com> <20230911-raid-stripe-tree-v8-1-647676fa852c@wdc.com> <20230912203214.GE20408@twin.jikos.cz> <50cfa5a0-c209-430f-8c00-54ba41c3791d@wdc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <50cfa5a0-c209-430f-8c00-54ba41c3791d@wdc.com> User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 13 Sep 2023 07:50:04 -0700 (PDT) On Wed, Sep 13, 2023 at 06:02:09AM +0000, Johannes Thumshirn wrote: > On 12.09.23 22:32, David Sterba wrote: > >> @@ -306,6 +306,16 @@ BTRFS_SETGET_FUNCS(timespec_nsec, struct btrfs_timespec, nsec, 32); > >> BTRFS_SETGET_STACK_FUNCS(stack_timespec_sec, struct btrfs_timespec, sec, 64); > >> BTRFS_SETGET_STACK_FUNCS(stack_timespec_nsec, struct btrfs_timespec, nsec, 32); > >> > >> +BTRFS_SETGET_FUNCS(stripe_extent_encoding, struct btrfs_stripe_extent, encoding, 8); > > > > What is encoding referring to? > > At the moment (only) the RAID type. But in the future it can be expanded > to all kinds of encodings, like Reed-Solomon, Butterfly-Codes, etc... I see, could it be better called ECC? Like stripe_extent_ecc, that would be clear that it's for the correction, encoding sounds is too generic. > >> + __le64 devid; > >> + /* physical location on disk */ > >> + __le64 physical; > >> + /* length of stride on this disk */ > >> + __le64 length; > >> +}; > > > > __attribute__ ((__packed__)); > > The structure doesn't have any holes in it so packed is not needed. > > I might also be misinformed, but doesn't packed potentially lead to bad > code generation on some platforms? I've always been under the > impression that packed forces the compiler to do byte-wise loads and > stores. But as I've said, I might be misinformed. All on-disk structures have the packed attribute so for consistency and future safety it should be here too, even if it technically does not need it due to alignment. In addition, strucutres that need padding would be also problematic, e.g. u64 followed by u32 needs 4 bytes of padding but the next item after it would be placed right after u32. It's right that on some platforms unaligned access is done by more code but for the same reason on such platforms we can't let the compiler decide the layout when the structure is directly mapped onto the blocks.