From patchwork Thu Feb 12 01:40:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaegeuk Kim X-Patchwork-Id: 5815001 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 54656BF440 for ; Thu, 12 Feb 2015 01:40:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 90FFE201ED for ; Thu, 12 Feb 2015 01:40:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4D86720218 for ; Thu, 12 Feb 2015 01:40:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754663AbbBLBkU (ORCPT ); Wed, 11 Feb 2015 20:40:20 -0500 Received: from mail.kernel.org ([198.145.29.136]:46806 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754532AbbBLBkS (ORCPT ); Wed, 11 Feb 2015 20:40:18 -0500 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D7833201FA; Thu, 12 Feb 2015 01:40:16 +0000 (UTC) Received: from localhost (unknown [166.170.41.193]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E13A4201ED; Thu, 12 Feb 2015 01:40:15 +0000 (UTC) Date: Wed, 11 Feb 2015 17:40:14 -0800 From: Jaegeuk Kim To: Dave Chinner , Jeff Layton , "J. Bruce Fields" Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, xfs@oss.sgi.com Subject: Re: [PATCH 1/2 v2] xfs: introduce a generic shutdown ioctl Message-ID: <20150212014014.GA97308@jaegeuk-mac02> References: <1420796076-82847-1-git-send-email-jaegeuk@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1420796076-82847-1-git-send-email-jaegeuk@kernel.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 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 Change log from v1: o modify the xfs changes merged toward 3.20-rc1 -- >8 -- This patch introduces a generic ioctl for fs shutdown, which was used by xfs. If this shutdown is triggered, filesystem stops any further IOs according to the following options. 1. FS_GOING_DOWN_FULLSYNC : this will flush all the data and dentry blocks, and do checkpoint before shutdown. 2. FS_GOING_DOWN_METASYNC : this will do checkpoint before shutdown. 3. FS_GOING_DOWN_NOSYNC : this will trigger shutdown as is. Signed-off-by: Jaegeuk Kim --- fs/xfs/libxfs/xfs_fs.h | 8 ++++---- include/uapi/linux/fs.h | 8 ++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/fs/xfs/libxfs/xfs_fs.h b/fs/xfs/libxfs/xfs_fs.h index 18dc721..fe0eeee 100644 --- a/fs/xfs/libxfs/xfs_fs.h +++ b/fs/xfs/libxfs/xfs_fs.h @@ -484,9 +484,9 @@ typedef struct xfs_swapext /* * Flags for going down operation */ -#define XFS_FSOP_GOING_FLAGS_DEFAULT 0x0 /* going down */ -#define XFS_FSOP_GOING_FLAGS_LOGFLUSH 0x1 /* flush log but not data */ -#define XFS_FSOP_GOING_FLAGS_NOLOGFLUSH 0x2 /* don't flush log nor data */ +#define XFS_FSOP_GOING_FLAGS_DEFAULT FS_GOING_DOWN_FULLSYNC +#define XFS_FSOP_GOING_FLAGS_LOGFLUSH FS_GOING_DOWN_METASYNC +#define XFS_FSOP_GOING_FLAGS_NOLOGFLUSH FS_GOING_DOWN_NOSYNC /* * ioctl commands that are used by Linux filesystems @@ -555,7 +555,7 @@ typedef struct xfs_swapext #define XFS_IOC_ATTRLIST_BY_HANDLE _IOW ('X', 122, struct xfs_fsop_attrlist_handlereq) #define XFS_IOC_ATTRMULTI_BY_HANDLE _IOW ('X', 123, struct xfs_fsop_attrmulti_handlereq) #define XFS_IOC_FSGEOMETRY _IOR ('X', 124, struct xfs_fsop_geom) -#define XFS_IOC_GOINGDOWN _IOR ('X', 125, __uint32_t) +#define XFS_IOC_GOINGDOWN FS_IOC_SHUTDOWN /* XFS_IOC_GETFSUUID ---------- deprecated 140 */ diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h index 3735fa0..a4e4be5 100644 --- a/include/uapi/linux/fs.h +++ b/include/uapi/linux/fs.h @@ -157,6 +157,7 @@ struct inodes_stat_t { #define FIFREEZE _IOWR('X', 119, int) /* Freeze */ #define FITHAW _IOWR('X', 120, int) /* Thaw */ #define FITRIM _IOWR('X', 121, struct fstrim_range) /* Trim */ +#define FS_IOC_SHUTDOWN _IOR('X', 125, __u32) /* Shutdown */ #define FS_IOC_GETFLAGS _IOR('f', 1, long) #define FS_IOC_SETFLAGS _IOW('f', 2, long) @@ -205,4 +206,11 @@ struct inodes_stat_t { #define SYNC_FILE_RANGE_WRITE 2 #define SYNC_FILE_RANGE_WAIT_AFTER 4 +/* + * Flags for going down operation used by FS_IOC_GOINGDOWN + */ +#define FS_GOING_DOWN_FULLSYNC 0x0 /* going down with full sync */ +#define FS_GOING_DOWN_METASYNC 0x1 /* going down with metadata */ +#define FS_GOING_DOWN_NOSYNC 0x2 /* going down */ + #endif /* _UAPI_LINUX_FS_H */