__u32 test_mask, user_mask = FANOTIFY_OUTGOING_EVENTS |
                                     FANOTIFY_EVENT_FLAGS;
        const struct path *path = fsnotify_data_path(data, data_type);
+       unsigned int fid_mode = FAN_GROUP_FLAG(group, FANOTIFY_FID_BITS);
        struct fsnotify_mark *mark;
        int type;
 
        pr_debug("%s: report_mask=%x mask=%x data=%p data_type=%d\n",
                 __func__, iter_info->report_mask, event_mask, data, data_type);
 
-       if (!FAN_GROUP_FLAG(group, FAN_REPORT_FID)) {
+       if (!fid_mode) {
                /* Do we have path to open a file descriptor? */
                if (!path)
                        return 0;
         * fanotify_alloc_event() when group is reporting fid as indication
         * that event happened on child.
         */
-       if (FAN_GROUP_FLAG(group, FAN_REPORT_FID)) {
+       if (fid_mode) {
                /* Do not report event flags without any event */
                if (!(test_mask & ~FANOTIFY_EVENT_FLAGS))
                        return 0;
        gfp_t gfp = GFP_KERNEL_ACCOUNT;
        struct inode *id = fanotify_fid_inode(mask, data, data_type, dir);
        const struct path *path = fsnotify_data_path(data, data_type);
+       unsigned int fid_mode = FAN_GROUP_FLAG(group, FANOTIFY_FID_BITS);
        bool name_event = false;
 
        /*
                event = fanotify_alloc_perm_event(path, gfp);
        } else if (name_event && file_name) {
                event = fanotify_alloc_name_event(id, fsid, file_name, gfp);
-       } else if (FAN_GROUP_FLAG(group, FAN_REPORT_FID)) {
+       } else if (fid_mode) {
                event = fanotify_alloc_fid_event(id, fsid, gfp);
        } else {
                event = fanotify_alloc_path_event(path, gfp);
                        return 0;
        }
 
-       if (FAN_GROUP_FLAG(group, FAN_REPORT_FID)) {
+       if (FAN_GROUP_FLAG(group, FANOTIFY_FID_BITS)) {
                fsid = fanotify_get_fsid(iter_info);
                /* Racing with mark destruction or creation? */
                if (!fsid.val[0] && !fsid.val[1])
 
        if (fsnotify_notify_queue_is_empty(group))
                goto out;
 
-       if (FAN_GROUP_FLAG(group, FAN_REPORT_FID)) {
+       if (FAN_GROUP_FLAG(group, FANOTIFY_FID_BITS)) {
                event_size += fanotify_event_info_len(
                        FANOTIFY_E(fsnotify_peek_first_event(group)));
        }
                return -EINVAL;
        }
 
-       if ((flags & FAN_REPORT_FID) &&
+       if ((flags & FANOTIFY_FID_BITS) &&
            (flags & FANOTIFY_CLASS_BITS) != FAN_CLASS_NOTIF)
                return -EINVAL;
 
        __kernel_fsid_t __fsid, *fsid = NULL;
        u32 valid_mask = FANOTIFY_EVENTS | FANOTIFY_EVENT_FLAGS;
        unsigned int mark_type = flags & FANOTIFY_MARK_TYPE_BITS;
-       unsigned int obj_type;
+       unsigned int obj_type, fid_mode;
        int ret;
 
        pr_debug("%s: fanotify_fd=%d flags=%x dfd=%d pathname=%p mask=%llx\n",
         * inode events are not supported on a mount mark, because they do not
         * carry enough information (i.e. path) to be filtered by mount point.
         */
+       fid_mode = FAN_GROUP_FLAG(group, FANOTIFY_FID_BITS);
        if (mask & FANOTIFY_INODE_EVENTS &&
-           (!FAN_GROUP_FLAG(group, FAN_REPORT_FID) ||
-            mark_type == FAN_MARK_MOUNT))
+           (!fid_mode || mark_type == FAN_MARK_MOUNT))
                goto fput_and_out;
 
        if (flags & FAN_MARK_FLUSH) {
                        goto path_put_and_out;
        }
 
-       if (FAN_GROUP_FLAG(group, FAN_REPORT_FID)) {
+       if (fid_mode) {
                ret = fanotify_test_fid(&path, &__fsid);
                if (ret)
                        goto path_put_and_out;
 
 #define FANOTIFY_CLASS_BITS    (FAN_CLASS_NOTIF | FAN_CLASS_CONTENT | \
                                 FAN_CLASS_PRE_CONTENT)
 
-#define FANOTIFY_INIT_FLAGS    (FANOTIFY_CLASS_BITS | \
-                                FAN_REPORT_TID | FAN_REPORT_FID | \
+#define FANOTIFY_FID_BITS      (FAN_REPORT_FID)
+
+#define FANOTIFY_INIT_FLAGS    (FANOTIFY_CLASS_BITS | FANOTIFY_FID_BITS | \
+                                FAN_REPORT_TID | \
                                 FAN_CLOEXEC | FAN_NONBLOCK | \
                                 FAN_UNLIMITED_QUEUE | FAN_UNLIMITED_MARKS)