Skip to contentSkip to conversation

remove unnecessary periodic superblock logging.

PATCH In review David Chinner 3 participants 4 messages Apr 10, 2008 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 remove unnecessary periodic superblock logging.

Remove periodic logging of in-core superblock counters.

xfssyncd triggers the logging of superblock counters every 30s if the filesystem is made with lazy-count=1. This will prevent disks from idling and spinning down as there will be a log write every 30s. With the way counter recovery works for lazy-count=1, this code is unnecessary and provides no real benefit, so just remove it.

---
 fs/xfs/linux-2.6/xfs_super.c |    3 +--
 fs/xfs/linux-2.6/xfs_vfs.h   |    1 -
 fs/xfs/xfs_vfsops.c          |   13 -------------
 3 files changed, 1 insertion(+), 16 deletions(-)
fs/xfs/linux-2.6/xfs_super.c +1 -2
Index: 2.6.x-xfs-new/fs/xfs/linux-2.6/xfs_super.c
===================================================================
@@ -1028,8 +1028,7 @@ xfs_sync_worker(
 	int		error;
 
 	if (!(mp->m_flags & XFS_MOUNT_RDONLY))
-		error = xfs_sync(mp, SYNC_FSDATA | SYNC_BDFLUSH | SYNC_ATTR |
-				     SYNC_REFCACHE | SYNC_SUPER);
+		error = xfs_sync(mp, SYNC_FSDATA | SYNC_BDFLUSH | SYNC_ATTR);
 	mp->m_sync_seq++;
 	wake_up(&mp->m_wait_single_sync_task);
 }
fs/xfs/linux-2.6/xfs_vfs.h +0 -1
Index: 2.6.x-xfs-new/fs/xfs/linux-2.6/xfs_vfs.h
===================================================================
@@ -49,7 +49,6 @@ typedef struct bhv_vfs_sync_work {
 #define SYNC_REFCACHE		0x0040  /* prune some of the nfs ref cache */
 #define SYNC_REMOUNT		0x0080  /* remount readonly, no dummy LRs */
 #define SYNC_IOWAIT		0x0100  /* wait for all I/O to complete */
-#define SYNC_SUPER		0x0200  /* flush superblock to disk */
 
 /*
  * When remounting a filesystem read-only or freezing the filesystem,
fs/xfs/xfs_vfsops.c +0 -13
Index: 2.6.x-xfs-new/fs/xfs/xfs_vfsops.c
===================================================================
@@ -1326,21 +1326,8 @@ xfs_syncsub(
 	}
 
 	/*
-	 * If asked, update the disk superblock with incore counter values if we
-	 * are using non-persistent counters so that they don't get too far out
-	 * of sync if we crash or get a forced shutdown. We don't want to force
-	 * this to disk, just get a transaction into the iclogs....
-	 */
-	if (flags & SYNC_SUPER) {
-		error = xfs_log_sbcount(mp, 0);
-		if (error)
-			last_error = error;
-	}
-
-	/*
 	 * Now check to see if the log needs a "dummy" transaction.
 	 */
-
 	if (!(flags & SYNC_REMOUNT) && xfs_log_need_covered(mp)) {
 		xfs_trans_t *tp;
 		xfs_inode_t *ip;
#1 lore raw
Quoted 8 lines · David Chinner

Remove periodic logging of in-core superblock counters.

xfssyncd triggers the logging of superblock counters every 30s if the filesystem is made with lazy-count=1. This will prevent disks from idling and spinning down as there will be a log write every 30s. With the way counter recovery works for lazy-count=1, this code is unnecessary and provides no real benefit, so just remove it.

I'm happy with this (xfs_initialize_perag_data() does the global counter recovery during mount).

Quoted 64 lines
---
 fs/xfs/linux-2.6/xfs_super.c |    3 +--
 fs/xfs/linux-2.6/xfs_vfs.h   |    1 -
 fs/xfs/xfs_vfsops.c          |   13 -------------
 3 files changed, 1 insertion(+), 16 deletions(-)

Index: 2.6.x-xfs-new/fs/xfs/linux-2.6/xfs_super.c
===================================================================
--- 2.6.x-xfs-new.orig/fs/xfs/linux-2.6/xfs_super.c 2008-04-10
10:02:14.000000000 +1000
+++ 2.6.x-xfs-new/fs/xfs/linux-2.6/xfs_super.c 2008-04-10
10:02:58.419346393 +1000

fs/xfs/linux-2.6/xfs_super.c +1 -2
@@ -1028,8 +1028,7 @@ xfs_sync_worker(
 	int		error;
 	if (!(mp->m_flags & XFS_MOUNT_RDONLY))
-		error = xfs_sync(mp, SYNC_FSDATA | SYNC_BDFLUSH | SYNC_ATTR |
-				     SYNC_REFCACHE | SYNC_SUPER);
+		error = xfs_sync(mp, SYNC_FSDATA | SYNC_BDFLUSH | SYNC_ATTR);
 	mp->m_sync_seq++;
 	wake_up(&mp->m_wait_single_sync_task);
 }

Index: 2.6.x-xfs-new/fs/xfs/linux-2.6/xfs_vfs.h
===================================================================
--- 2.6.x-xfs-new.orig/fs/xfs/linux-2.6/xfs_vfs.h 2008-04-10
10:00:25.000000000 +1000
+++ 2.6.x-xfs-new/fs/xfs/linux-2.6/xfs_vfs.h 2008-04-10
10:02:58.419346393 +1000

fs/xfs/linux-2.6/xfs_vfs.h +0 -1
@@ -49,7 +49,6 @@ typedef struct bhv_vfs_sync_work {
 #define SYNC_REFCACHE		0x0040  /* prune some of the nfs ref cache */
 #define SYNC_REMOUNT		0x0080  /* remount readonly, no dummy LRs */
 #define SYNC_IOWAIT		0x0100  /* wait for all I/O to complete */
-#define SYNC_SUPER		0x0200  /* flush superblock to disk */
 /*
  * When remounting a filesystem read-only or freezing the filesystem,

Index: 2.6.x-xfs-new/fs/xfs/xfs_vfsops.c
===================================================================
--- 2.6.x-xfs-new.orig/fs/xfs/xfs_vfsops.c 2008-04-10 10:01:54.000000000
+1000
+++ 2.6.x-xfs-new/fs/xfs/xfs_vfsops.c 2008-04-10 10:03:35.288729547 +1000

(quoted diff) +0 -1
@@ -1326,21 +1326,8 @@ xfs_syncsub(
 	}
 	/*
-	 * If asked, update the disk superblock with incore counter values if  

we

fs/xfs/xfs_vfsops.c +0 -12
-	 * are using non-persistent counters so that they don't get too far out
-	 * of sync if we crash or get a forced shutdown. We don't want to force
-	 * this to disk, just get a transaction into the iclogs....
-	 */
-	if (flags & SYNC_SUPER) {
-		error = xfs_log_sbcount(mp, 0);
-		if (error)
-			last_error = error;
-	}
-
-	/*
 	 * Now check to see if the log needs a "dummy" transaction.
 	 */
-
 	if (!(flags & SYNC_REMOUNT) && xfs_log_need_covered(mp)) {
 		xfs_trans_t *tp;
 		xfs_inode_t *ip;
#2 lore raw
Quoted 11 lines · Barry Naujok
Quoted 8 lines · David Chinner

Remove periodic logging of in-core superblock counters.

xfssyncd triggers the logging of superblock counters every 30s if the filesystem is made with lazy-count=1. This will prevent disks from idling and spinning down as there will be a log write every 30s. With the way counter recovery works for lazy-count=1, this code is unnecessary and provides no real benefit, so just remove it.

Quoted 3 lines

I'm happy with this (xfs_initialize_perag_data() does the global counter recovery during mount).

So we only do the sb count logging at unmount type times... xfs_attr_quiesce() and xfs_unmountfs(),
when no log recovery will happen.
Hmmm...so why do we have to log it out at these times? I'm forgetting how this works.

--Tim

Quoted 71 lines
Quoted 68 lines
---
 fs/xfs/linux-2.6/xfs_super.c |    3 +--
 fs/xfs/linux-2.6/xfs_vfs.h   |    1 -
 fs/xfs/xfs_vfsops.c          |   13 -------------
 3 files changed, 1 insertion(+), 16 deletions(-)

Index: 2.6.x-xfs-new/fs/xfs/linux-2.6/xfs_super.c
===================================================================
--- 2.6.x-xfs-new.orig/fs/xfs/linux-2.6/xfs_super.c 2008-04-10
10:02:14.000000000 +1000
+++ 2.6.x-xfs-new/fs/xfs/linux-2.6/xfs_super.c 2008-04-10
10:02:58.419346393 +1000

fs/xfs/linux-2.6/xfs_super.c +1 -2
@@ -1028,8 +1028,7 @@ xfs_sync_worker(
     int        error;
    if (!(mp->m_flags & XFS_MOUNT_RDONLY))
-        error = xfs_sync(mp, SYNC_FSDATA | SYNC_BDFLUSH | SYNC_ATTR |
-                     SYNC_REFCACHE | SYNC_SUPER);
+        error = xfs_sync(mp, SYNC_FSDATA | SYNC_BDFLUSH | SYNC_ATTR);
     mp->m_sync_seq++;
     wake_up(&mp->m_wait_single_sync_task);
 }

Index: 2.6.x-xfs-new/fs/xfs/linux-2.6/xfs_vfs.h
===================================================================
--- 2.6.x-xfs-new.orig/fs/xfs/linux-2.6/xfs_vfs.h 2008-04-10
10:00:25.000000000 +1000
+++ 2.6.x-xfs-new/fs/xfs/linux-2.6/xfs_vfs.h 2008-04-10
10:02:58.419346393 +1000

(quoted diff) +0 -0
@@ -49,7 +49,6 @@ typedef struct bhv_vfs_sync_work {
 #define SYNC_REFCACHE        0x0040  /* prune some of the nfs ref 

cache */
#define SYNC_REMOUNT 0x0080 /* remount readonly, no dummy LRs */
#define SYNC_IOWAIT 0x0100 /* wait for all I/O to complete */
-#define SYNC_SUPER 0x0200 /* flush superblock to disk */
/*
* When remounting a filesystem read-only or freezing the filesystem,
Index: 2.6.x-xfs-new/fs/xfs/xfs_vfsops.c
===================================================================
--- 2.6.x-xfs-new.orig/fs/xfs/xfs_vfsops.c 2008-04-10
10:01:54.000000000 +1000
+++ 2.6.x-xfs-new/fs/xfs/xfs_vfsops.c 2008-04-10 10:03:35.288729547
+1000

(quoted diff) +0 -1
@@ -1326,21 +1326,8 @@ xfs_syncsub(
     }
    /*
-     * If asked, update the disk superblock with incore counter 

values if we
- * are using non-persistent counters so that they don't get too
far out
- * of sync if we crash or get a forced shutdown. We don't want to
force

fs/xfs/xfs_vfsops.c +0 -10
-     * this to disk, just get a transaction into the iclogs....
-     */
-    if (flags & SYNC_SUPER) {
-        error = xfs_log_sbcount(mp, 0);
-        if (error)
-            last_error = error;
-    }
-
-    /*
      * Now check to see if the log needs a "dummy" transaction.
      */
-
     if (!(flags & SYNC_REMOUNT) && xfs_log_need_covered(mp)) {
         xfs_trans_t *tp;
         xfs_inode_t *ip;
#3 lore raw
Quoted 16 lines · Timothy Shimmin
Quoted 11 lines · Barry Naujok
Quoted 8 lines · David Chinner

Remove periodic logging of in-core superblock counters.

xfssyncd triggers the logging of superblock counters every 30s if the filesystem is made with lazy-count=1. This will prevent disks from idling and spinning down as there will be a log write every 30s. With the way counter recovery works for lazy-count=1, this code is unnecessary and provides no real benefit, so just remove it.

Quoted 3 lines

I'm happy with this (xfs_initialize_perag_data() does the global counter recovery during mount).

Quoted 5 lines

So we only do the sb count logging at unmount type times... xfs_attr_quiesce() and xfs_unmountfs(),
when no log recovery will happen.
Hmmm...so why do we have to log it out at these times? I'm forgetting how this works.

xfs_log_sbcount() sync's the incore counters to the superblock buffer transactionally. Not strictly necessary, but for consistency with other superblock updates.....

Cheers,

Dave.

Signature · 3 lines
Dave Chinner
Principal Engineer
SGI Australian Software Group