From patchwork Tue Jan 1 02:19:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10745677 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 30AD8746 for ; Tue, 1 Jan 2019 02:19:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 24D0928BC4 for ; Tue, 1 Jan 2019 02:19:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1951528BEB; Tue, 1 Jan 2019 02:19:36 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham 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 A9EB028BC4 for ; Tue, 1 Jan 2019 02:19:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728235AbfAACTf (ORCPT ); Mon, 31 Dec 2018 21:19:35 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:43026 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728231AbfAACTf (ORCPT ); Mon, 31 Dec 2018 21:19:35 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id x012EtPd019123 for ; Tue, 1 Jan 2019 02:19:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=XMiqA/3pLViwBI5yTnZ2WJsUiK3a+ru8lk9JwASyjbc=; b=3X6AwF4eJA/xFlmc2LAgPnlV9fmh10aJ3ApaIE3MvP8dfE/toVpQuA5SPtGclZvLHpOa B+XJwgtT0wvRDMZgLLmQFbjZMwsllRjgrIfwp1aUHowzI7zuaaUgycfiWpzs7tHpb2iV rihOxNWQea6gQ0hBYUMPyaO/u1bZfXM2NviWULz2kqQwu5SGt0dOLsCmxQgKyfgJUtFT NKDwpe8W2DU/KqAXnziYjcLuriDbFOuzvzUmwxB8dArmO0fj4vz9PeZf962XY8DDFUhw JIiUPQxK7VgZrrQCtRAiyrC0YUs3VC6c25tqCjvqKpnmE6b9+kyn7T0M8dTz6QCiU+vh 0A== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2130.oracle.com with ESMTP id 2pp0btp792-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 01 Jan 2019 02:19:33 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id x012JR6n009124 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 1 Jan 2019 02:19:27 GMT Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x012JR0Z001533 for ; Tue, 1 Jan 2019 02:19:27 GMT Received: from localhost (/10.159.150.85) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 31 Dec 2018 18:19:26 -0800 Subject: [PATCH 04/22] xfs: hoist project id get/set functions From: "Darrick J. Wong" To: darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Mon, 31 Dec 2018 18:19:26 -0800 Message-ID: <154630916606.18437.8437608724088276130.stgit@magnolia> In-Reply-To: <154630914104.18437.15354380637179830566.stgit@magnolia> References: <154630914104.18437.15354380637179830566.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9123 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901010019 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Darrick J. Wong Move the project id get and set functions into libxfs. Signed-off-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_inode_util.h | 29 +++++++++++++++++++++++++++++ fs/xfs/xfs_inode.h | 27 --------------------------- fs/xfs/xfs_linux.h | 2 -- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/fs/xfs/libxfs/xfs_inode_util.h b/fs/xfs/libxfs/xfs_inode_util.h index 45f8c4869c4b..808e4322106e 100644 --- a/fs/xfs/libxfs/xfs_inode_util.h +++ b/fs/xfs/libxfs/xfs_inode_util.h @@ -14,4 +14,33 @@ uint64_t xfs_flags2diflags2(struct xfs_inode *ip, unsigned int xflags); uint32_t xfs_dic2xflags(uint16_t di_flags, uint64_t di_flags2, bool has_attr); +/* + * Project quota id helpers (previously projid was 16bit only and using two + * 16bit values to hold new 32bit projid was chosen to retain compatibility + * with "old" filesystems). + */ +static inline prid_t +xfs_get_projid(struct xfs_icdinode *id) +{ + return (prid_t)id->di_projid_hi << 16 | id->di_projid_lo; +} + +static inline void +xfs_set_projid(struct xfs_icdinode *id, prid_t projid) +{ + id->di_projid_hi = (uint16_t) (projid >> 16); + id->di_projid_lo = (uint16_t) (projid & 0xffff); +} + +#define XFS_PROJID_DEFAULT 0 + +static inline prid_t +xfs_get_initial_prid(struct xfs_icdinode *id) +{ + if (id->di_flags & XFS_DIFLAG_PROJINHERIT) + return xfs_get_projid(id); + + return XFS_PROJID_DEFAULT; +} + #endif /* __XFS_INODE_UTIL_H__ */ diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index ca2623e0dd4f..fb55e3b74b34 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h @@ -165,33 +165,6 @@ xfs_iflags_test_and_set(xfs_inode_t *ip, unsigned short flags) return ret; } -/* - * Project quota id helpers (previously projid was 16bit only - * and using two 16bit values to hold new 32bit projid was chosen - * to retain compatibility with "old" filesystems). - */ -static inline prid_t -xfs_get_projid(struct xfs_icdinode *id) -{ - return (prid_t)id->di_projid_hi << 16 | id->di_projid_lo; -} - -static inline void -xfs_set_projid(struct xfs_icdinode *id, prid_t projid) -{ - id->di_projid_hi = (uint16_t) (projid >> 16); - id->di_projid_lo = (uint16_t) (projid & 0xffff); -} - -static inline prid_t -xfs_get_initial_prid(struct xfs_icdinode *id) -{ - if (id->di_flags & XFS_DIFLAG_PROJINHERIT) - return xfs_get_projid(id); - - return XFS_PROJID_DEFAULT; -} - static inline bool xfs_is_reflink_inode(struct xfs_inode *ip) { return ip->i_d.di_flags2 & XFS_DIFLAG2_REFLINK; diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h index edbd5a210df2..f2835a9f0a16 100644 --- a/fs/xfs/xfs_linux.h +++ b/fs/xfs/xfs_linux.h @@ -138,8 +138,6 @@ typedef __u32 xfs_nlink_t; */ #define __this_address ({ __label__ __here; __here: barrier(); &&__here; }) -#define XFS_PROJID_DEFAULT 0 - #define howmany(x, y) (((x)+((y)-1))/(y)) static inline void delay(long ticks)