netfs: Fix gcc-12 warning by embedding vfs inode in netfs_i_context
[sfrench/cifs-2.6.git] / fs / ceph / caps.c
index bf2e9400559842610304e8ad05af28c2e203d12d..38c930384d417dc33ab527546b46fef858d9268d 100644 (file)
@@ -492,7 +492,7 @@ static void __cap_set_timeouts(struct ceph_mds_client *mdsc,
        struct ceph_mount_options *opt = mdsc->fsc->mount_options;
        ci->i_hold_caps_max = round_jiffies(jiffies +
                                            opt->caps_wanted_delay_max * HZ);
-       dout("__cap_set_timeouts %p %lu\n", &ci->vfs_inode,
+       dout("__cap_set_timeouts %p %lu\n", &ci->netfs.inode,
             ci->i_hold_caps_max - jiffies);
 }
 
@@ -507,7 +507,7 @@ static void __cap_set_timeouts(struct ceph_mds_client *mdsc,
 static void __cap_delay_requeue(struct ceph_mds_client *mdsc,
                                struct ceph_inode_info *ci)
 {
-       dout("__cap_delay_requeue %p flags 0x%lx at %lu\n", &ci->vfs_inode,
+       dout("__cap_delay_requeue %p flags 0x%lx at %lu\n", &ci->netfs.inode,
             ci->i_ceph_flags, ci->i_hold_caps_max);
        if (!mdsc->stopping) {
                spin_lock(&mdsc->cap_delay_lock);
@@ -531,7 +531,7 @@ no_change:
 static void __cap_delay_requeue_front(struct ceph_mds_client *mdsc,
                                      struct ceph_inode_info *ci)
 {
-       dout("__cap_delay_requeue_front %p\n", &ci->vfs_inode);
+       dout("__cap_delay_requeue_front %p\n", &ci->netfs.inode);
        spin_lock(&mdsc->cap_delay_lock);
        ci->i_ceph_flags |= CEPH_I_FLUSH;
        if (!list_empty(&ci->i_cap_delay_list))
@@ -548,7 +548,7 @@ static void __cap_delay_requeue_front(struct ceph_mds_client *mdsc,
 static void __cap_delay_cancel(struct ceph_mds_client *mdsc,
                               struct ceph_inode_info *ci)
 {
-       dout("__cap_delay_cancel %p\n", &ci->vfs_inode);
+       dout("__cap_delay_cancel %p\n", &ci->netfs.inode);
        if (list_empty(&ci->i_cap_delay_list))
                return;
        spin_lock(&mdsc->cap_delay_lock);
@@ -568,7 +568,7 @@ static void __check_cap_issue(struct ceph_inode_info *ci, struct ceph_cap *cap,
         * Each time we receive FILE_CACHE anew, we increment
         * i_rdcache_gen.
         */
-       if (S_ISREG(ci->vfs_inode.i_mode) &&
+       if (S_ISREG(ci->netfs.inode.i_mode) &&
            (issued & (CEPH_CAP_FILE_CACHE|CEPH_CAP_FILE_LAZYIO)) &&
            (had & (CEPH_CAP_FILE_CACHE|CEPH_CAP_FILE_LAZYIO)) == 0) {
                ci->i_rdcache_gen++;
@@ -583,14 +583,14 @@ static void __check_cap_issue(struct ceph_inode_info *ci, struct ceph_cap *cap,
        if ((issued & CEPH_CAP_FILE_SHARED) != (had & CEPH_CAP_FILE_SHARED)) {
                if (issued & CEPH_CAP_FILE_SHARED)
                        atomic_inc(&ci->i_shared_gen);
-               if (S_ISDIR(ci->vfs_inode.i_mode)) {
-                       dout(" marking %p NOT complete\n", &ci->vfs_inode);
+               if (S_ISDIR(ci->netfs.inode.i_mode)) {
+                       dout(" marking %p NOT complete\n", &ci->netfs.inode);
                        __ceph_dir_clear_complete(ci);
                }
        }
 
        /* Wipe saved layout if we're losing DIR_CREATE caps */
-       if (S_ISDIR(ci->vfs_inode.i_mode) && (had & CEPH_CAP_DIR_CREATE) &&
+       if (S_ISDIR(ci->netfs.inode.i_mode) && (had & CEPH_CAP_DIR_CREATE) &&
                !(issued & CEPH_CAP_DIR_CREATE)) {
             ceph_put_string(rcu_dereference_raw(ci->i_cached_layout.pool_ns));
             memset(&ci->i_cached_layout, 0, sizeof(ci->i_cached_layout));
@@ -771,7 +771,7 @@ static int __cap_is_valid(struct ceph_cap *cap)
 
        if (cap->cap_gen < gen || time_after_eq(jiffies, ttl)) {
                dout("__cap_is_valid %p cap %p issued %s "
-                    "but STALE (gen %u vs %u)\n", &cap->ci->vfs_inode,
+                    "but STALE (gen %u vs %u)\n", &cap->ci->netfs.inode,
                     cap, ceph_cap_string(cap->issued), cap->cap_gen, gen);
                return 0;
        }
@@ -797,7 +797,7 @@ int __ceph_caps_issued(struct ceph_inode_info *ci, int *implemented)
                if (!__cap_is_valid(cap))
                        continue;
                dout("__ceph_caps_issued %p cap %p issued %s\n",
-                    &ci->vfs_inode, cap, ceph_cap_string(cap->issued));
+                    &ci->netfs.inode, cap, ceph_cap_string(cap->issued));
                have |= cap->issued;
                if (implemented)
                        *implemented |= cap->implemented;
@@ -844,12 +844,12 @@ static void __touch_cap(struct ceph_cap *cap)
 
        spin_lock(&s->s_cap_lock);
        if (!s->s_cap_iterator) {
-               dout("__touch_cap %p cap %p mds%d\n", &cap->ci->vfs_inode, cap,
+               dout("__touch_cap %p cap %p mds%d\n", &cap->ci->netfs.inode, cap,
                     s->s_mds);
                list_move_tail(&cap->session_caps, &s->s_caps);
        } else {
                dout("__touch_cap %p cap %p mds%d NOP, iterating over caps\n",
-                    &cap->ci->vfs_inode, cap, s->s_mds);
+                    &cap->ci->netfs.inode, cap, s->s_mds);
        }
        spin_unlock(&s->s_cap_lock);
 }
@@ -867,7 +867,7 @@ int __ceph_caps_issued_mask(struct ceph_inode_info *ci, int mask, int touch)
 
        if ((have & mask) == mask) {
                dout("__ceph_caps_issued_mask ino 0x%llx snap issued %s"
-                    " (mask %s)\n", ceph_ino(&ci->vfs_inode),
+                    " (mask %s)\n", ceph_ino(&ci->netfs.inode),
                     ceph_cap_string(have),
                     ceph_cap_string(mask));
                return 1;
@@ -879,7 +879,7 @@ int __ceph_caps_issued_mask(struct ceph_inode_info *ci, int mask, int touch)
                        continue;
                if ((cap->issued & mask) == mask) {
                        dout("__ceph_caps_issued_mask ino 0x%llx cap %p issued %s"
-                            " (mask %s)\n", ceph_ino(&ci->vfs_inode), cap,
+                            " (mask %s)\n", ceph_ino(&ci->netfs.inode), cap,
                             ceph_cap_string(cap->issued),
                             ceph_cap_string(mask));
                        if (touch)
@@ -891,7 +891,7 @@ int __ceph_caps_issued_mask(struct ceph_inode_info *ci, int mask, int touch)
                have |= cap->issued;
                if ((have & mask) == mask) {
                        dout("__ceph_caps_issued_mask ino 0x%llx combo issued %s"
-                            " (mask %s)\n", ceph_ino(&ci->vfs_inode),
+                            " (mask %s)\n", ceph_ino(&ci->netfs.inode),
                             ceph_cap_string(cap->issued),
                             ceph_cap_string(mask));
                        if (touch) {
@@ -919,7 +919,7 @@ int __ceph_caps_issued_mask(struct ceph_inode_info *ci, int mask, int touch)
 int __ceph_caps_issued_mask_metric(struct ceph_inode_info *ci, int mask,
                                   int touch)
 {
-       struct ceph_fs_client *fsc = ceph_sb_to_client(ci->vfs_inode.i_sb);
+       struct ceph_fs_client *fsc = ceph_sb_to_client(ci->netfs.inode.i_sb);
        int r;
 
        r = __ceph_caps_issued_mask(ci, mask, touch);
@@ -950,7 +950,7 @@ int __ceph_caps_revoking_other(struct ceph_inode_info *ci,
 
 int ceph_caps_revoking(struct ceph_inode_info *ci, int mask)
 {
-       struct inode *inode = &ci->vfs_inode;
+       struct inode *inode = &ci->netfs.inode;
        int ret;
 
        spin_lock(&ci->i_ceph_lock);
@@ -969,8 +969,8 @@ int __ceph_caps_used(struct ceph_inode_info *ci)
        if (ci->i_rd_ref)
                used |= CEPH_CAP_FILE_RD;
        if (ci->i_rdcache_ref ||
-           (S_ISREG(ci->vfs_inode.i_mode) &&
-            ci->vfs_inode.i_data.nrpages))
+           (S_ISREG(ci->netfs.inode.i_mode) &&
+            ci->netfs.inode.i_data.nrpages))
                used |= CEPH_CAP_FILE_CACHE;
        if (ci->i_wr_ref)
                used |= CEPH_CAP_FILE_WR;
@@ -993,11 +993,11 @@ int __ceph_caps_file_wanted(struct ceph_inode_info *ci)
        const int WR_SHIFT = ffs(CEPH_FILE_MODE_WR);
        const int LAZY_SHIFT = ffs(CEPH_FILE_MODE_LAZY);
        struct ceph_mount_options *opt =
-               ceph_inode_to_client(&ci->vfs_inode)->mount_options;
+               ceph_inode_to_client(&ci->netfs.inode)->mount_options;
        unsigned long used_cutoff = jiffies - opt->caps_wanted_delay_max * HZ;
        unsigned long idle_cutoff = jiffies - opt->caps_wanted_delay_min * HZ;
 
-       if (S_ISDIR(ci->vfs_inode.i_mode)) {
+       if (S_ISDIR(ci->netfs.inode.i_mode)) {
                int want = 0;
 
                /* use used_cutoff here, to keep dir's wanted caps longer */
@@ -1050,7 +1050,7 @@ int __ceph_caps_file_wanted(struct ceph_inode_info *ci)
 int __ceph_caps_wanted(struct ceph_inode_info *ci)
 {
        int w = __ceph_caps_file_wanted(ci) | __ceph_caps_used(ci);
-       if (S_ISDIR(ci->vfs_inode.i_mode)) {
+       if (S_ISDIR(ci->netfs.inode.i_mode)) {
                /* we want EXCL if holding caps of dir ops */
                if (w & CEPH_CAP_ANY_DIR_OPS)
                        w |= CEPH_CAP_FILE_EXCL;
@@ -1116,9 +1116,9 @@ void __ceph_remove_cap(struct ceph_cap *cap, bool queue_release)
 
        lockdep_assert_held(&ci->i_ceph_lock);
 
-       dout("__ceph_remove_cap %p from %p\n", cap, &ci->vfs_inode);
+       dout("__ceph_remove_cap %p from %p\n", cap, &ci->netfs.inode);
 
-       mdsc = ceph_inode_to_client(&ci->vfs_inode)->mdsc;
+       mdsc = ceph_inode_to_client(&ci->netfs.inode)->mdsc;
 
        /* remove from inode's cap rbtree, and clear auth cap */
        rb_erase(&cap->ci_node, &ci->i_caps);
@@ -1169,7 +1169,7 @@ void __ceph_remove_cap(struct ceph_cap *cap, bool queue_release)
                 * keep i_snap_realm.
                 */
                if (ci->i_wr_ref == 0 && ci->i_snap_realm)
-                       ceph_change_snap_realm(&ci->vfs_inode, NULL);
+                       ceph_change_snap_realm(&ci->netfs.inode, NULL);
 
                __cap_delay_cancel(mdsc, ci);
        }
@@ -1188,11 +1188,11 @@ void ceph_remove_cap(struct ceph_cap *cap, bool queue_release)
 
        lockdep_assert_held(&ci->i_ceph_lock);
 
-       fsc = ceph_inode_to_client(&ci->vfs_inode);
+       fsc = ceph_inode_to_client(&ci->netfs.inode);
        WARN_ON_ONCE(ci->i_auth_cap == cap &&
                     !list_empty(&ci->i_dirty_item) &&
                     !fsc->blocklisted &&
-                    !ceph_inode_is_shutdown(&ci->vfs_inode));
+                    !ceph_inode_is_shutdown(&ci->netfs.inode));
 
        __ceph_remove_cap(cap, queue_release);
 }
@@ -1343,7 +1343,7 @@ static void __prep_cap(struct cap_msg_args *arg, struct ceph_cap *cap,
                       int flushing, u64 flush_tid, u64 oldest_flush_tid)
 {
        struct ceph_inode_info *ci = cap->ci;
-       struct inode *inode = &ci->vfs_inode;
+       struct inode *inode = &ci->netfs.inode;
        int held, revoking;
 
        lockdep_assert_held(&ci->i_ceph_lock);
@@ -1440,7 +1440,7 @@ static void __prep_cap(struct cap_msg_args *arg, struct ceph_cap *cap,
 static void __send_cap(struct cap_msg_args *arg, struct ceph_inode_info *ci)
 {
        struct ceph_msg *msg;
-       struct inode *inode = &ci->vfs_inode;
+       struct inode *inode = &ci->netfs.inode;
 
        msg = ceph_msg_new(CEPH_MSG_CLIENT_CAPS, CAP_MSG_SIZE, GFP_NOFS, false);
        if (!msg) {
@@ -1528,7 +1528,7 @@ static void __ceph_flush_snaps(struct ceph_inode_info *ci,
                __releases(ci->i_ceph_lock)
                __acquires(ci->i_ceph_lock)
 {
-       struct inode *inode = &ci->vfs_inode;
+       struct inode *inode = &ci->netfs.inode;
        struct ceph_mds_client *mdsc = session->s_mdsc;
        struct ceph_cap_snap *capsnap;
        u64 oldest_flush_tid = 0;
@@ -1622,7 +1622,7 @@ static void __ceph_flush_snaps(struct ceph_inode_info *ci,
 void ceph_flush_snaps(struct ceph_inode_info *ci,
                      struct ceph_mds_session **psession)
 {
-       struct inode *inode = &ci->vfs_inode;
+       struct inode *inode = &ci->netfs.inode;
        struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc;
        struct ceph_mds_session *session = NULL;
        int mds;
@@ -1682,8 +1682,8 @@ int __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask,
                           struct ceph_cap_flush **pcf)
 {
        struct ceph_mds_client *mdsc =
-               ceph_sb_to_client(ci->vfs_inode.i_sb)->mdsc;
-       struct inode *inode = &ci->vfs_inode;
+               ceph_sb_to_client(ci->netfs.inode.i_sb)->mdsc;
+       struct inode *inode = &ci->netfs.inode;
        int was = ci->i_dirty_caps;
        int dirty = 0;
 
@@ -1696,7 +1696,7 @@ int __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask,
                return 0;
        }
 
-       dout("__mark_dirty_caps %p %s dirty %s -> %s\n", &ci->vfs_inode,
+       dout("__mark_dirty_caps %p %s dirty %s -> %s\n", &ci->netfs.inode,
             ceph_cap_string(mask), ceph_cap_string(was),
             ceph_cap_string(was | mask));
        ci->i_dirty_caps |= mask;
@@ -1712,7 +1712,7 @@ int __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask,
                                ci->i_snap_realm->cached_context);
                }
                dout(" inode %p now dirty snapc %p auth cap %p\n",
-                    &ci->vfs_inode, ci->i_head_snapc, ci->i_auth_cap);
+                    &ci->netfs.inode, ci->i_head_snapc, ci->i_auth_cap);
                BUG_ON(!list_empty(&ci->i_dirty_item));
                spin_lock(&mdsc->cap_dirty_lock);
                list_add(&ci->i_dirty_item, &session->s_cap_dirty);
@@ -1875,7 +1875,7 @@ static int try_nonblocking_invalidate(struct inode *inode)
 
 bool __ceph_should_report_size(struct ceph_inode_info *ci)
 {
-       loff_t size = i_size_read(&ci->vfs_inode);
+       loff_t size = i_size_read(&ci->netfs.inode);
        /* mds will adjust max size according to the reported size */
        if (ci->i_flushing_caps & CEPH_CAP_FILE_WR)
                return false;
@@ -1900,7 +1900,7 @@ bool __ceph_should_report_size(struct ceph_inode_info *ci)
 void ceph_check_caps(struct ceph_inode_info *ci, int flags,
                     struct ceph_mds_session *session)
 {
-       struct inode *inode = &ci->vfs_inode;
+       struct inode *inode = &ci->netfs.inode;
        struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(inode->i_sb);
        struct ceph_cap *cap;
        u64 flush_tid, oldest_flush_tid;
@@ -2467,7 +2467,7 @@ static void __kick_flushing_caps(struct ceph_mds_client *mdsc,
        __releases(ci->i_ceph_lock)
        __acquires(ci->i_ceph_lock)
 {
-       struct inode *inode = &ci->vfs_inode;
+       struct inode *inode = &ci->netfs.inode;
        struct ceph_cap *cap;
        struct ceph_cap_flush *cf;
        int ret;
@@ -2560,7 +2560,7 @@ void ceph_early_kick_flushing_caps(struct ceph_mds_client *mdsc,
                cap = ci->i_auth_cap;
                if (!(cap && cap->session == session)) {
                        pr_err("%p auth cap %p not mds%d ???\n",
-                               &ci->vfs_inode, cap, session->s_mds);
+                               &ci->netfs.inode, cap, session->s_mds);
                        spin_unlock(&ci->i_ceph_lock);
                        continue;
                }
@@ -2610,7 +2610,7 @@ void ceph_kick_flushing_caps(struct ceph_mds_client *mdsc,
                cap = ci->i_auth_cap;
                if (!(cap && cap->session == session)) {
                        pr_err("%p auth cap %p not mds%d ???\n",
-                               &ci->vfs_inode, cap, session->s_mds);
+                               &ci->netfs.inode, cap, session->s_mds);
                        spin_unlock(&ci->i_ceph_lock);
                        continue;
                }
@@ -2630,7 +2630,7 @@ void ceph_kick_flushing_inode_caps(struct ceph_mds_session *session,
 
        lockdep_assert_held(&ci->i_ceph_lock);
 
-       dout("%s %p flushing %s\n", __func__, &ci->vfs_inode,
+       dout("%s %p flushing %s\n", __func__, &ci->netfs.inode,
             ceph_cap_string(ci->i_flushing_caps));
 
        if (!list_empty(&ci->i_cap_flush_list)) {
@@ -2673,10 +2673,10 @@ void ceph_take_cap_refs(struct ceph_inode_info *ci, int got,
        }
        if (got & CEPH_CAP_FILE_BUFFER) {
                if (ci->i_wb_ref == 0)
-                       ihold(&ci->vfs_inode);
+                       ihold(&ci->netfs.inode);
                ci->i_wb_ref++;
                dout("%s %p wb %d -> %d (?)\n", __func__,
-                    &ci->vfs_inode, ci->i_wb_ref-1, ci->i_wb_ref);
+                    &ci->netfs.inode, ci->i_wb_ref-1, ci->i_wb_ref);
        }
 }
 
@@ -3004,7 +3004,7 @@ int ceph_get_caps(struct file *filp, int need, int want, loff_t endoff, int *got
                        return ret;
                }
 
-               if (S_ISREG(ci->vfs_inode.i_mode) &&
+               if (S_ISREG(ci->netfs.inode.i_mode) &&
                    ci->i_inline_version != CEPH_INLINE_NONE &&
                    (_got & (CEPH_CAP_FILE_CACHE|CEPH_CAP_FILE_LAZYIO)) &&
                    i_size_read(inode) > 0) {
@@ -3094,7 +3094,7 @@ enum put_cap_refs_mode {
 static void __ceph_put_cap_refs(struct ceph_inode_info *ci, int had,
                                enum put_cap_refs_mode mode)
 {
-       struct inode *inode = &ci->vfs_inode;
+       struct inode *inode = &ci->netfs.inode;
        int last = 0, put = 0, flushsnaps = 0, wake = 0;
        bool check_flushsnaps = false;
 
@@ -3202,7 +3202,7 @@ void ceph_put_cap_refs_no_check_caps(struct ceph_inode_info *ci, int had)
 void ceph_put_wrbuffer_cap_refs(struct ceph_inode_info *ci, int nr,
                                struct ceph_snap_context *snapc)
 {
-       struct inode *inode = &ci->vfs_inode;
+       struct inode *inode = &ci->netfs.inode;
        struct ceph_cap_snap *capsnap = NULL, *iter;
        int put = 0;
        bool last = false;
@@ -3698,7 +3698,7 @@ static void handle_cap_flush_ack(struct inode *inode, u64 flush_tid,
                                     session->s_mds,
                                     &list_first_entry(&session->s_cap_flushing,
                                                struct ceph_inode_info,
-                                               i_flushing_item)->vfs_inode);
+                                               i_flushing_item)->netfs.inode);
                        }
                }
                mdsc->num_cap_flushing--;
@@ -4345,7 +4345,7 @@ unsigned long ceph_check_delayed_caps(struct ceph_mds_client *mdsc)
                        break;
                list_del_init(&ci->i_cap_delay_list);
 
-               inode = igrab(&ci->vfs_inode);
+               inode = igrab(&ci->netfs.inode);
                if (inode) {
                        spin_unlock(&mdsc->cap_delay_lock);
                        dout("check_delayed_caps on %p\n", inode);
@@ -4373,7 +4373,7 @@ static void flush_dirty_session_caps(struct ceph_mds_session *s)
        while (!list_empty(&s->s_cap_dirty)) {
                ci = list_first_entry(&s->s_cap_dirty, struct ceph_inode_info,
                                      i_dirty_item);
-               inode = &ci->vfs_inode;
+               inode = &ci->netfs.inode;
                ihold(inode);
                dout("flush_dirty_caps %llx.%llx\n", ceph_vinop(inode));
                spin_unlock(&mdsc->cap_dirty_lock);
@@ -4407,7 +4407,7 @@ void __ceph_touch_fmode(struct ceph_inode_info *ci,
 
 void ceph_get_fmode(struct ceph_inode_info *ci, int fmode, int count)
 {
-       struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(ci->vfs_inode.i_sb);
+       struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(ci->netfs.inode.i_sb);
        int bits = (fmode << 1) | 1;
        bool already_opened = false;
        int i;
@@ -4441,7 +4441,7 @@ void ceph_get_fmode(struct ceph_inode_info *ci, int fmode, int count)
  */
 void ceph_put_fmode(struct ceph_inode_info *ci, int fmode, int count)
 {
-       struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(ci->vfs_inode.i_sb);
+       struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(ci->netfs.inode.i_sb);
        int bits = (fmode << 1) | 1;
        bool is_closed = true;
        int i;
@@ -4656,7 +4656,7 @@ int ceph_purge_inode_cap(struct inode *inode, struct ceph_cap *cap, bool *invali
        lockdep_assert_held(&ci->i_ceph_lock);
 
        dout("removing cap %p, ci is %p, inode is %p\n",
-            cap, ci, &ci->vfs_inode);
+            cap, ci, &ci->netfs.inode);
 
        is_auth = (cap == ci->i_auth_cap);
        __ceph_remove_cap(cap, false);