ahrens commented on this pull request.


> @@ -409,6 +489,26 @@ _NOTE(CONSTCOND) } while (0)
 #define        BP_GET_LEVEL(bp)                BF64_GET((bp)->blk_prop, 56, 5)
 #define        BP_SET_LEVEL(bp, x)             BF64_SET((bp)->blk_prop, 56, 5, 
x)
 
+/* encrypted, authenticated, and MAC cksum bps use the same bit */
+#define        BP_USES_CRYPT(bp)               BF64_GET((bp)->blk_prop, 61, 1)
+#define        BP_SET_CRYPT(bp, x)             BF64_SET((bp)->blk_prop, 61, 1, 
x)
+
+#define        BP_IS_ENCRYPTED(bp)                     \
+       (BP_USES_CRYPT(bp) &&                   \
+       BP_GET_LEVEL(bp) == 0 &&                \

The ZoL version has `<= 0`.  That said, I think that BP_GET_LEVEL() will result 
in an unsigned value, so it can never be <0.  And the BP_GET_LEVEL() is never 
negative-ish (`ZB_ZIL_LEVEL` and `ZB_ROOT_LEVEL` are not used here, those block 
types have BP_GET_LEVEL()==0).  So I think we should change ZoL to use `==` 
here, @tcaputi.

> @@ -409,6 +489,26 @@ _NOTE(CONSTCOND) } while (0)
 #define        BP_GET_LEVEL(bp)                BF64_GET((bp)->blk_prop, 56, 5)
 #define        BP_SET_LEVEL(bp, x)             BF64_SET((bp)->blk_prop, 56, 5, 
x)
 
+/* encrypted, authenticated, and MAC cksum bps use the same bit */
+#define        BP_USES_CRYPT(bp)               BF64_GET((bp)->blk_prop, 61, 1)
+#define        BP_SET_CRYPT(bp, x)             BF64_SET((bp)->blk_prop, 61, 1, 
x)
+
+#define        BP_IS_ENCRYPTED(bp)                     \
+       (BP_USES_CRYPT(bp) &&                   \
+       BP_GET_LEVEL(bp) == 0 &&                \
+       DMU_OT_IS_ENCRYPTED(BP_GET_TYPE(bp)))
+
+#define        BP_IS_AUTHENTICATED(bp)                 \
+       (BP_USES_CRYPT(bp) &&                   \
+       BP_GET_LEVEL(bp) <= 0 &&                \

I think we should also change this to `==` (here and in ZoL, @tcaputi)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openzfs/openzfs/pull/489#pullrequestreview-109527189
------------------------------------------
openzfs: openzfs-developer
Permalink: 
https://openzfs.topicbox.com/groups/developer/discussions/T91797982fdd5b7d9-Mc4c72b4ee296249d833a672b
Delivery options: https://openzfs.topicbox.com/groups

Reply via email to