Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp101703imm; Mon, 4 Jun 2018 13:50:53 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI5PI3g4aSWrc99yQUwwRPhiQzoZOSbaIbpZhvt23Q20t4kA5uIHhuNZBHkUeGJBdF1E+JT X-Received: by 2002:a62:8b9b:: with SMTP id e27-v6mr22935619pfl.82.1528145453013; Mon, 04 Jun 2018 13:50:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528145452; cv=none; d=google.com; s=arc-20160816; b=ELYcqbMKq/t5vg/XEsKKKYnVflaQF7F2Yc7YTjte2RhNNaJYFH9leqXSi0fAD7M9Fs 98xuK7RKs0/AQWvAWHzqnw1sNPhaRg4tNqgL5LtXlBW7yjVUe/m5hmB1iP6TOFdc8zMd +yfjWJXoMaVkMG+JX49eNA1XHQmYHC6Tgbw/9gDzuiFteMcuHZlMq1zdWF9c+mTnWw1H AT3LwFboa63TXIt0vhsNbgKDFt7hcwbVvD6ziiWW4XLnZyfaYS6Z+ng8O22YROQuQBL5 9xTfmT4wYgyJUTgQJr5Uqo4qQXk6dQ3YcrwxKw+XEIwvAxWYDYWM8zttc6JzgiZo6czg DCkg== 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=tKQtQOwwahJmaxtZrUuOw30/6coT2suIsCS2K77e7IY=; b=OpwJleZgaszrDKy603GV24f0nkeM40pfPZhVFoOv82wozofMUtPGWl3Zzz8tA18n74 n0CByF4/OjcxX1u1h8Ctg+E2p2SV3/KhNOs7Uqe0NQO/MTJ45cF/BoUW3+c4DjGlvxQ/ 9UtHXORyjiWKfe0UUATXUCFZNdHMOD9nygwqysqOk5oq4mLH9Mg7Q3PGDW3NJ9nk1Wip ZfZAoJQE34mtayFzVj+x2nm7N6hyiFOYWiREGz2SD7FraevT28biCi4Q6RQVfLbB6Bic DOLutA2GqZPB/nZjizt2px7SSl6Z4t5vrtd7arkpqh9rd1VffAHNAEPxPzgWVgijuK43 +o9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=GN0xTQNp; 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 u9-v6si7183770pls.462.2018.06.04.13.50.05; Mon, 04 Jun 2018 13:50:52 -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=GN0xTQNp; 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 S1751387AbeFDUp6 (ORCPT + 99 others); Mon, 4 Jun 2018 16:45:58 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:43038 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750997AbeFDUpx (ORCPT ); Mon, 4 Jun 2018 16:45:53 -0400 Received: by mail-lf0-f68.google.com with SMTP id n15-v6so37090lfn.10; Mon, 04 Jun 2018 13:45:52 -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=tKQtQOwwahJmaxtZrUuOw30/6coT2suIsCS2K77e7IY=; b=GN0xTQNpbhV0OWkYnlnyiivRzl+N4QzSO5tJVxK4pBZe5TOKRu0yCz89cen8fzc8i1 s7K8xlgInjYY6chq+iv1X9/tyGNEB0thlkZpbTBE20t0D13cGpabx2SlNDKrpRvQBYNl 8i1FR7t7vlONVEo36UsETAkHrLHsgzqteUaXum+YT6NrfhgMPNoBnWVCIPK/HWhDwwJ/ TUMdphuKEYGq+lmEgd0oW5+1VwqWffqznahveKBDdbK97XO/Vqo5hmx/82ONGY1yqeXb 1H7DAeb2bcOiIfua34njtmfgGT/xFM4xE3bxXhOgCCkU5tNXkNWS5W6WPSDk3Ip1Dxrc T8Bw== 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=tKQtQOwwahJmaxtZrUuOw30/6coT2suIsCS2K77e7IY=; b=alIDJyBKsr0pYzr4+bwmDLvXbN3cK1nkRGDaGDiGCWIZ0BOPK8ZtABZUVD+uZA8IK1 JXsKLW8WooFxArUzjaCuvPVLbJw+CcevptQEvDg5aVTF6DdUXkcThRYlzpTEPLuJr04a dN8uLhZmsjwZ6Nf4heI1vOlMWlmwSaMMX64vmpvGB3cZn8YzV3wG63Pn9FyveTKMIdyC io0UYA9b8c/U+/ottrXuT1jUqAj9YfwpRFmYjYdz8qYswQWnbKoGIl7OSZAOJeRdkkuJ TPYz3xUVrIlLQZSN5BdFg+FX0e/chQ/bxuU66cMi6r79Ux/4yNK0WifuNa6koDhIPNkf BzbA== X-Gm-Message-State: APt69E0whnj1/5q049RLCLWpFN4XO6EGwkMzd6T3SwfrI2Qydldi2W+y 48XBECdin6Lu1erWT3N+aEWxoR2sNFq2yitq5nY= X-Received: by 2002:a2e:5453:: with SMTP id y19-v6mr2509079ljd.11.1528145151332; Mon, 04 Jun 2018 13:45:51 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a2e:56c8:0:0:0:0:0 with HTTP; Mon, 4 Jun 2018 13:45:50 -0700 (PDT) In-Reply-To: <472.1528139035@warthog.procyon.org.uk> References: <152720672288.9073.9868393448836301272.stgit@warthog.procyon.org.uk> <152720693123.9073.4511934790831409009.stgit@warthog.procyon.org.uk> <21648.1528124488@warthog.procyon.org.uk> <472.1528139035@warthog.procyon.org.uk> From: Arnd Bergmann Date: Mon, 4 Jun 2018 22:45:50 +0200 X-Google-Sender-Auth: 2Q5lCd1TCqqWz2QSYtcAwBZth0g 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 Mon, Jun 4, 2018 at 9:03 PM, David Howells wrote: > Arnd Bergmann wrote: > The fsinfo() syscall truncates the reply buffer to the size the user requested > if the user requested a smaller amount. Take the fsinfo_supports struct for > example: > > struct fsinfo_supports { > __u64 supported_stx_attributes; > __u32 supported_stx_mask; > __u32 supported_ioc_flags; > }; > > Now imagine that in future we want to add another field, say the mask of the > windows file attributes a filesystem supports. We can extend the struct like > so: > > struct fsinfo_supports_v2 { > __u64 supported_stx_attributes; > __u32 supported_stx_mask; > __u32 supported_ioc_flags; > __u32 supported_win_file_atts; > __u32 __reserved[1]; > }; Looking at the code again, I realized my misunderstanding: I somehow expected the system call to return multiple structures at once, which would get really messy with groups of arrays of variable-sized structures. Since we only really get back a single structure per call, that is not an issue. There is also no need to be concerned about the system call overhead, right? Even if we query all data from all mounted file systems, I suppose the total number of syscall roundtrips will be small enough that there is no need for complicating the interface to make it slightly faster. > I can improve this such that if you asked for a fixed-length option and the > kernel doesn't have enough data to fill the user buffer provided, then it > clears the remainder of the buffer. That way at least any unsupported fields > will be initialised to 0. Yes, I think that would make sense here. It's not quite a read() based interface since the return value for a short read is still the size of the whole buffer that could have been accessed. By zeroing the extra data, the kernel always writes the amount of data that the user asks for, and the return value always shows how much data would have been available. It might be necessary to limit the size of the buffer though, to prevent bad things from happening when the user asks for e.g. -1ull bytes of data. >> In any case, it would be nice to have a trivial way to query which of >> the four timestamp types are supported at all, and returning >> them separately would be one way of doing that. > > fsinfo_cap_has_atime = 45, /* fs supports access time */ > fsinfo_cap_has_btime = 46, /* fs supports birth/creation time */ > fsinfo_cap_has_ctime = 47, /* fs supports change time */ > fsinfo_cap_has_mtime = 48, /* fs supports modification time */ Ok. Arnd