[patch 38/40] reiserfs: clean up balancing modes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 This patch turns the character balancing modes into an enum, since the
 letter itself is irrelevant.

Signed-off-by: Jeff Mahoney <jeffm@xxxxxxxx>

---
 fs/reiserfs/prints.c        |   17 +++++++++++++++++
 include/linux/reiserfs_fs.h |   34 ++++++++++++++++------------------
 2 files changed, 33 insertions(+), 18 deletions(-)

--- a/fs/reiserfs/prints.c	2007-06-11 14:49:41.000000000 -0400
+++ b/fs/reiserfs/prints.c	2007-06-11 14:49:43.000000000 -0400
@@ -14,6 +14,23 @@ static char error_buf[1024];
 static char fmt_buf[1024];
 static char off_buf[80];
 
+const char *tb_mode_names(enum tb_modes mode)
+{
+	char * const names[] = {
+	"INSERT",
+	"PASTE",
+	"DELETE",
+	"CUT",
+	"INTERNAL",
+	"SKIP_BALANCING",
+	"CONVERT",
+	};
+
+	if (mode >= M_MAX_MODES)
+		return "UNKNOWN";
+	return names[mode];
+}
+
 static char *reiserfs_cpu_offset(struct cpu_key *key)
 {
 	if (cpu_key_k_type(key) == TYPE_DIRENTRY)
--- a/include/linux/reiserfs_fs.h	2007-06-11 14:49:41.000000000 -0400
+++ b/include/linux/reiserfs_fs.h	2007-06-11 14:49:43.000000000 -0400
@@ -1388,27 +1388,24 @@ struct tree_balance {
 	struct in_core_key key;	/* key pointer, to pass to block allocator or
 				   another low-level subsystem */
 #endif
+	struct bl_context *context;
 };
 
 /* These are modes of balancing */
-
-/* When inserting an item. */
-#define M_INSERT	'i'
-/* When inserting into (directories only) or appending onto an already
-   existant item. */
-#define M_PASTE		'p'
-/* When deleting an item. */
-#define M_DELETE	'd'
-/* When truncating an item or removing an entry from a (directory) item. */
-#define M_CUT 		'c'
-
-/* used when balancing on leaf level skipped (in reiserfsck) */
-#define M_INTERNAL	'n'
-
-/* When further balancing is not needed, then do_balance does not need
-   to be called. */
-#define M_SKIP_BALANCING 		's'
-#define M_CONVERT	'v'
+enum tb_modes {
+	M_INSERT = 0,	/* When inserting an item. */
+	M_PASTE,	/* When inserting into (directories only) or
+			 * appending onto an already existant item. */
+	M_DELETE,	/* When deleting an item. */
+	M_CUT,		/* When truncating an item or removing an entry
+	                 * from a (directory) item. */
+	M_INTERNAL,	/* used when balancing on leaf level
+			 * skipped (in reiserfsck) */
+	M_SKIP_BALANCING, /* When further balancing is not needed,
+			   * then do_balance does not need to be called. */
+	M_CONVERT,
+	M_MAX_MODES
+};
 
 /* modes of leaf_move_items */
 #define LEAF_FROM_S_TO_L 0
@@ -2027,6 +2024,7 @@ void check_leaf(struct buffer_head *bh);
 void check_internal(struct buffer_head *bh);
 void print_statistics(struct super_block *s);
 char *reiserfs_hashname(int code);
+const char *tb_mode_names(enum tb_modes);
 
 /* lbalance.c */
 int leaf_move_items(int shift_mode, struct tree_balance *tb, int mov_num,

-- 
Jeff Mahoney
SUSE Labs

-
To unsubscribe from this list: send the line "unsubscribe reiserfs-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux File System Development]     [Linux BTRFS]     [Linux NFS]     [Linux Filesystems]     [Ext4 Filesystem]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Resources]

  Powered by Linux