From patchwork Fri Jun 12 21:57:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejun Heo X-Patchwork-Id: 6601071 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E65ABC0020 for ; Fri, 12 Jun 2015 21:59:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0C4DD20661 for ; Fri, 12 Jun 2015 21:59:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1429A205ED for ; Fri, 12 Jun 2015 21:59:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754796AbbFLV6u (ORCPT ); Fri, 12 Jun 2015 17:58:50 -0400 Received: from mail-oi0-f45.google.com ([209.85.218.45]:33639 "EHLO mail-oi0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753289AbbFLV6K (ORCPT ); Fri, 12 Jun 2015 17:58:10 -0400 Received: by oiha141 with SMTP id a141so29178387oih.0; Fri, 12 Jun 2015 14:58:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=MXch6yfih4cKPwb+0bZMe/l4Gqp3Tgo8jszct5X8yrw=; b=l5ablfzBz+6EcHAcE1LAM7Bgds4Mti6bmOCKIwtaGKhFtZ9IJ5Uj+oQ4O93eqqzueB f2obVezNRcgiCnuB7gLcXIDLSCfkOQRfYyeC8wKvpaL0SEgzZ1k2Mspxe5QhikElR2Cp OFtTzBUf2MTgbOVKW5fCzvShH+YUeGblUMmnH4ZxmZBSjpVnpvLtfkFo25Qi513p0tX9 KurQAmUnZlYyrSGO4qC4O2mzBHEL3lZaNKgu85yW762me7XHvLX52RTcvYliwobYTb1+ /Aj3EXEwd/7+aqHFJEJuMEl7IJp88A0eqlhgjp1aZAbsXZlHFZEsj0inK+jF7boESCFE Cn0w== X-Received: by 10.202.192.7 with SMTP id q7mr13261038oif.85.1434146289835; Fri, 12 Jun 2015 14:58:09 -0700 (PDT) Received: from mtj.duckdns.org.duckdns.org (mobile-166-173-057-025.mycingular.net. [166.173.57.25]) by mx.google.com with ESMTPSA id r4sm3441106oih.15.2015.06.12.14.58.08 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Jun 2015 14:58:09 -0700 (PDT) From: Tejun Heo To: axboe@kernel.dk Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, lizefan@huawei.com, cgroups@vger.kernel.org, Tejun Heo , Alexander Viro , Jan Kara , linux-ext4@vger.kernel.org Subject: [PATCH 2/3] vfs, writeback: replace FS_CGROUP_WRITEBACK with MS_CGROUPWB Date: Fri, 12 Jun 2015 16:57:33 -0500 Message-Id: <1434146254-26220-3-git-send-email-tj@kernel.org> X-Mailer: git-send-email 2.4.2 In-Reply-To: <1434146254-26220-1-git-send-email-tj@kernel.org> References: <1434146254-26220-1-git-send-email-tj@kernel.org> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP FS_CGROUP_WRITEBACK indicates whether a file_system_type supports cgroup writeback; however, different super_blocks of the same file_system_type may or may not support cgroup writeback depending on filesystem options. This patch replaces FS_CGROUP_WRITEBACK with a kernel-internal super_block->s_flags MS_CGROUPWB. The concatenated and abbreviated name is for consistency with other MS_* flags. ext2_fill_super() is updated to assert MS_CGROUPWB. Signed-off-by: Tejun Heo Cc: Alexander Viro Cc: linux-fsdevel@vger.kernel.org Cc: Jan Kara Cc: linux-ext4@vger.kernel.org --- fs/ext2/super.c | 4 ++-- fs/namespace.c | 2 +- include/linux/backing-dev.h | 2 +- include/linux/fs.h | 1 - include/uapi/linux/fs.h | 1 + 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 549219d..472ed34 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c @@ -879,7 +879,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) if (!parse_options((char *) data, sb)) goto failed_mount; - sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | + sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | MS_CGROUPWB | ((EXT2_SB(sb)->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0); @@ -1543,7 +1543,7 @@ static struct file_system_type ext2_fs_type = { .name = "ext2", .mount = ext2_mount, .kill_sb = kill_block_super, - .fs_flags = FS_REQUIRES_DEV | FS_CGROUP_WRITEBACK, + .fs_flags = FS_REQUIRES_DEV, }; MODULE_ALIAS_FS("ext2"); diff --git a/fs/namespace.c b/fs/namespace.c index 1f4f9da..507b90b 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -2669,7 +2669,7 @@ long do_mount(const char *dev_name, const char __user *dir_name, flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE | MS_BORN | MS_NOATIME | MS_NODIRATIME | MS_RELATIME| MS_KERNMOUNT | - MS_STRICTATIME); + MS_STRICTATIME | MS_CGROUPWB); if (flags & MS_REMOUNT) retval = do_remount(&path, flags & ~MS_REMOUNT, mnt_flags, diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index dfce808..1489131 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h @@ -260,7 +260,7 @@ static inline bool inode_cgwb_enabled(struct inode *inode) return bdi_cap_account_dirty(bdi) && (bdi->capabilities & BDI_CAP_CGROUP_WRITEBACK) && - (inode->i_sb->s_type->fs_flags & FS_CGROUP_WRITEBACK); + (inode->i_sb->s_flags & MS_CGROUPWB); } /** diff --git a/include/linux/fs.h b/include/linux/fs.h index b5e1dcf..66e35dc 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1912,7 +1912,6 @@ struct file_system_type { #define FS_HAS_SUBTYPE 4 #define FS_USERNS_MOUNT 8 /* Can be mounted by userns root */ #define FS_USERNS_DEV_MOUNT 16 /* A userns mount does not imply MNT_NODEV */ -#define FS_CGROUP_WRITEBACK 32 /* Supports cgroup-aware writeback */ #define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() during rename() internally. */ struct dentry *(*mount) (struct file_system_type *, int, const char *, void *); diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h index 9b964a5..60316e7 100644 --- a/include/uapi/linux/fs.h +++ b/include/uapi/linux/fs.h @@ -93,6 +93,7 @@ struct inodes_stat_t { #define MS_LAZYTIME (1<<25) /* Update the on-disk [acm]times lazily */ /* These sb flags are internal to the kernel */ +#define MS_CGROUPWB (1<<27) /* cgroup-aware writeback enabled */ #define MS_NOSEC (1<<28) #define MS_BORN (1<<29) #define MS_ACTIVE (1<<30)