anchor.diff:  
   
   -spec qos_membership(file_meta:uuid() | file_meta:doc()) -> membership().
  -qos_membership(FileUuidOrDoc) ->
  -    case {has_any_qos_entry(FileUuidOrDoc, direct), has_any_qos_entry(FileUuidOrDoc, effective)} of
  -        {true, true} -> ?DIRECT_AND_ANCESTOR_MEMBERSHIP;
  -        {true, false} -> ?DIRECT_MEMBERSHIP;
  -        {false, true} -> ?ANCESTOR_MEMBERSHIP;
  -        {false, false} -> ?NONE_MEMBERSHIP
  -    end.
  -
  -
  -%%--------------------------------------------------------------------
  -%% @doc
  -%% Checks whether given file has any QoS entry (effective or direct).
  -%% @end
  -%%--------------------------------------------------------------------
  --spec has_any_qos_entry(file_meta:uuid() | file_meta:doc(), direct | effective) -> boolean().
  -has_any_qos_entry(#document{key = Uuid}, direct) ->
  -    has_any_qos_entry(fslogic_uuid:ensure_referenced_uuid(Uuid), direct);
  -has_any_qos_entry(Key, direct) ->
  -    has_any_qos_entry(get(Key));
  -has_any_qos_entry(UuidOrDoc, effective) ->
  -    has_any_qos_entry(get_effective(UuidOrDoc)).
  +qos_membership(UuidOrDoc) ->
  +    case {get_direct_qos_entries(UuidOrDoc), get_effective_qos_entries(UuidOrDoc)} of
  +        {[], []} -> ?NONE_MEMBERSHIP;
  +        {[], _} -> ?ANCESTOR_MEMBERSHIP;
  +        {Direct, Effective} -> 
  +            case lists_utils:subtract(Effective, Direct) of
  +                [] -> ?DIRECT_MEMBERSHIP;
  +                _ -> ?DIRECT_AND_ANCESTOR_MEMBERSHIP
  +            end
  +    end.
  +
  +
  +-spec get_direct_qos_entries(file_meta:uuid() | file_meta:doc()) -> [qos_entry:id()].
  +get_direct_qos_entries(#document{key = Uuid}) ->
  +    get_direct_qos_entries(Uuid);
  +get_direct_qos_entries(Uuid) ->
  +    case get(fslogic_uuid:ensure_referenced_uuid(Uuid)) of
  +        {ok, #document{value = #file_qos{qos_entries = QosEntries}}} -> QosEntries;
  +        _ -> []
  +    end.
  +
  +
  +-spec get_effective_qos_entries(file_meta:uuid() | file_meta:doc()) -> [qos_entry:id()].
  +get_effective_qos_entries(UuidOrDoc) -> 
  +    case get_effective(UuidOrDoc) of
  +        {ok, #effective_file_qos{in_trash = true}} -> [];
  +        {ok, #effective_file_qos{qos_entries = QosEntries}} -> QosEntries;
  +        _ -> []
  +    end.
   
   
   %%--------------------------------------------------------------------
  
positive.code:     get_effective/1, 
      add_qos_entry_id/3, add_qos_entry_id/4, remove_qos_entry_id/3,
      is_replica_required_on_storage/2, is_effective_qos_of_file/2,
      qos_membership/1, has_any_qos_entry/2, 
      cleanup_reference_related_documents/1, cleanup_reference_related_documents/2, 
      cleanup_on_no_reference/1,
      delete_associated_entries_on_no_references/1
  
negative.code: 
  
  %% @private
  -spec get_original_parent_doc(undefined | file_ctx:ctx()) -> undefined | file_meta:doc().
  get_original_parent_doc(undefined) -> undefined;
  get_original_parent_doc(OriginalParentCtx) ->
  