sys/vfs/hammer: Use kuuid_compare() instead of bcmp()
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Sat, 23 Sep 2017 20:43:52 +0000 (23:43 +0300)
committerTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Sun, 24 Sep 2017 09:47:50 +0000 (12:47 +0300)
though kuuid_compare() is probably slower than bcmp() in most cases.
It's not performance critical part anyway.

sys/vfs/hammer/hammer_ondisk.c
sys/vfs/hammer/hammer_vnops.c

index 3619558..c1a2af0 100644 (file)
@@ -214,7 +214,7 @@ hammer_install_volume(hammer_mount_t hmp, const char *volname,
 
        if (RB_EMPTY(&hmp->rb_vols_root)) {
                hmp->fsid = ondisk->vol_fsid;
-       } else if (bcmp(&hmp->fsid, &ondisk->vol_fsid, sizeof(hammer_uuid_t))) {
+       } else if (kuuid_compare(&hmp->fsid, &ondisk->vol_fsid)) {
                hkprintf("volume %s's fsid does not match other volumes\n",
                        volume->vol_name);
                error = EFTYPE;
index 154176d..d91f132 100644 (file)
@@ -2204,10 +2204,8 @@ hammer_vop_setattr(struct vop_setattr_args *ap)
                if (error == 0) {
                        hammer_guid_to_uuid(&uuid_uid, cur_uid);
                        hammer_guid_to_uuid(&uuid_gid, cur_gid);
-                       if (bcmp(&uuid_uid, &ip->ino_data.uid,
-                                sizeof(uuid_uid)) ||
-                           bcmp(&uuid_gid, &ip->ino_data.gid,
-                                sizeof(uuid_gid)) ||
+                       if (kuuid_compare(&uuid_uid, &ip->ino_data.uid) ||
+                           kuuid_compare(&uuid_gid, &ip->ino_data.gid) ||
                            ip->ino_data.mode != cur_mode) {
                                ip->ino_data.uid = uuid_uid;
                                ip->ino_data.gid = uuid_gid;