Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3585449imm; Mon, 4 Jun 2018 06:11:02 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIrcjJ5+dMJ765622H03edIoOgn8YcSIYVUI04ubd40Mpd3ida8YTGwibaWl1TxvRhlKqdW X-Received: by 2002:a63:3dcc:: with SMTP id k195-v6mr17183100pga.254.1528117862598; Mon, 04 Jun 2018 06:11:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528117862; cv=none; d=google.com; s=arc-20160816; b=Wz8w81hP9lYkH43wB6weudi8mPZivBRF7Yvx3lBwDOQ12aF2yu3aWgVqvvrMjUkUNh 1PdnaKUymlp+XcEmzSjpo+O6EjEEYtvLQm5qvUGs2ol4ZOhrQ1frwheCoYcC2IssYaJT OjXn4yyh5sDkOQD+THZTkjON6UdZybH/Qq5mUS5j1maCEuNB/v6CMQu1znzV6arZ/g/+ Jrw+2z18AZ4LbzXZiCd8kMhpDcC3kuZrVfscKg91ypFyvBcJUG2SLZuoAk3rWy1M7KxH PQDbHybRsj0YTkC7XD3EuOFsfeo4GANpJdY065UwO4SpAz2FFAPVXhOS6+mENkOLz2g1 7BnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=xZM9+b9MI08/5T5IBl9NVOVywNzFY4464Lh20QNdW4Q=; b=MWyLXPxI8bn0MN7jrxaYqRXVipe/mnpR+h84GqeQJeVILASIoKmai5NW9zqgi0GmMr hTDi9nxeLcSTkbLEybtELFd3W37SxyX4C0Fn+DPE5RvN82oC/3v0KIr2EPANN8A8K4rX kSiKbgEUq3VPp2r0IWJe8CZSbHKsT2uOcKw3TU5QjUkECSNtEJEySv/djpmyoDXnqePl A50OB9rsKE/N9hNJbp0pjp1sFTk3lA9agGGuDH+ESFfxAHz0z94CBMY/PyBmmY0dJAic ylfgIbsFf05ttQUjcCCggSyFVb2pRZjeMVizcBNANFk814S1+7IV1HhqZDQMC3kwqond MSsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=cm8dFGM7; 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 y8-v6si17586691pgs.181.2018.06.04.06.10.47; Mon, 04 Jun 2018 06:11: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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=cm8dFGM7; 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 S1753080AbeFDNKX (ORCPT + 99 others); Mon, 4 Jun 2018 09:10:23 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:32929 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752432AbeFDNKV (ORCPT ); Mon, 4 Jun 2018 09:10:21 -0400 Received: by mail-lf0-f65.google.com with SMTP id y20-v6so25133118lfy.0; Mon, 04 Jun 2018 06:10:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=xZM9+b9MI08/5T5IBl9NVOVywNzFY4464Lh20QNdW4Q=; b=cm8dFGM7L9vD+ud/Z8WS8KJVhSHM4xwroisbXnjQIhvjEuqWar5WeBnVKf0qZIrld+ X17IF4ZP3pxzDE9qaqleI8RIDdrJxuAohtrlwu4tPvXiB+TNAjYBo0VDIZ6uxwQXLBYx 2EnmGdlouyjGXT5tWaRfR9z/FzccGsDZRVxow5c/fZWAAzaAiukGytfGD8dtB7CE2uWZ mpWGPedlnGptmHl3mPfY6Eoc/ZTT+0Mav8I908aVXd7osKjQma9aQIhv1xKaXffbJ4Ze 1OwrtQi2R4ENMYmYiMzxU0XKY8Q09Bk/teKAs6XyKcjFPwrKCPf9QfPoa3KkwSGJu7iS ZGjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=xZM9+b9MI08/5T5IBl9NVOVywNzFY4464Lh20QNdW4Q=; b=nPFRrMFZvtip/KvRSFDQRV7+PhhrLljINF2Kw+wY+af77YXUSp0zcZrrReI63rOLux Z9TrMXd9IhO/2iz84daltLlOfg0H4MqX6NqllBSO4T/QPI72DqyK5uSip5fRw0LSzklz deqnCKW7hzs84OALSMKOiQ9Qq4CYj5rK4r8ramVBcmXYHwugqTWD8T68NN4fz7208CKG 93O5Q5XKBr6LGfRxViDyC1yLG7sNhS/N6EplLEAMVHBKr93arJ+4fdgsmEwr7lsjyIGQ UvRUf/O+zu0aY72fkui4xWUxyyMwa54dgPFtuMnNbFM6Ec0Ug56GlVnHH+p7M2Rhljj3 MLfQ== X-Gm-Message-State: ALKqPwe4YHbo9XocMN+uq0ODR1lEKxZ2gsmLQMyVrYSUK2//5+l0Mrql 4Lrf25ErtebbfiRET89QKN2RnmrqFxXeeTrmu+M= X-Received: by 2002:a2e:9ac4:: with SMTP id p4-v6mr11385763ljj.60.1528117819781; Mon, 04 Jun 2018 06:10:19 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a2e:56c8:0:0:0:0:0 with HTTP; Mon, 4 Jun 2018 06:10:18 -0700 (PDT) In-Reply-To: <152720693123.9073.4511934790831409009.stgit@warthog.procyon.org.uk> References: <152720672288.9073.9868393448836301272.stgit@warthog.procyon.org.uk> <152720693123.9073.4511934790831409009.stgit@warthog.procyon.org.uk> From: Arnd Bergmann Date: Mon, 4 Jun 2018 15:10:18 +0200 X-Google-Sender-Auth: qWKm6LOe9g4WRieWum_xrD6EMo0 Message-ID: Subject: Re: [PATCH 32/32] [RFC] fsinfo: Add a system call to allow querying of filesystem information [ver #8] To: David Howells Cc: Al Viro , Linux FS-devel Mailing List , linux-afs@lists.infradead.org, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 25, 2018 at 2:08 AM, David Howells wrote: > + > +static int fsinfo_generic_timestamp_info(struct dentry *dentry, > + struct fsinfo_timestamp_info *ts) > +{ > + struct super_block *sb = dentry->d_sb; > + > + /* If unset, assume 1s granularity */ > + u16 mantissa = 1; > + s8 exponent = 0; > + > + ts->minimum_timestamp = S64_MIN; > + ts->maximum_timestamp = S64_MAX; > + if (sb->s_time_gran < 1000000000) { > + if (sb->s_time_gran < 1000) > + exponent = -9; > + else if (sb->s_time_gran < 1000000) > + exponent = -6; > + else > + exponent = -3; > + } ntfs has sb->s_time_gran=100, and vfat should really have sb->s_time_gran=2000000000 but that doesn't seem to be set right at the moment. > +/* > + * Optional fsinfo() parameter structure. > + * > + * If this is not given, it is assumed that fsinfo_attr_statfs instance 0 is > + * desired. > + */ > +struct fsinfo_params { > + enum fsinfo_attribute request; /* What is being asking for */ > + __u32 Nth; /* Instance of it (some may have multiple) */ > + __u32 at_flags; /* AT_SYMLINK_NOFOLLOW and similar flags */ > + __u32 __spare[6]; /* Spare params; all must be 0 */ > +}; I fear the 'enum' in the uapi structure may have a different size depending on the architecture. Maybe turn that into a __u32 as well? > +struct fsinfo_capabilities { > + __u64 supported_stx_attributes; /* What statx::stx_attributes are supported */ > + __u32 supported_stx_mask; /* What statx::stx_mask bits are supported */ > + __u32 supported_ioc_flags; /* What FS_IOC_* flags are supported */ > + __u8 capabilities[(fsinfo_cap__nr + 7) / 8]; > +}; This looks a bit odd: with the 44 capabilities, you end up having a six-byte array followed by two bytes of implicit padding. If the number of capabilities grows beyond 64, you have a nine byte array with more padding to the next alignof(__u64). Is that intentional? How about making it a fixed size with either 64 or 128 capability bits? > +/* > + * Information struct for fsinfo(fsinfo_attr_timestamp_info). > + */ > +struct fsinfo_timestamp_info { > + __s64 minimum_timestamp; /* Minimum timestamp value in seconds */ > + __s64 maximum_timestamp; /* Maximum timestamp value in seconds */ > + __u16 atime_gran_mantissa; /* Granularity(secs) = mant * 10^exp */ > + __u16 btime_gran_mantissa; > + __u16 ctime_gran_mantissa; > + __u16 mtime_gran_mantissa; > + __s8 atime_gran_exponent; > + __s8 btime_gran_exponent; > + __s8 ctime_gran_exponent; > + __s8 mtime_gran_exponent; > +}; This structure has a slightly inconsistent amount of padding at the end: on x86-32 it has no padding, everywhere else it has 32 bits of padding to make it 64-bit aligned. Maybe add a __u32 reserved field? > + > +#define __NR_fsinfo 326 Hardcoding the syscall number in the example makes it architecture specific. Could you include to get the real number? Arnd