Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1605011pxb; Thu, 16 Sep 2021 10:54:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0LNX8ITd9mHFpnqBaw1m+T01vW3ZRQxrtWPNwcOZl7TdzL+XbLeXa3ABSZ3hb4bhx+qvl X-Received: by 2002:a6b:f610:: with SMTP id n16mr5529045ioh.139.1631814879354; Thu, 16 Sep 2021 10:54:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631814879; cv=none; d=google.com; s=arc-20160816; b=L+P/n/0rOrXT9nOYAufKcbSwr3s1Me+d9H80KlUIWuQPwg7x7q0JvKbJhY1Y16duiv WyVbq3wqAmGVtetsgCbDlN51ZHBedMPn2y00R6Nzd6DTx9cUmFAhRugFO1PzLsmrE+pS BAmluWTCguv83qOQr9mKsPclyaikVoYvKmXaBTRuMYfResMWx7gkbVT2mBfWNtmdTYSe H7ZCeGJ6Zg+xdGmVnZLj0y54Kd0hY3YEysDIXtrhadu33z1BRQ1yZeCN3gZUn6WRJZLf mvv3QlUZSfQ8zDSSwOOtPa8/Fqf9JGv0B7uimd8HVMTbUyaTkVvq2Z5RPsbav1m/H8L0 fJDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=+MrqPwjGprB21xOrKUeLYED8somKhoDI07GyEYlbbo4=; b=E6Ol4GnJincG0wZQoMBjWKdO/ifTo8XWImorreSQoPwzbynFmdSX5qWrSZKgqQJio7 ZXKDYOHwJC46v4eAu66wRE5LNvnnn/Gx1GFb8ccDjVYW+/TyV8vgUftPfeBdIrf2HW2u QRyH/qls7V0gfmuSAkSxWw0uJvnxS5HMnlL4572JSoexP5KjJoHGVeVk72BVJAp11bse ovL+G0yn6cNpWqNJ0gV0WI+1XyP8iylsxE5hCnT7/vGnggUf7M3lUxpwo3GhSLAiHlK9 l2qxwvAXuQohJUmkOnckN6HqpVfUbJ4a/5NvJjgQ3c4Y5fbwoBywURhMXa5lHMnb16t8 1OdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="giK/CoBD"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j18si3430514ilc.159.2021.09.16.10.54.27; Thu, 16 Sep 2021 10:54:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="giK/CoBD"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245611AbhIPRxx (ORCPT + 99 others); Thu, 16 Sep 2021 13:53:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357124AbhIPRv0 (ORCPT ); Thu, 16 Sep 2021 13:51:26 -0400 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C623C09B11E for ; Thu, 16 Sep 2021 09:25:59 -0700 (PDT) Received: by mail-lf1-x134.google.com with SMTP id i7so20638158lfr.13 for ; Thu, 16 Sep 2021 09:25:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+MrqPwjGprB21xOrKUeLYED8somKhoDI07GyEYlbbo4=; b=giK/CoBDhVKoZODX7QaMWenK7M0Ef7/VMrMC+JpDOGq7hzKKMIt4+9kYx+W6zhvGu1 ySoWjCQyGMBQPbPsmJ+MdLSpu5kCyHc8//rajgrLTwILPMxsnm4mLr03RxEorH1wc86u czJJF+ua9fGukgNanz1FEl1kMG76Vh0A/SWxI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+MrqPwjGprB21xOrKUeLYED8somKhoDI07GyEYlbbo4=; b=YZ3zStiijryHcoBDGkkiTzQtkJMsk+SeLhOXEXT7eWDVegAg5KxSS4sTpGI3DqialL oBm6xW5BNzBt9k6oXexVOF2NjWYMpuD8QTD7woO/zmuq5XjpDUVo4RxAs34WdbhB3Hho ZokBF2cN6533x89lQhZ+UYJJeUVsYJSwgXP9Q+h4emlWXh22B8jJangj0WqDl33X3oVu Fpnu4HAp76Ua9CJ4GbtmvCsHTVTM+XGaqfW5ZIpacN5xhvxjdewKP61A/C+IhrpHyo+X nUnxReIRm7HtjVKo83ZWqZ60LdF5zGumOLCoNI+PgJnKSKjqgtcpmxr9zHxdc43DQpA6 o0KA== X-Gm-Message-State: AOAM533GG07/hVx3Z/bWlKOnLSwvW5nbMFK5xpdrrAXmINdWsikcdUVn Y15u4niE1GbFJem+iQmRMxjh12/jgNP7dBtK X-Received: by 2002:a2e:804c:: with SMTP id p12mr5649765ljg.118.1631809556233; Thu, 16 Sep 2021 09:25:56 -0700 (PDT) Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com. [209.85.167.41]) by smtp.gmail.com with ESMTPSA id d15sm329358lfn.220.2021.09.16.09.25.54 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 16 Sep 2021 09:25:55 -0700 (PDT) Received: by mail-lf1-f41.google.com with SMTP id i7so20637627lfr.13 for ; Thu, 16 Sep 2021 09:25:54 -0700 (PDT) X-Received: by 2002:a2e:8185:: with SMTP id e5mr5452535ljg.31.1631809554490; Thu, 16 Sep 2021 09:25:54 -0700 (PDT) MIME-Version: 1.0 References: <20210915035227.630204-1-linux@roeck-us.net> <5497691.DvuYhMxLoT@alarsen.net> In-Reply-To: <5497691.DvuYhMxLoT@alarsen.net> From: Linus Torvalds Date: Thu, 16 Sep 2021 09:25:38 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 0/4] Introduce and use absolute_pointer macro To: Anders Larsen Cc: Guenter Roeck , Richard Henderson , Ivan Kokshaysky , Matt Turner , "James E . J . Bottomley" , Helge Deller , "David S . Miller" , Jakub Kicinski , alpha , Geert Uytterhoeven , Linux Kernel Mailing List , linux-parisc@vger.kernel.org, Netdev , Sparse Mailing-list Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 16, 2021 at 12:02 AM Anders Larsen wrote: > > On Wednesday, 2021-09-15 23:19 Linus Torvalds wrote: > > > > But hey, maybe it just works so well for the very specialized user base ... > > it's actually the latter (although I guess the user base is shrinking) Hey, so if it's actively used, maybe you can answer a question or two that I have just because I looked at the code.. In particular, the inode number calculation is odd. Is there a reason for the "-1"? Because iboth the link case and the direct inode case have it, but t's a _different_ "-1": For the "inode_entry", it does ino = blknum * QNX4_INODES_PER_BLOCK + ix - 1; but it's worth noting that "ix" is zero-based (index within the block), so this kind of oddly removes one from a zero-based thing, and the 'ino' for the very first entry ends up being -1. Of course, it's possible that the first entry is always empty, but it does seem a bit odd. For the "link_info" case, it does ino = ( le32_to_cpu(de->link.dl_inode_blk) - 1 ) * QNX4_INODES_PER_BLOCK + de->link.dl_inode_ndx; so now it takes the _block_ index, and does that "-1" on it, and then multiplies it by the "entries per block" number, and adds the index. So now if both are zero, the inode number is -8, not -1. But all of this matches what the *lookup* code does. It's very odd, though. But to make it stranger, then in "qnx4_iget()", the calculations all makes sense. There it just does "take the inode number, and look up block and index into the block using it". Very strange and confusing. Because it means that iget() seems to look up a *different* inode entry than "lookup" and "readdir" actually look at. I must be missing something. I obviously didn't touch any of this logic, I was just doing the "make the type system clearer for the compiler". Also, I have to say, since I was looking at compiler output, the calculations in readdir() are made much worse by the fact that the dir->pos is a "loff_t". That's signed. And then you use "%" to get the index within a block. Using '%' instead of bitops is fairly equivalent, but only for (a) unsigned types (b) when the divisor is a compile-time power-of-2 In the qnx4 case, (b) is true, but (a) is not. Not a big deal. But usually, I tell people to avoid '% ENTRIES', because it really has very different behavior from '& MASK' for signed numbers. Linus