sys/vfs/hammer: Use HAMMER_DEF_LOCALIZATION
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Mon, 14 Dec 2015 13:22:36 +0000 (22:22 +0900)
committerTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Mon, 14 Dec 2015 14:21:08 +0000 (23:21 +0900)
for ip localization of root PFS instead of 0.

(see localization arg of hammer_get_inode() for the root inode
of root PFS, which is eventually set to ip->obj_localization,
it doesn't use 0)

sys/vfs/hammer/hammer_inode.c
sys/vfs/hammer/hammer_vnops.c

index 9f1c107..9357b0d 100644 (file)
@@ -337,7 +337,8 @@ hammer_get_vnode(struct hammer_inode *ip, struct vnode **vpp)
                         */
                        if (ip->obj_id == HAMMER_OBJID_ROOT) {
                                if (ip->obj_asof == hmp->asof) {
-                                       if (ip->obj_localization == 0)
+                                       if (ip->obj_localization ==
+                                               HAMMER_DEF_LOCALIZATION)
                                                vsetflags(vp, VROOT);
                                        else
                                                vsetflags(vp, VPFSROOT);
@@ -752,7 +753,7 @@ __hammer_find_inode(hammer_transaction_t trans, int64_t obj_id,
  * returned inode will be referenced.  The inode is created in-memory.
  *
  * If pfsm is non-NULL the caller wishes to create the root inode for
- * a master PFS.
+ * a non-root PFS.
  */
 int
 hammer_create_inode(hammer_transaction_t trans, struct vattr *vap,
@@ -788,7 +789,7 @@ hammer_create_inode(hammer_transaction_t trans, struct vattr *vap,
        trans->flags |= HAMMER_TRANSF_NEWINODE;
 
        if (pfsm) {
-               KKASSERT(pfsm->localization != 0);
+               KKASSERT(pfsm->localization != HAMMER_DEF_LOCALIZATION);
                ip->obj_id = HAMMER_OBJID_ROOT;
                ip->obj_localization = pfsm->localization;
        } else {
index 9378eca..3d9a5af 100644 (file)
@@ -1030,7 +1030,7 @@ hammer_vop_getattr(struct vop_getattr_args *ap)
        if (ip->ino_data.obj_type == HAMMER_OBJTYPE_SOFTLINK &&
            ip->ino_data.size == 10 &&
            ip->obj_asof == HAMMER_MAX_TID &&
-           ip->obj_localization == 0 &&
+           ip->obj_localization == HAMMER_DEF_LOCALIZATION &&
            strncmp(ip->ino_data.ext.symlink, "@@PFS", 5) == 0) {
                    if (ip->pfsm->pfsd.mirror_flags & HAMMER_PFSD_SLAVE)
                            vap->va_size = 26;
@@ -1810,7 +1810,7 @@ hammer_vop_readlink(struct vop_readlink_args *ap)
                bytes = (int)ip->ino_data.size;
                if (bytes == 10 &&
                    ip->obj_asof == HAMMER_MAX_TID &&
-                   ip->obj_localization == 0 &&
+                   ip->obj_localization == HAMMER_DEF_LOCALIZATION &&
                    strncmp(ptr, "@@PFS", 5) == 0) {
                        hammer_simple_transaction(&trans, hmp);
                        bcopy(ptr + 5, buf, 5);