mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>,
	Michal Marek <michal.lkml@markovi.net>,
	linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org
Subject: Re: [RFC PATCH 0/5] kbuild: build modules from code in multiple directories.
Date: Tue, 19 Jun 2018 14:05:23 +1000	[thread overview]
Message-ID: <87po0ne7zw.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <20180618082017.GA4752@infradead.org>

[-- Attachment #1: Type: text/plain, Size: 6271 bytes --]

On Mon, Jun 18 2018, Christoph Hellwig wrote:

> On Mon, Jun 18, 2018 at 02:55:20PM +1000, NeilBrown wrote:
>> This set of patches makes it possible to build a module from
>> code in multiple directories without needing to list files from one
>> directory in the Makefile of another directory.
>> 
>> The code was developed for lustre (which is now out-of-tree :-( ) but
>> can be useful elsewhere, such as for xfs and btrfs and others.
>> 
>> In fs/xfs/Makefile the section:
>> 
>> xfs-y				+= $(addprefix libxfs/, \
>> 				   xfs_ag.o \
>> 				   xfs_alloc.o \
>> 				.....
>> 
>> could become
>> 
>> xfs-y += libxfs/
>> 
>> and then in fs/xfs/libxfs/Makefile we would have
>> 
>> modobj-$(CONFIG_XFS_FS) += xfs_ag.o \
>> 			   xfs_alloc.o \
>> 			   .....
>> 
>> A similar process could move filenames for scrub/* from the
>> fs/xfs/Makefile to fs/xfs/scrub/Makefile
>
> How about you actually convert it as an example?

Sure ... found a bug while testing it.  Thanks :-)

From ac7953b4ba6d9a2a69dab84dd772aafca38d8377 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.com>
Date: Tue, 19 Jun 2018 13:59:16 +1000
Subject: [PATCH] kbuild/xfs: example modobj-m conversion

This is a demonstration patch to show how
xfs can be changed to make use of the proposed modobj-m=
functionality, should the xfs developers want that.

Signed-off-by: NeilBrown <neilb@suse.com>
---
 fs/xfs/Makefile        | 78 ++------------------------------------------------
 fs/xfs/libxfs/Makefile | 43 ++++++++++++++++++++++++++++
 fs/xfs/scrub/Makefile  | 29 +++++++++++++++++++
 3 files changed, 74 insertions(+), 76 deletions(-)
 create mode 100644 fs/xfs/libxfs/Makefile
 create mode 100644 fs/xfs/scrub/Makefile

diff --git a/fs/xfs/Makefile b/fs/xfs/Makefile
index 2f3f75a7f180..0ba854045fe9 100644
--- a/fs/xfs/Makefile
+++ b/fs/xfs/Makefile
@@ -15,47 +15,7 @@ obj-$(CONFIG_XFS_FS)		+= xfs.o
 xfs-y				+= xfs_trace.o
 
 # build the libxfs code first
-xfs-y				+= $(addprefix libxfs/, \
-				   xfs_ag.o \
-				   xfs_alloc.o \
-				   xfs_alloc_btree.o \
-				   xfs_attr.o \
-				   xfs_attr_leaf.o \
-				   xfs_attr_remote.o \
-				   xfs_bit.o \
-				   xfs_bmap.o \
-				   xfs_bmap_btree.o \
-				   xfs_btree.o \
-				   xfs_da_btree.o \
-				   xfs_da_format.o \
-				   xfs_defer.o \
-				   xfs_dir2.o \
-				   xfs_dir2_block.o \
-				   xfs_dir2_data.o \
-				   xfs_dir2_leaf.o \
-				   xfs_dir2_node.o \
-				   xfs_dir2_sf.o \
-				   xfs_dquot_buf.o \
-				   xfs_ialloc.o \
-				   xfs_ialloc_btree.o \
-				   xfs_iext_tree.o \
-				   xfs_inode_fork.o \
-				   xfs_inode_buf.o \
-				   xfs_log_rlimit.o \
-				   xfs_ag_resv.o \
-				   xfs_rmap.o \
-				   xfs_rmap_btree.o \
-				   xfs_refcount.o \
-				   xfs_refcount_btree.o \
-				   xfs_sb.o \
-				   xfs_symlink_remote.o \
-				   xfs_trans_resv.o \
-				   xfs_types.o \
-				   )
-# xfs_rtbitmap is shared with libxfs
-xfs-$(CONFIG_XFS_RT)		+= $(addprefix libxfs/, \
-				   xfs_rtbitmap.o \
-				   )
+xfs-y				+= libxfs/
 
 # highlevel code
 xfs-y				+= xfs_aops.o \
@@ -127,38 +87,4 @@ xfs-$(CONFIG_SYSCTL)		+= xfs_sysctl.o
 xfs-$(CONFIG_COMPAT)		+= xfs_ioctl32.o
 xfs-$(CONFIG_EXPORTFS_BLOCK_OPS)	+= xfs_pnfs.o
 
-# online scrub/repair
-ifeq ($(CONFIG_XFS_ONLINE_SCRUB),y)
-
-# Tracepoints like to blow up, so build that before everything else
-
-xfs-y				+= $(addprefix scrub/, \
-				   trace.o \
-				   agheader.o \
-				   alloc.o \
-				   attr.o \
-				   bmap.o \
-				   btree.o \
-				   common.o \
-				   dabtree.o \
-				   dir.o \
-				   ialloc.o \
-				   inode.o \
-				   parent.o \
-				   refcount.o \
-				   rmap.o \
-				   scrub.o \
-				   symlink.o \
-				   )
-
-xfs-$(CONFIG_XFS_RT)		+= scrub/rtbitmap.o
-xfs-$(CONFIG_XFS_QUOTA)		+= scrub/quota.o
-
-# online repair
-ifeq ($(CONFIG_XFS_ONLINE_REPAIR),y)
-xfs-y				+= $(addprefix scrub/, \
-				   agheader_repair.o \
-				   repair.o \
-				   )
-endif
-endif
+xfs-$(CONFIG_XFS_ONLINE_SCRUB)	+= scrub/
diff --git a/fs/xfs/libxfs/Makefile b/fs/xfs/libxfs/Makefile
new file mode 100644
index 000000000000..9b90c289bdda
--- /dev/null
+++ b/fs/xfs/libxfs/Makefile
@@ -0,0 +1,43 @@
+# SPDX-License-Identifier: GPL-2.0
+
+ccflags-y += -I$(src)/..
+
+# xfs_rtbitmap is shared with libxfs
+xobj-$(CONFIG_XFS_RT)		+= xfs_rtbitmap.o
+
+modobj-$(CONFIG_XFS_FS) +=	   xfs_ag.o \
+				   xfs_alloc.o \
+				   xfs_alloc_btree.o \
+				   xfs_attr.o \
+				   xfs_attr_leaf.o \
+				   xfs_attr_remote.o \
+				   xfs_bit.o \
+				   xfs_bmap.o \
+				   xfs_bmap_btree.o \
+				   xfs_btree.o \
+				   xfs_da_btree.o \
+				   xfs_da_format.o \
+				   xfs_defer.o \
+				   xfs_dir2.o \
+				   xfs_dir2_block.o \
+				   xfs_dir2_data.o \
+				   xfs_dir2_leaf.o \
+				   xfs_dir2_node.o \
+				   xfs_dir2_sf.o \
+				   xfs_dquot_buf.o \
+				   xfs_ialloc.o \
+				   xfs_ialloc_btree.o \
+				   xfs_iext_tree.o \
+				   xfs_inode_fork.o \
+				   xfs_inode_buf.o \
+				   xfs_log_rlimit.o \
+				   xfs_ag_resv.o \
+				   xfs_rmap.o \
+				   xfs_rmap_btree.o \
+				   xfs_refcount.o \
+				   xfs_refcount_btree.o \
+				   xfs_sb.o \
+				   xfs_symlink_remote.o \
+				   xfs_trans_resv.o \
+				   xfs_types.o \
+				   $(xobj-y)
diff --git a/fs/xfs/scrub/Makefile b/fs/xfs/scrub/Makefile
new file mode 100644
index 000000000000..f91818a0e6ee
--- /dev/null
+++ b/fs/xfs/scrub/Makefile
@@ -0,0 +1,29 @@
+# SPDX-License-Identifier: GPL-2.0
+
+# Tracepoints like to blow up, so build that before everything else
+
+ccflags-y += -I$(src)/..
+ccflags-y += -I$(src)/../libxfs
+
+xobj-$(CONFIG_XFS_RT)		+= rtbitmap.o
+xobj-$(CONFIG_XFS_QUOTA)	+= quota.o
+xobj-$(CONFIG_XFS_ONLINE_REPAIR)+= agheader_repair.o \
+				   repair.o
+
+modobj-$(CONFIG_XFS_FS) +=	   trace.o \
+				   agheader.o \
+				   alloc.o \
+				   attr.o \
+				   bmap.o \
+				   btree.o \
+				   common.o \
+				   dabtree.o \
+				   dir.o \
+				   ialloc.o \
+				   inode.o \
+				   parent.o \
+				   refcount.o \
+				   rmap.o \
+				   scrub.o \
+				   symlink.o \
+				   $(xobj-y)
-- 
2.14.0.rc0.dirty


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2018-06-19  4:05 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-18  4:55 NeilBrown
2018-06-18  4:55 ` [PATCH 4/5] kbuild: disable KBUILD_MODNAME when building for mod.a NeilBrown
2018-06-27  5:52   ` Masahiro Yamada
2018-07-03 22:14     ` NeilBrown
2018-07-04 12:08       ` Masahiro Yamada
2018-07-04 21:54         ` NeilBrown
2018-07-05  9:06           ` Masahiro Yamada
2018-07-05 23:03             ` NeilBrown
2018-06-18  4:55 ` [PATCH 1/5] kbuild: detect directories in components of a module NeilBrown
2018-06-18  4:55 ` [PATCH 2/5] kbuild: treat a directory listed in a composite object as foo/mod.a NeilBrown
2018-06-18  9:14   ` kbuild test robot
2018-06-18 22:30     ` NeilBrown
2018-06-18  4:55 ` [PATCH 5/5] kbuild: Add documentation for modobj-m NeilBrown
2018-06-18  4:55 ` [PATCH 3/5] kbuild: support building of per-directory mod.a NeilBrown
2018-06-19  3:57   ` [PATCH 3/5 - v2] " NeilBrown
2018-06-18  8:20 ` [RFC PATCH 0/5] kbuild: build modules from code in multiple directories Christoph Hellwig
2018-06-19  4:05   ` NeilBrown [this message]
2018-06-19  4:47     ` Christoph Hellwig
2018-06-19  5:03       ` Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87po0ne7zw.fsf@notabene.neil.brown.name \
    --to=neilb@suse.com \
    --cc=hch@infradead.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=yamada.masahiro@socionext.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®