Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3078799pxu; Mon, 19 Oct 2020 03:27:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6FE7Rl5RBrB2AoPmWEzVnbBQHOvZJJbOHO7CmEg7lj2vPYbUwgec6VHEaXIWnZSnF88T2 X-Received: by 2002:a05:6402:289:: with SMTP id l9mr17469197edv.294.1603103236735; Mon, 19 Oct 2020 03:27:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603103236; cv=none; d=google.com; s=arc-20160816; b=p3UlAWgJCo91Lk8a9AxSGstBPNE9lWbiqaRzxn0cf1tFnvbpS7c8V+j0+MHx8ex1eY xrkLW+4XioolJoQz7SeiFiA1bizvtjVjLCmkP4M6Yo5ezsMdu/Pcw9JZF81Vs67Ql2mX Yh95lNALYpSnzNFllclKnwta9AbJzTsMItsZGXbOLJ2vPmzCO4Z9X/SAlQiYh4zKcoTc 0UBBZt+eNznDEty24tTJ26OU80DpsxSWAKlTiT4uPUPTUN0PH4DmsKKMI6j2t2AsYkbv Abqk5zN8EK8cm8XqpYCbuWdalh0i7Js+FLQiMgrB7AMZL5DQxqTE5yG/+rng6hUg5bbE DyEw== 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:message-id:subject:cc:to:from:date; bh=N+1SmfO+VgPAl2aEBg8Jgzuy6jftPYVOOU+IxcXuOic=; b=yHT0P7F4CTKabv3wukyrAKm1sY6tYuV4WrJbm81kb1WZxawEq75RYLi9zWMm/t66sh Syefh5VCbCb2awNWymFoMiaCYj5PC9F7oqMWkYpg2E+0U+DJSsaldguBtvxvxwnSM9vn NqQuKVxOQWeufWCAx0Sm5V0KXev0P/yg6cm81TwSFgi7ei7LOGn1AvfRXfgDuqIjcX5l XjIu6A1gqT0mA5K8cuJkkIGKhdEGDkWL5NwwODpCWn43xlOUkRSYhWlosnRSpfX9v452 4tOYGb+Et5Wm/e+SegSaWwsERCSpN/4X1yGFI6fiv5ouXZvdATpcjUOY3cbT5ZbgiTZo sB2A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-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 v24si7524793eds.499.2020.10.19.03.26.51; Mon, 19 Oct 2020 03:27:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728801AbgJSITa (ORCPT + 99 others); Mon, 19 Oct 2020 04:19:30 -0400 Received: from mx2.suse.de ([195.135.220.15]:32950 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728781AbgJSITa (ORCPT ); Mon, 19 Oct 2020 04:19:30 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 3C564ACF1; Mon, 19 Oct 2020 08:19:28 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id A21D11E1340; Mon, 19 Oct 2020 10:19:27 +0200 (CEST) Date: Mon, 19 Oct 2020 10:19:27 +0200 From: Jan Kara To: Roman Anufriev Cc: Jan Kara , linux-ext4@vger.kernel.org, tytso@mit.edu, dmtrmonakhov@yandex-team.ru Subject: Re: [PATCH 2/2] ext4: export quota journalling mode via sysfs attr quota_mode Message-ID: <20201019081927.GA30825@quack2.suse.cz> References: <1602761572-4713-1-git-send-email-dotdot@yandex-team.ru> <1602761572-4713-2-git-send-email-dotdot@yandex-team.ru> <20201015131522.GF7037@quack2.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Sat 17-10-20 21:26:37, Roman Anufriev wrote: > Hi, sorry for the delay. > > On Thu, 15 Oct 2020, Jan Kara wrote: > > > On Thu 15-10-20 14:32:52, Roman Anufriev wrote: > > > Right now, it is hard to understand what quota journalling type is enabled: > > > you need to be quite familiar with kernel code and trace it or really > > > understand what different combinations of fs flags/mount options lead to. > > > > > > This patch exports via sysfs attr /sys/fs/ext4//quota_mode current > > > quota jounalling mode, making it easier to check at a glance/in autotests. > > > The semantics is similar to ext4 data journalling modes: > > > > > > * journalled - quota accounting and journaling are enabled > > > * writeback - quota accounting is enabled, but journalling is disabled > > > * none - quota accounting is disabled > > > * disabled - kernel compiled without CONFIG_QUOTA feature > > > > > > Signed-off-by: Roman Anufriev > > > Reviewed-by: Dmitry Monakhov > > > > Hum, I'm not sure about this. The state of quota can be found out with > > "quotaon -p " (or corresponding quotactl if you need this from > > C). The only thing you won't learn is journalled / writeback mode and > > generally you should not care about this although I agree that for fs > > crash testing purposes you may care. But is that big enough usecase for a > > new sysfs file when all the information is already available for userspace > > just not in a convenient form? > > Rationale behind this patch was mainly the addition of an easy way to check > whether quota journalled or not as this is quite wanted feature in out > production environment. TBH, I was not sure about sysfs file too, but it > seemed to me like the most natural place to put it. Maybe if sysfs is an > overkill - just add printing to dmesg on mount? At least, you'll be able to > check what quota type you can enable right after mounting. > > > BTW, I've now realized ext4_any_quota_enabled() has actually misleading > > name in the sysfs file reports wrong information. It is rather > > ext4_any_quota_may_be_enabled() since presence of QUOTA mount option only > > says that quotaon(8) will enable quotas if it is run, not that quota > > accounting is enabled. sb_any_quota_loaded() tells you if accounting is > > actually enabled or not (however this can change anytime so that's why we > > use more relaxed checks for the purpose of journal credit estimates). > > My bad! Totally forgot about the case when 'quota' mount option is present > but quota accounting is not enabled, as our helper-tool around 'quotactl()' > do remounting+enabling in one go. > > I'll rename the function to smth like 'ext4_quota_capable()' in v2. And if > printing to dmesg is OK, I'll probably still use this function to print on > mount what the quota type will be after accounting is enabled. Yeah, if a message in dmesg is fine for your purposes, I'd rather go with that than with a sysfs file. Honza -- Jan Kara SUSE Labs, CR