/*
         * If for some unexpected reason the last item's index is not greater
-        * than the last index we logged, warn and return an error to fallback
-        * to a transaction commit.
+        * than the last index we logged, warn and force a transaction commit.
         */
        if (WARN_ON(last_index <= inode->last_dir_index_offset))
-               ret = -EUCLEAN;
+               ret = BTRFS_LOG_FORCE_COMMIT;
        else
                inode->last_dir_index_offset = last_index;
 out:
         * LOG_INODE_EXISTS mode) and slow down other fsyncs or transaction
         * commits.
         */
-       if (ctx->num_conflict_inodes >= MAX_CONFLICT_INODES) {
-               btrfs_set_log_full_commit(trans);
+       if (ctx->num_conflict_inodes >= MAX_CONFLICT_INODES)
                return BTRFS_LOG_FORCE_COMMIT;
-       }
 
        inode = btrfs_iget(root->fs_info->sb, ino, root);
        /*
         * result in losing the file after a log replay.
         */
        if (full_dir_logging && inode->last_unlink_trans >= trans->transid) {
-               btrfs_set_log_full_commit(trans);
                ret = BTRFS_LOG_FORCE_COMMIT;
                goto out_unlock;
        }
 
 /* return value for btrfs_log_dentry_safe that means we don't need to log it at all */
 #define BTRFS_NO_LOG_SYNC 256
 
-/* We can't use the tree log for whatever reason, force a transaction commit */
-#define BTRFS_LOG_FORCE_COMMIT                         (1)
+/*
+ * We can't use the tree log for whatever reason, force a transaction commit.
+ * We use a negative value because there are functions through the logging code
+ * that need to return an error (< 0 value), false (0) or true (1). Any negative
+ * value will do, as it will cause the log to be marked for a full sync.
+ */
+#define BTRFS_LOG_FORCE_COMMIT                         (-(MAX_ERRNO + 1))
 
 struct btrfs_log_ctx {
        int log_ret;