Project

General

Profile

Submit #2752 ยป 0001-sys-vfs-hammer-cleanup-using-existing-macro.patch.txt

tkusumi, 12/26/2014 02:36 PM

 
From b6ab7f17c5fdc9849fe984085b41a8ea5d24a5a3 Mon Sep 17 00:00:00 2001
From: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
Date: Sat, 27 Dec 2014 05:38:02 +0900
Subject: [PATCH] sys/vfs/hammer: cleanup using existing macro

This patch is a cleanup with no change to behavior of hammer_ip_check_directory_empty(). Using existing macro as well as a new macro HAMMER_RECTYPE_ENTRY_START (in the same fashion as HAMMER_RECTYPE_CLEAN_START) makes it easier to understand what this function is doing (just like other functions that use both key_beg/key_end do).
---
sys/vfs/hammer/hammer_disk.h | 1 +
sys/vfs/hammer/hammer_object.c | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/sys/vfs/hammer/hammer_disk.h b/sys/vfs/hammer/hammer_disk.h
index d0fed5a..136aa1c 100644
--- a/sys/vfs/hammer/hammer_disk.h
+++ b/sys/vfs/hammer/hammer_disk.h
@@ -676,6 +676,7 @@ typedef struct hammer_volume_ondisk *hammer_volume_ondisk_t;
#define HAMMER_RECTYPE_MOVED 0x8000 /* special recovery flag */
#define HAMMER_RECTYPE_MAX 0xFFFF
+#define HAMMER_RECTYPE_ENTRY_START (HAMMER_RECTYPE_INODE + 1)
#define HAMMER_RECTYPE_CLEAN_START HAMMER_RECTYPE_EXT
#define HAMMER_FIXKEY_SYMLINK 1
diff --git a/sys/vfs/hammer/hammer_object.c b/sys/vfs/hammer/hammer_object.c
index af83c28..2389192 100644
--- a/sys/vfs/hammer/hammer_object.c
+++ b/sys/vfs/hammer/hammer_object.c
@@ -2640,11 +2640,11 @@ hammer_ip_check_directory_empty(hammer_transaction_t trans, hammer_inode_t ip)
cursor.key_beg.create_tid = 0;
cursor.key_beg.delete_tid = 0;
cursor.key_beg.obj_type = 0;
- cursor.key_beg.rec_type = HAMMER_RECTYPE_INODE + 1;
+ cursor.key_beg.rec_type = HAMMER_RECTYPE_ENTRY_START;
cursor.key_beg.key = HAMMER_MIN_KEY;
cursor.key_end = cursor.key_beg;
- cursor.key_end.rec_type = 0xFFFF;
+ cursor.key_end.rec_type = HAMMER_RECTYPE_MAX;
cursor.key_end.key = HAMMER_MAX_KEY;
cursor.asof = ip->obj_asof;
--
1.7.1

    (1-1/1)