From patchwork Wed May 31 08:15:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tahsin Erdogan X-Patchwork-Id: 9756207 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F40BB602CC for ; Wed, 31 May 2017 08:23:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1DAF265B9 for ; Wed, 31 May 2017 08:23:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D4BA92849F; Wed, 31 May 2017 08:23:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B08F265B9 for ; Wed, 31 May 2017 08:23:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751625AbdEaIXE (ORCPT ); Wed, 31 May 2017 04:23:04 -0400 Received: from mail-pf0-f182.google.com ([209.85.192.182]:33867 "EHLO mail-pf0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751448AbdEaIR0 (ORCPT ); Wed, 31 May 2017 04:17:26 -0400 Received: by mail-pf0-f182.google.com with SMTP id 9so7063966pfj.1 for ; Wed, 31 May 2017 01:17:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=77VbQg6V8omMqRo6iJG15oSi168k9zdViRdhg64E/+0=; b=ZBhEoq1e5Bo1T/JmRUT3oYNk+c0APdXOROxANuaVYluquZLQflcXS+t8yQX7yyQdIa qN+aKNBG4DJXQj6IfnUP7brcZYvVj6BaqSoqLaxAdDMhr0Gvc+angpO6HTMbY05qnEve T0pHSdvdxthTaU/2nidFxGIKsc7ztE6Me2tR7knweHlqPgNQDDXwPDPWbLtM8aGgjq/M YvLtQbTUvTrmpdP0Cc/ypIIJXEMZMdb3rHjA5F13IZ/CzCYsoN/owSKyiHbQuLHAU3Z6 IAdUPDYUnqkpTjxnM/AgBW792BLmZ4r2yDZ+68xPEwFhnA0B3K74BSHeHACreEloGFPh LHQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=77VbQg6V8omMqRo6iJG15oSi168k9zdViRdhg64E/+0=; b=mHn/lttE+MDIaxVF130AsDYNtKQWGloykXnbk7tvob9s2MSrrNmjSCUqwIDU3kKLhp rRsDQSXzkTH39QQOG329bNxkVj0aGHQD0ReSK42a7TdUti/J8+wgJmjpkIv5olVlM2/w xx0m2N7WlVoRAp931MUc4teRNa8mfWfASl0ub2Xv2JDbuR0fp2tEol1x53Z7tjro239S h3p3DUl0/mwz/UQXAOxw1X5zUEfbSfpmr3idD5koCXyf82vGbijT/EZ9ZjPvVHtN/p0r hJTpQOY9MA70Rze0C1j9P8In/V1bbOZ+DqWc4yhocffIM2hWZW/4oXQjPIcdlZSAt3TQ 6HMA== X-Gm-Message-State: AODbwcA9PNe0rHKIo6vdbO4j0xeqs625QxAkvgRj82O8bpdw6tBT6rmA Xecuu9LwJgJQ3HMT X-Received: by 10.98.223.28 with SMTP id u28mr27801634pfg.97.1496218645836; Wed, 31 May 2017 01:17:25 -0700 (PDT) Received: from tahsin1.svl.corp.google.com ([100.123.230.167]) by smtp.gmail.com with ESMTPSA id g75sm25469724pfd.83.2017.05.31.01.17.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 31 May 2017 01:17:25 -0700 (PDT) From: Tahsin Erdogan To: Jan Kara , Theodore Ts'o , Andreas Dilger , Dave Kleikamp , Alexander Viro , Mark Fasheh , Joel Becker , Jens Axboe , Deepa Dinamani , Mike Christie , Fabian Frederick , linux-ext4@vger.kernel.org Cc: linux-kernel@vger.kernel.org, jfs-discussion@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, ocfs2-devel@oss.oracle.com, reiserfs-devel@vger.kernel.org, Tahsin Erdogan Subject: [PATCH 25/28] ext4: add ext4_is_quota_file() Date: Wed, 31 May 2017 01:15:14 -0700 Message-Id: <20170531081517.11438-25-tahsin@google.com> X-Mailer: git-send-email 2.13.0.219.gdb65acc882-goog In-Reply-To: <20170531081517.11438-1-tahsin@google.com> References: <20170531081517.11438-1-tahsin@google.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP IS_NOQUOTA() indicates whether quota is disabled for an inode. Ext4 also uses it to check whether an inode is for a quota file. The distinction currently doesn't matter because quota is disabled only for the quota files. When we start disabling quota for other inodes in the future, we will want to make the distinction clear. Replace IS_NOQUOTA() call with ext4_is_quota_file() at places where we are checking for quota files. Signed-off-by: Tahsin Erdogan --- fs/ext4/ext4.h | 2 ++ fs/ext4/inode.c | 2 +- fs/ext4/ioctl.c | 4 ++-- fs/ext4/mballoc.c | 2 +- fs/ext4/move_extent.c | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 580fdb753f29..d79d8d7bee88 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -2099,6 +2099,8 @@ static inline struct ext4_inode *ext4_raw_inode(struct ext4_iloc *iloc) return (struct ext4_inode *) (iloc->bh->b_data + iloc->offset); } +#define ext4_is_quota_file(inode) IS_NOQUOTA(inode) + /* * This structure is stuffed into the struct file's private_data field * for directories. It is where we put information so that we can do diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 8ee20b586567..cf91532765a4 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -739,7 +739,7 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode, if (map->m_flags & EXT4_MAP_NEW && !(map->m_flags & EXT4_MAP_UNWRITTEN) && !(flags & EXT4_GET_BLOCKS_ZERO) && - !IS_NOQUOTA(inode) && + !ext4_is_quota_file(inode) && ext4_should_order_data(inode)) { if (flags & EXT4_GET_BLOCKS_IO_SUBMIT) ret = ext4_jbd2_inode_add_wait(handle, inode); diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index 0c21e22acd74..dde8deb11e59 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c @@ -218,7 +218,7 @@ static int ext4_ioctl_setflags(struct inode *inode, unsigned int jflag; /* Is it quota file? Do not allow user to mess with it */ - if (IS_NOQUOTA(inode)) + if (ext4_is_quota_file(inode)) goto flags_out; oldflags = ei->i_flags; @@ -342,7 +342,7 @@ static int ext4_ioctl_setproject(struct file *filp, __u32 projid) err = -EPERM; inode_lock(inode); /* Is it quota file? Do not allow user to mess with it */ - if (IS_NOQUOTA(inode)) + if (ext4_is_quota_file(inode)) goto out_unlock; err = ext4_get_inode_loc(inode, &iloc); diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index b7928cddd539..d109a2a2fea0 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -4464,7 +4464,7 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle, trace_ext4_request_blocks(ar); /* Allow to use superuser reservation for quota file */ - if (IS_NOQUOTA(ar->inode)) + if (ext4_is_quota_file(ar->inode)) ar->flags |= EXT4_MB_USE_ROOT_BLOCKS; if ((ar->flags & EXT4_MB_DELALLOC_RESERVED) == 0) { diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c index c992ef2c2f94..9bb36909ec92 100644 --- a/fs/ext4/move_extent.c +++ b/fs/ext4/move_extent.c @@ -484,7 +484,7 @@ mext_check_arguments(struct inode *orig_inode, return -EBUSY; } - if (IS_NOQUOTA(orig_inode) || IS_NOQUOTA(donor_inode)) { + if (ext4_is_quota_file(orig_inode) && ext4_is_quota_file(donor_inode)) { ext4_debug("ext4 move extent: The argument files should " "not be quota files [ino:orig %lu, donor %lu]\n", orig_inode->i_ino, donor_inode->i_ino);