From patchwork Wed Nov 10 01:58:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 12611273 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 131E5C433EF for ; Wed, 10 Nov 2021 01:58:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E7B7461181 for ; Wed, 10 Nov 2021 01:58:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229647AbhKJCBY (ORCPT ); Tue, 9 Nov 2021 21:01:24 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:52538 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229445AbhKJCBY (ORCPT ); Tue, 9 Nov 2021 21:01:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636509517; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iVu/6miw6cZ+EK4STE8/3twDZU+GI6Ly37ampa/WIFs=; b=XA8egWcw/dYGjcUBVsiJXYg4iZF3mnilro09mbcgfK45ZSVC/pN8Dpwl22yUgSN56wSctA VK+SnIh16iPriIqVfzS8p9T1mowObKRweZSDkbN08pKJAbsyKHCWK4xcpDPtMPaNRZ6bEI iU1IdaEwNAMgilaL6DtGh+OqTzcrn8w= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-485-qQXwL_tiNJCzdAvb8CgYbQ-1; Tue, 09 Nov 2021 20:58:36 -0500 X-MC-Unique: qQXwL_tiNJCzdAvb8CgYbQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5D6A51808308 for ; Wed, 10 Nov 2021 01:58:35 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.phx2.redhat.com [10.5.9.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 352745C1C5 for ; Wed, 10 Nov 2021 01:58:35 +0000 (UTC) Message-ID: <7e8a7998-5915-a9a4-e3db-50932781aee3@redhat.com> Date: Tue, 9 Nov 2021 19:58:34 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 Content-Language: en-US From: Eric Sandeen To: xfs References: Reply-To: sandeen@redhat.com Subject: [PATCH 1/3] libxfs: #ifdef out perag code for userspace In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org The xfs_perag structure and initialization is unused in userspace, so #ifdef it out with __KERNEL__ to facilitate the xfsprogs sync and build. Signed-off-by: Eric Sandeen Reviewed-by: Darrick J. Wong diff --git a/fs/xfs/libxfs/xfs_ag.c b/fs/xfs/libxfs/xfs_ag.c index 005abfd9fd34..ecfb213d8fa3 100644 --- a/fs/xfs/libxfs/xfs_ag.c +++ b/fs/xfs/libxfs/xfs_ag.c @@ -248,6 +248,7 @@ xfs_initialize_perag( spin_unlock(&mp->m_perag_lock); radix_tree_preload_end(); +#ifdef __KERNEL__ /* Place kernel structure only init below this point. */ spin_lock_init(&pag->pag_ici_lock); spin_lock_init(&pag->pagb_lock); @@ -257,6 +258,7 @@ xfs_initialize_perag( init_waitqueue_head(&pag->pagb_wait); pag->pagb_count = 0; pag->pagb_tree = RB_ROOT; +#endif /* __KERNEL_ */ error = xfs_buf_hash_init(pag); if (error) diff --git a/fs/xfs/libxfs/xfs_ag.h b/fs/xfs/libxfs/xfs_ag.h index 4c6f9045baca..01c36cfe6909 100644 --- a/fs/xfs/libxfs/xfs_ag.h +++ b/fs/xfs/libxfs/xfs_ag.h @@ -64,6 +64,10 @@ struct xfs_perag { /* Blocks reserved for the reverse mapping btree. */ struct xfs_ag_resv pag_rmapbt_resv; + /* for rcu-safe freeing */ + struct rcu_head rcu_head; + +#ifdef __KERNEL__ /* -- kernel only structures below this line -- */ /* @@ -90,9 +94,6 @@ struct xfs_perag { spinlock_t pag_buf_lock; /* lock for pag_buf_hash */ struct rhashtable pag_buf_hash; - /* for rcu-safe freeing */ - struct rcu_head rcu_head; - /* background prealloc block trimming */ struct delayed_work pag_blockgc_work; @@ -102,6 +103,7 @@ struct xfs_perag { * or have some other means to control concurrency. */ struct rhashtable pagi_unlinked_hash; +#endif /* __KERNEL__ */ }; int xfs_initialize_perag(struct xfs_mount *mp, xfs_agnumber_t agcount, From patchwork Wed Nov 10 02:00:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 12611275 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E77F6C433EF for ; Wed, 10 Nov 2021 02:00:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C64BB611CC for ; Wed, 10 Nov 2021 02:00:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229731AbhKJCDM (ORCPT ); Tue, 9 Nov 2021 21:03:12 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:21509 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229445AbhKJCDM (ORCPT ); Tue, 9 Nov 2021 21:03:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636509625; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+yVkVHkn1BqFeFVHVMdesXdiQ+nmIRIXc0KopmMnZGI=; b=SKYcBzSXOdNvZ8fOjRXfceeIJw7AQ6uBEVDtdNUCOABS7Y9XSQrW0gTetEtDeOmGY0KeuX xjwLt7RBHf8jZj/+telx6dav5PCfFCctVExGlA7a5or5a+nPZG6WKCYE3j9KK0Emario6H h8dW+9N4LS+JY+ejS8oNggD599uog1g= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-36-HETCU64eONSr-jy2HVtr_g-1; Tue, 09 Nov 2021 21:00:23 -0500 X-MC-Unique: HETCU64eONSr-jy2HVtr_g-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 209721006AA2 for ; Wed, 10 Nov 2021 02:00:23 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.phx2.redhat.com [10.5.9.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id E13B860C17 for ; Wed, 10 Nov 2021 02:00:22 +0000 (UTC) Message-ID: Date: Tue, 9 Nov 2021 20:00:22 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 Content-Language: en-US From: Eric Sandeen To: xfs References: Reply-To: sandeen@redhat.com Subject: [PATCH 2/3] libxfs: #ifdef out perag code for userspace (xfsprogs version) In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org The xfs_perag structure and initialization is unused in userspace, so #ifdef it out with __KERNEL__ to facilitate the xfsprogs sync and build. Signed-off-by: Eric Sandeen --- This is the synced userspace code, for clarity. I'll do a normal libxfs-sync. diff --git a/libxfs/xfs_ag.c b/libxfs/xfs_ag.c index 9eda6eba..149f9857 100644 --- a/libxfs/xfs_ag.c +++ b/libxfs/xfs_ag.c @@ -246,6 +246,7 @@ xfs_initialize_perag( spin_unlock(&mp->m_perag_lock); radix_tree_preload_end(); +#ifdef __KERNEL__ /* Place kernel structure only init below this point. */ spin_lock_init(&pag->pag_ici_lock); spin_lock_init(&pag->pagb_lock); @@ -255,6 +256,7 @@ xfs_initialize_perag( init_waitqueue_head(&pag->pagb_wait); pag->pagb_count = 0; pag->pagb_tree = RB_ROOT; +#endif /* __KERNEL_ */ error = xfs_buf_hash_init(pag); if (error) diff --git a/libxfs/xfs_ag.h b/libxfs/xfs_ag.h index 4c6f9045..01c36cfe 100644 --- a/libxfs/xfs_ag.h +++ b/libxfs/xfs_ag.h @@ -64,6 +64,10 @@ struct xfs_perag { /* Blocks reserved for the reverse mapping btree. */ struct xfs_ag_resv pag_rmapbt_resv; + /* for rcu-safe freeing */ + struct rcu_head rcu_head; + +#ifdef __KERNEL__ /* -- kernel only structures below this line -- */ /* @@ -90,9 +94,6 @@ struct xfs_perag { spinlock_t pag_buf_lock; /* lock for pag_buf_hash */ struct rhashtable pag_buf_hash; - /* for rcu-safe freeing */ - struct rcu_head rcu_head; - /* background prealloc block trimming */ struct delayed_work pag_blockgc_work; @@ -102,6 +103,7 @@ struct xfs_perag { * or have some other means to control concurrency. */ struct rhashtable pagi_unlinked_hash; +#endif /* __KERNEL__ */ }; int xfs_initialize_perag(struct xfs_mount *mp, xfs_agnumber_t agcount, From patchwork Wed Nov 10 02:02:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 12611277 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D071BC433F5 for ; Wed, 10 Nov 2021 02:02:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A053560E93 for ; Wed, 10 Nov 2021 02:02:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229470AbhKJCFF (ORCPT ); Tue, 9 Nov 2021 21:05:05 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:35824 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229445AbhKJCFE (ORCPT ); Tue, 9 Nov 2021 21:05:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636509737; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RXr0OXnPZhtdbF7z4tfwDPOM4CnfS4NXitz7YpZh0i0=; b=RcJRdxH90UGOq5jZ2bGXzt3Yna6FrdghAIG02u6qvFTaouibnHETQzDcKVRqK5xUxm2/dg ZNHEKTnJdgQQB30WbNXEXE/8UxzS3s5+CcN9riUu1SJtgE5mYV+gIqbHvKUrsSmhi6wX15 hyOMsk/27kcZf34+lAkP+h1+CqY31GY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-275-6KoYcwMVNxCIAXnLY0SXRg-1; Tue, 09 Nov 2021 21:02:15 -0500 X-MC-Unique: 6KoYcwMVNxCIAXnLY0SXRg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A3C67180830B for ; Wed, 10 Nov 2021 02:02:14 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.phx2.redhat.com [10.5.9.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7E765100E125 for ; Wed, 10 Nov 2021 02:02:14 +0000 (UTC) Message-ID: Date: Tue, 9 Nov 2021 20:02:14 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 Content-Language: en-US From: Eric Sandeen To: xfs References: Reply-To: sandeen@redhat.com Subject: [PATCH 3/3] xfsprogs: remove kernel stubs from xfs_shared.h In-Reply-To: X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org The kernel stubs added to xfs_shared.h don't belong there, and are mostly unnecessary with the #ifdef __KERNEL__ bits added to the xfs_ag.[ch] files. Move the one remaining needed stub in libxfs_priv.h. Signed-off-by: Eric Sandeen Reviewed-by: Darrick J. Wong diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h index 15bae1ff..3957a2e0 100644 --- a/libxfs/libxfs_priv.h +++ b/libxfs/libxfs_priv.h @@ -75,6 +75,8 @@ extern kmem_zone_t *xfs_trans_zone; /* fake up kernel's iomap, (not) used in xfs_bmap.[ch] */ struct iomap; +#define cancel_delayed_work_sync(work) do { } while(0) + #include "xfs_cksum.h" /* diff --git a/libxfs/xfs_shared.h b/libxfs/xfs_shared.h index bafee48c..25c4cab5 100644 --- a/libxfs/xfs_shared.h +++ b/libxfs/xfs_shared.h @@ -180,24 +180,4 @@ struct xfs_ino_geometry { }; -/* Faked up kernel bits */ -struct rb_root { -}; - -#define RB_ROOT (struct rb_root) { } - -typedef struct wait_queue_head { -} wait_queue_head_t; - -#define init_waitqueue_head(wqh) do { } while(0) - -struct rhashtable { -}; - -struct delayed_work { -}; - -#define INIT_DELAYED_WORK(work, func) do { } while(0) -#define cancel_delayed_work_sync(work) do { } while(0) - #endif /* __XFS_SHARED_H__ */ From patchwork Wed Nov 10 02:34:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 12611295 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D9EEC433EF for ; Wed, 10 Nov 2021 02:34:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 54DF461179 for ; Wed, 10 Nov 2021 02:34:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229920AbhKJCgx (ORCPT ); Tue, 9 Nov 2021 21:36:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:39884 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229717AbhKJCgw (ORCPT ); Tue, 9 Nov 2021 21:36:52 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2BB0C61105; Wed, 10 Nov 2021 02:34:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1636511646; bh=MUOA9gepVpfNC+mFC/yB5BIOZnz/fKJ6crBI8Su77ZI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Ncf2oMlyBcY2KSRjq3Fu6I1gkzI8jABQ/sAZk7OJARpOzodymCvjn6rzpmJBZ0QlW vPRRCjmW81yfAQlQqj4L/jPTGMP1UqPsCvEornk8+l1ObAD2SLkokDY7DyMs1AiZeS B7Rklq+cp3Mh6vQwAm0oYdJy74IZybRdLJTFv428rJMe8ECVKAT/9ABegpOozDnnuZ ghOdWeIcswzAOcqOjlDFVRvwYjC/2pRw/+VPJzd/dj4gYpJj4PQMEtMy2SH93KIORq VbC37beHhb+xIYAaYVD1w98DayTTF/29xOVyf3QEHrUjGXmMNhBBz2emOAmPoAieTL yIzwMHeBYlD/w== Date: Tue, 9 Nov 2021 18:34:05 -0800 From: "Darrick J. Wong" To: Eric Sandeen Cc: xfs Subject: [PATCH 4/3] xfs: sync xfs_btree_split macros with userspace libxfs Message-ID: <20211110023405.GY24307@magnolia> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Sync this one last bit of discrepancy between kernel and userspace libxfs. Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen --- fs/xfs/libxfs/xfs_btree.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/xfs/libxfs/xfs_btree.c b/fs/xfs/libxfs/xfs_btree.c index b4e19aacb9de..d8a859bc797a 100644 --- a/fs/xfs/libxfs/xfs_btree.c +++ b/fs/xfs/libxfs/xfs_btree.c @@ -2785,6 +2785,7 @@ __xfs_btree_split( return error; } +#ifdef __KERNEL__ struct xfs_btree_split_args { struct xfs_btree_cur *cur; int level; @@ -2870,6 +2871,9 @@ xfs_btree_split( destroy_work_on_stack(&args.work); return args.result; } +#else /* !KERNEL */ +#define xfs_btree_split __xfs_btree_split +#endif /*