+void __osd_xattr_declare_set(const struct lu_env *env, struct osd_object *obj,
+ int vallen, const char *name, struct osd_thandle *oh);
+int __osd_sa_xattr_set(const struct lu_env *env, struct osd_object *obj,
+ const struct lu_buf *buf, const char *name, int fl,
+ struct osd_thandle *oh);;
+int __osd_xattr_set(const struct lu_env *env, struct osd_object *obj,
+ const struct lu_buf *buf, const char *name, int fl,
+ struct osd_thandle *oh);
+static inline int
+osd_xattr_set_internal(const struct lu_env *env, struct osd_object *obj,
+ const struct lu_buf *buf, const char *name, int fl,
+ struct osd_thandle *oh, struct lustre_capa *capa)
+{
+ int rc;
+
+ if (osd_obj2dev(obj)->od_xattr_in_sa) {
+ rc = __osd_sa_xattr_set(env, obj, buf, name, fl, oh);
+ if (rc == -EFBIG)
+ rc = __osd_xattr_set(env, obj, buf, name, fl, oh);
+ } else {
+ rc = __osd_xattr_set(env, obj, buf, name, fl, oh);
+ }
+
+ return rc;
+}
+
+static inline uint64_t attrs_fs2zfs(const uint32_t flags)
+{
+ return (((flags & FS_APPEND_FL) ? ZFS_APPENDONLY : 0) |
+ ((flags & FS_NODUMP_FL) ? ZFS_NODUMP : 0) |
+ ((flags & FS_IMMUTABLE_FL) ? ZFS_IMMUTABLE : 0));
+}
+
+static inline uint32_t attrs_zfs2fs(const uint64_t flags)
+{
+ return (((flags & ZFS_APPENDONLY) ? FS_APPEND_FL : 0) |
+ ((flags & ZFS_NODUMP) ? FS_NODUMP_FL : 0) |
+ ((flags & ZFS_IMMUTABLE) ? FS_IMMUTABLE_FL : 0));
+}