public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* xfs: add fs name to kthreads
@ 2010-03-06 19:34 Jan Engelhardt
  2010-03-08  1:28 ` Dave Chinner
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Engelhardt @ 2010-03-06 19:34 UTC (permalink / raw)
  To: xfs

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
---

 fs/xfs/linux-2.6/xfs_buf.c   |   10 ++++++----
 fs/xfs/linux-2.6/xfs_buf.h   |    2 +-
 fs/xfs/linux-2.6/xfs_super.c |   11 ++++++-----
 fs/xfs/linux-2.6/xfs_sync.c  |    2 +-
 fs/xfs/xfs_trans_ail.c       |    2 +-
 fs/xfs/xfs_trans_priv.h      |    2 +-
 6 files changed, 16 insertions(+), 13 deletions(-)


Index: linux-2.6.33/fs/xfs/linux-2.6/xfs_buf.c
===================================================================
--- linux-2.6.33.orig/fs/xfs/linux-2.6/xfs_buf.c
+++ linux-2.6.33/fs/xfs/linux-2.6/xfs_buf.c
@@ -1527,7 +1527,8 @@ xfs_mapping_buftarg(
 
 STATIC int
 xfs_alloc_delwrite_queue(
-	xfs_buftarg_t		*btp)
+	xfs_buftarg_t		*btp,
+	const char *fsname)
 {
 	int	error = 0;
 
@@ -1535,7 +1536,7 @@ xfs_alloc_delwrite_queue(
 	INIT_LIST_HEAD(&btp->bt_delwrite_queue);
 	spin_lock_init(&btp->bt_delwrite_lock);
 	btp->bt_flags = 0;
-	btp->bt_task = kthread_run(xfsbufd, btp, "xfsbufd");
+	btp->bt_task = kthread_run(xfsbufd, btp, "xfsbufd/%s", fsname);
 	if (IS_ERR(btp->bt_task)) {
 		error = PTR_ERR(btp->bt_task);
 		goto out_error;
@@ -1548,7 +1549,8 @@ out_error:
 xfs_buftarg_t *
 xfs_alloc_buftarg(
 	struct block_device	*bdev,
-	int			external)
+	int			external,
+	const char *fsname)
 {
 	xfs_buftarg_t		*btp;
 
@@ -1560,7 +1562,7 @@ xfs_alloc_buftarg(
 		goto error;
 	if (xfs_mapping_buftarg(btp, bdev))
 		goto error;
-	if (xfs_alloc_delwrite_queue(btp))
+	if (xfs_alloc_delwrite_queue(btp, fsname))
 		goto error;
 	xfs_alloc_bufhash(btp, external);
 	return btp;
Index: linux-2.6.33/fs/xfs/linux-2.6/xfs_buf.h
===================================================================
--- linux-2.6.33.orig/fs/xfs/linux-2.6/xfs_buf.h
+++ linux-2.6.33/fs/xfs/linux-2.6/xfs_buf.h
@@ -419,7 +419,7 @@ static inline int XFS_bwrite(xfs_buf_t *
 /*
  *	Handling of buftargs.
  */
-extern xfs_buftarg_t *xfs_alloc_buftarg(struct block_device *, int);
+extern xfs_buftarg_t *xfs_alloc_buftarg(struct block_device *, int, const char *);
 extern void xfs_free_buftarg(struct xfs_mount *, struct xfs_buftarg *);
 extern void xfs_wait_buftarg(xfs_buftarg_t *);
 extern int xfs_setsize_buftarg(xfs_buftarg_t *, unsigned int, unsigned int);
Index: linux-2.6.33/fs/xfs/linux-2.6/xfs_super.c
===================================================================
--- linux-2.6.33.orig/fs/xfs/linux-2.6/xfs_super.c
+++ linux-2.6.33/fs/xfs/linux-2.6/xfs_super.c
@@ -788,18 +788,18 @@ xfs_open_devices(
 	 * Setup xfs_mount buffer target pointers
 	 */
 	error = ENOMEM;
-	mp->m_ddev_targp = xfs_alloc_buftarg(ddev, 0);
+	mp->m_ddev_targp = xfs_alloc_buftarg(ddev, 0, mp->m_fsname);
 	if (!mp->m_ddev_targp)
 		goto out_close_rtdev;
 
 	if (rtdev) {
-		mp->m_rtdev_targp = xfs_alloc_buftarg(rtdev, 1);
+		mp->m_rtdev_targp = xfs_alloc_buftarg(rtdev, 1, mp->m_fsname);
 		if (!mp->m_rtdev_targp)
 			goto out_free_ddev_targ;
 	}
 
 	if (logdev && logdev != ddev) {
-		mp->m_logdev_targp = xfs_alloc_buftarg(logdev, 1);
+		mp->m_logdev_targp = xfs_alloc_buftarg(logdev, 1, mp->m_fsname);
 		if (!mp->m_logdev_targp)
 			goto out_free_rtdev_targ;
 	} else {
@@ -899,10 +899,11 @@ xfsaild(
 
 int
 xfsaild_start(
-	struct xfs_ail	*ailp)
+	struct xfs_ail	*ailp,
+	const char *fsname)
 {
 	ailp->xa_target = 0;
-	ailp->xa_task = kthread_run(xfsaild, ailp, "xfsaild");
+	ailp->xa_task = kthread_run(xfsaild, ailp, "xfsaild/%s", fsname);
 	if (IS_ERR(ailp->xa_task))
 		return -PTR_ERR(ailp->xa_task);
 	return 0;
Index: linux-2.6.33/fs/xfs/linux-2.6/xfs_sync.c
===================================================================
--- linux-2.6.33.orig/fs/xfs/linux-2.6/xfs_sync.c
+++ linux-2.6.33/fs/xfs/linux-2.6/xfs_sync.c
@@ -658,7 +658,7 @@ xfs_syncd_init(
 	mp->m_sync_work.w_syncer = xfs_sync_worker;
 	mp->m_sync_work.w_mount = mp;
 	mp->m_sync_work.w_completion = NULL;
-	mp->m_sync_task = kthread_run(xfssyncd, mp, "xfssyncd");
+	mp->m_sync_task = kthread_run(xfssyncd, mp, "xfssyncd/%s", mp->m_fsname);
 	if (IS_ERR(mp->m_sync_task))
 		return -PTR_ERR(mp->m_sync_task);
 	return 0;
Index: linux-2.6.33/fs/xfs/xfs_trans_ail.c
===================================================================
--- linux-2.6.33.orig/fs/xfs/xfs_trans_ail.c
+++ linux-2.6.33/fs/xfs/xfs_trans_ail.c
@@ -598,7 +598,7 @@ xfs_trans_ail_init(
 	ailp->xa_mount = mp;
 	INIT_LIST_HEAD(&ailp->xa_ail);
 	spin_lock_init(&ailp->xa_lock);
-	error = xfsaild_start(ailp);
+	error = xfsaild_start(ailp, mp->m_fsname);
 	if (error)
 		goto out_free_ailp;
 	mp->m_ail = ailp;
Index: linux-2.6.33/fs/xfs/xfs_trans_priv.h
===================================================================
--- linux-2.6.33.orig/fs/xfs/xfs_trans_priv.h
+++ linux-2.6.33/fs/xfs/xfs_trans_priv.h
@@ -107,7 +107,7 @@ void			xfs_trans_ail_cursor_done(struct
 
 long	xfsaild_push(struct xfs_ail *, xfs_lsn_t *);
 void	xfsaild_wakeup(struct xfs_ail *, xfs_lsn_t);
-int	xfsaild_start(struct xfs_ail *);
+int	xfsaild_start(struct xfs_ail *, const char *);
 void	xfsaild_stop(struct xfs_ail *);
 
 #if BITS_PER_LONG != 64

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: xfs: add fs name to kthreads
  2010-03-06 19:34 xfs: add fs name to kthreads Jan Engelhardt
@ 2010-03-08  1:28 ` Dave Chinner
  2010-03-18 14:13   ` Jan Engelhardt
  0 siblings, 1 reply; 4+ messages in thread
From: Dave Chinner @ 2010-03-08  1:28 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: xfs

On Sat, Mar 06, 2010 at 08:34:39PM +0100, Jan Engelhardt wrote:
> Signed-off-by: Jan Engelhardt <jengelh@medozas.de>

Looks ok, but a couple of things. First, it would be good if you
supplied a reason/justification for the patch so the commit message
will tell us why this change was made.

> Index: linux-2.6.33/fs/xfs/linux-2.6/xfs_buf.c
> ===================================================================
> --- linux-2.6.33.orig/fs/xfs/linux-2.6/xfs_buf.c
> +++ linux-2.6.33/fs/xfs/linux-2.6/xfs_buf.c
> @@ -1527,7 +1527,8 @@ xfs_mapping_buftarg(
>  
>  STATIC int
>  xfs_alloc_delwrite_queue(
> -	xfs_buftarg_t		*btp)
> +	xfs_buftarg_t		*btp,
> +	const char *fsname)

Please keep the same indent style as the rest of the functions. i.e

	const char		*fsname)

> @@ -1548,7 +1549,8 @@ out_error:
>  xfs_buftarg_t *
>  xfs_alloc_buftarg(
>  	struct block_device	*bdev,
> -	int			external)
> +	int			external,
> +	const char *fsname)

Same again.

> @@ -899,10 +899,11 @@ xfsaild(
>  
>  int
>  xfsaild_start(
> -	struct xfs_ail	*ailp)
> +	struct xfs_ail	*ailp,
> +	const char *fsname)
>  {
>  	ailp->xa_target = 0;
> -	ailp->xa_task = kthread_run(xfsaild, ailp, "xfsaild");
> +	ailp->xa_task = kthread_run(xfsaild, ailp, "xfsaild/%s", fsname);

No need to pass the name into this function. It can be retrieved
from ailp->xa_mount->m_fsname.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: xfs: add fs name to kthreads
  2010-03-08  1:28 ` Dave Chinner
@ 2010-03-18 14:13   ` Jan Engelhardt
  2010-03-24 21:53     ` Dave Chinner
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Engelhardt @ 2010-03-18 14:13 UTC (permalink / raw)
  To: Dave Chinner; +Cc: xfs


On Monday 2010-03-08 02:28, Dave Chinner wrote:
>
>Looks ok, but a couple of things. First, it would be good if you
>supplied a reason/justification for the patch so the commit message
>will tell us why this change was made.
>
>Please keep the same indent style as the rest of the functions. i.e

>>  xfsaild_start(
>> -	struct xfs_ail	*ailp)
>> +	struct xfs_ail	*ailp,
>> +	const char *fsname)
>>  {
>>  	ailp->xa_target = 0;
>> -	ailp->xa_task = kthread_run(xfsaild, ailp, "xfsaild");
>> +	ailp->xa_task = kthread_run(xfsaild, ailp, "xfsaild/%s", fsname);
>
>No need to pass the name into this function. It can be retrieved
>from ailp->xa_mount->m_fsname.

I think I've got that now.

N.B.: The xfslogd/N threads are obvious (percpu workqueue, or
whatever the tech is currently called), but at one time in the
past it struck me that I had lots of xfsbufd/aild/syncd without
the /n suffix.

parent 8bee4bad03c5b601bd6cea123c31025680587ccc (v2.6.34-rc1-1099-g8bee4ba)
commit 5ed80bc8adebca15e73b815aec45d434013c79f0
Author: Jan Engelhardt <jengelh@medozas.de>
Date:   Thu Mar 18 14:25:17 2010 +0100

xfs: add blockdev name to kthreads

This allows to see in `ps` and similar tools which kthreads are
allotted to which block device/filesystem, similar to what jbd2
does. As the process name is a fixed 16-char array, no extra
space is needed in tasks.

  PID TTY      STAT   TIME COMMAND
    2 ?        S      0:00 [kthreadd]
  197 ?        S      0:00  \_ [jbd2/sda2-8]
  198 ?        S      0:00  \_ [ext4-dio-unwrit]
  204 ?        S      0:00  \_ [flush-8:0]
 2647 ?        S      0:00  \_ [xfs_mru_cache]
 2648 ?        S      0:00  \_ [xfslogd/0]
 2649 ?        S      0:00  \_ [xfsdatad/0]
 2650 ?        S      0:00  \_ [xfsconvertd/0]
 2651 ?        S      0:00  \_ [xfsbufd/ram0]
 2652 ?        S      0:00  \_ [xfsaild/ram0]
 2653 ?        S      0:00  \_ [xfssyncd/ram0]

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
---
 fs/xfs/linux-2.6/xfs_buf.c   |   10 ++++++----
 fs/xfs/linux-2.6/xfs_buf.h   |    2 +-
 fs/xfs/linux-2.6/xfs_super.c |    9 +++++----
 fs/xfs/linux-2.6/xfs_sync.c  |    2 +-
 4 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c
index 6f76ba8..7ea613a 100644
--- a/fs/xfs/linux-2.6/xfs_buf.c
+++ b/fs/xfs/linux-2.6/xfs_buf.c
@@ -1684,7 +1684,8 @@ xfs_mapping_buftarg(
 
 STATIC int
 xfs_alloc_delwrite_queue(
-	xfs_buftarg_t		*btp)
+	xfs_buftarg_t		*btp,
+	const char		*fsname)
 {
 	int	error = 0;
 
@@ -1692,7 +1693,7 @@ xfs_alloc_delwrite_queue(
 	INIT_LIST_HEAD(&btp->bt_delwrite_queue);
 	spin_lock_init(&btp->bt_delwrite_lock);
 	btp->bt_flags = 0;
-	btp->bt_task = kthread_run(xfsbufd, btp, "xfsbufd");
+	btp->bt_task = kthread_run(xfsbufd, btp, "xfsbufd/%s", fsname);
 	if (IS_ERR(btp->bt_task)) {
 		error = PTR_ERR(btp->bt_task);
 		goto out_error;
@@ -1705,7 +1706,8 @@ out_error:
 xfs_buftarg_t *
 xfs_alloc_buftarg(
 	struct block_device	*bdev,
-	int			external)
+	int			external,
+	const char		*fsname)
 {
 	xfs_buftarg_t		*btp;
 
@@ -1717,7 +1719,7 @@ xfs_alloc_buftarg(
 		goto error;
 	if (xfs_mapping_buftarg(btp, bdev))
 		goto error;
-	if (xfs_alloc_delwrite_queue(btp))
+	if (xfs_alloc_delwrite_queue(btp, fsname))
 		goto error;
 	xfs_alloc_bufhash(btp, external);
 	return btp;
diff --git a/fs/xfs/linux-2.6/xfs_buf.h b/fs/xfs/linux-2.6/xfs_buf.h
index 386e736..5fbecef 100644
--- a/fs/xfs/linux-2.6/xfs_buf.h
+++ b/fs/xfs/linux-2.6/xfs_buf.h
@@ -390,7 +390,7 @@ static inline void xfs_buf_relse(xfs_buf_t *bp)
 /*
  *	Handling of buftargs.
  */
-extern xfs_buftarg_t *xfs_alloc_buftarg(struct block_device *, int);
+extern xfs_buftarg_t *xfs_alloc_buftarg(struct block_device *, int, const char *);
 extern void xfs_free_buftarg(struct xfs_mount *, struct xfs_buftarg *);
 extern void xfs_wait_buftarg(xfs_buftarg_t *);
 extern int xfs_setsize_buftarg(xfs_buftarg_t *, unsigned int, unsigned int);
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
index 71345a3..15bea67 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -788,18 +788,18 @@ xfs_open_devices(
 	 * Setup xfs_mount buffer target pointers
 	 */
 	error = ENOMEM;
-	mp->m_ddev_targp = xfs_alloc_buftarg(ddev, 0);
+	mp->m_ddev_targp = xfs_alloc_buftarg(ddev, 0, mp->m_fsname);
 	if (!mp->m_ddev_targp)
 		goto out_close_rtdev;
 
 	if (rtdev) {
-		mp->m_rtdev_targp = xfs_alloc_buftarg(rtdev, 1);
+		mp->m_rtdev_targp = xfs_alloc_buftarg(rtdev, 1, mp->m_fsname);
 		if (!mp->m_rtdev_targp)
 			goto out_free_ddev_targ;
 	}
 
 	if (logdev && logdev != ddev) {
-		mp->m_logdev_targp = xfs_alloc_buftarg(logdev, 1);
+		mp->m_logdev_targp = xfs_alloc_buftarg(logdev, 1, mp->m_fsname);
 		if (!mp->m_logdev_targp)
 			goto out_free_rtdev_targ;
 	} else {
@@ -901,7 +901,8 @@ xfsaild_start(
 	struct xfs_ail	*ailp)
 {
 	ailp->xa_target = 0;
-	ailp->xa_task = kthread_run(xfsaild, ailp, "xfsaild");
+	ailp->xa_task = kthread_run(xfsaild, ailp, "xfsaild/%s",
+				    ailp->xa_mount->m_fsname);
 	if (IS_ERR(ailp->xa_task))
 		return -PTR_ERR(ailp->xa_task);
 	return 0;
diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/linux-2.6/xfs_sync.c
index 05cd853..97813e7 100644
--- a/fs/xfs/linux-2.6/xfs_sync.c
+++ b/fs/xfs/linux-2.6/xfs_sync.c
@@ -652,7 +652,7 @@ xfs_syncd_init(
 	mp->m_sync_work.w_syncer = xfs_sync_worker;
 	mp->m_sync_work.w_mount = mp;
 	mp->m_sync_work.w_completion = NULL;
-	mp->m_sync_task = kthread_run(xfssyncd, mp, "xfssyncd");
+	mp->m_sync_task = kthread_run(xfssyncd, mp, "xfssyncd/%s", mp->m_fsname);
 	if (IS_ERR(mp->m_sync_task))
 		return -PTR_ERR(mp->m_sync_task);
 	return 0;
-- 
# Created with git-export-patch

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: xfs: add fs name to kthreads
  2010-03-18 14:13   ` Jan Engelhardt
@ 2010-03-24 21:53     ` Dave Chinner
  0 siblings, 0 replies; 4+ messages in thread
From: Dave Chinner @ 2010-03-24 21:53 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: xfs

On Thu, Mar 18, 2010 at 03:13:10PM +0100, Jan Engelhardt wrote:
> 
> On Monday 2010-03-08 02:28, Dave Chinner wrote:
> >
> >Looks ok, but a couple of things. First, it would be good if you
> >supplied a reason/justification for the patch so the commit message
> >will tell us why this change was made.
> >
> >Please keep the same indent style as the rest of the functions. i.e
> 
> >>  xfsaild_start(
> >> -	struct xfs_ail	*ailp)
> >> +	struct xfs_ail	*ailp,
> >> +	const char *fsname)
> >>  {
> >>  	ailp->xa_target = 0;
> >> -	ailp->xa_task = kthread_run(xfsaild, ailp, "xfsaild");
> >> +	ailp->xa_task = kthread_run(xfsaild, ailp, "xfsaild/%s", fsname);
> >
> >No need to pass the name into this function. It can be retrieved
> >from ailp->xa_mount->m_fsname.
> 
> I think I've got that now.
> 
> N.B.: The xfslogd/N threads are obvious (percpu workqueue, or
> whatever the tech is currently called), but at one time in the
> past it struck me that I had lots of xfsbufd/aild/syncd without
> the /n suffix.

Looks good now, I'll queue it up with all the other pending changes
I have.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-03-24 21:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-06 19:34 xfs: add fs name to kthreads Jan Engelhardt
2010-03-08  1:28 ` Dave Chinner
2010-03-18 14:13   ` Jan Engelhardt
2010-03-24 21:53     ` Dave Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox