hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/fs/gfs2/incore.h
....@@ -1,10 +1,7 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
34 * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
4
- *
5
- * This copyrighted material is made available to anyone wishing to use,
6
- * modify, copy, or redistribute it subject to the terms and conditions
7
- * of the GNU General Public License version 2.
85 */
96
107 #ifndef __INCORE_DOT_H__
....@@ -44,6 +41,10 @@
4441 u32 lh_flags; /* GFS2_LOG_HEAD_... */
4542 u32 lh_tail; /* Block number of log tail */
4643 u32 lh_blkno;
44
+
45
+ s64 lh_local_total;
46
+ s64 lh_local_free;
47
+ s64 lh_local_dinodes;
4748 };
4849
4950 /*
....@@ -92,7 +93,7 @@
9293 unsigned long bi_flags;
9394 u32 bi_offset;
9495 u32 bi_start;
95
- u32 bi_len;
96
+ u32 bi_bytes;
9697 u32 bi_blocks;
9798 };
9899
....@@ -165,7 +166,6 @@
165166 u64 bd_blkno;
166167
167168 struct list_head bd_list;
168
- const struct gfs2_log_operations *bd_ops;
169169
170170 struct gfs2_trans *bd_tr;
171171 struct list_head bd_ail_st_list;
....@@ -238,19 +238,22 @@
238238
239239
240240 struct gfs2_glock_operations {
241
- void (*go_sync) (struct gfs2_glock *gl);
241
+ int (*go_sync) (struct gfs2_glock *gl);
242242 int (*go_xmote_bh) (struct gfs2_glock *gl, struct gfs2_holder *gh);
243243 void (*go_inval) (struct gfs2_glock *gl, int flags);
244244 int (*go_demote_ok) (const struct gfs2_glock *gl);
245245 int (*go_lock) (struct gfs2_holder *gh);
246
- void (*go_unlock) (struct gfs2_holder *gh);
247
- void (*go_dump)(struct seq_file *seq, const struct gfs2_glock *gl);
246
+ void (*go_dump)(struct seq_file *seq, struct gfs2_glock *gl,
247
+ const char *fs_id_buf);
248248 void (*go_callback)(struct gfs2_glock *gl, bool remote);
249
+ void (*go_free)(struct gfs2_glock *gl);
250
+ const int go_subclass;
249251 const int go_type;
250252 const unsigned long go_flags;
251
-#define GLOF_ASPACE 1
252
-#define GLOF_LVB 2
253
-#define GLOF_LRU 4
253
+#define GLOF_ASPACE 1 /* address space attached */
254
+#define GLOF_LVB 2 /* Lock Value Block attached */
255
+#define GLOF_LRU 4 /* LRU managed */
256
+#define GLOF_NONDISK 8 /* not I/O related */
254257 };
255258
256259 enum {
....@@ -297,6 +300,7 @@
297300 struct gfs2_quota_data *qa_qd[2 * GFS2_MAXQUOTAS];
298301 struct gfs2_holder qa_qd_ghs[2 * GFS2_MAXQUOTAS];
299302 unsigned int qa_qd_num;
303
+ int qa_ref;
300304 };
301305
302306 /* Resource group multi-block reservation, in order of appearance:
....@@ -309,10 +313,6 @@
309313 */
310314
311315 struct gfs2_blkreserv {
312
- /* components used during write (step 1): */
313
- atomic_t rs_sizehint; /* hint of the write size */
314
-
315
- struct gfs2_holder rs_rgd_gh; /* Filled in by get_local_rgrp */
316316 struct rb_node rs_node; /* link to other block reservations */
317317 struct gfs2_rbm rs_rbm; /* Start of reservation */
318318 u32 rs_free; /* how many blocks are still free */
....@@ -345,11 +345,12 @@
345345 GLF_REPLY_PENDING = 9,
346346 GLF_INITIAL = 10,
347347 GLF_FROZEN = 11,
348
- GLF_QUEUED = 12,
349348 GLF_LRU = 13,
350349 GLF_OBJECT = 14, /* Used only for tracing */
351350 GLF_BLOCKING = 15,
352351 GLF_INODE_CREATING = 16, /* Inode creation occurring */
352
+ GLF_PENDING_DELETE = 17,
353
+ GLF_FREEING = 18, /* Wait for glock to be freed */
353354 };
354355
355356 struct gfs2_glock {
....@@ -381,29 +382,23 @@
381382 atomic_t gl_ail_count;
382383 atomic_t gl_revokes;
383384 struct delayed_work gl_work;
384
- union {
385
- /* For inode and iopen glocks only */
386
- struct work_struct gl_delete;
387
- /* For rgrp glocks only */
388
- struct {
389
- loff_t start;
390
- loff_t end;
391
- } gl_vm;
385
+ /* For iopen glocks only */
386
+ struct {
387
+ struct delayed_work gl_delete;
388
+ u64 gl_no_formal_ino;
392389 };
393390 struct rcu_head gl_rcu;
394391 struct rhash_head gl_node;
395392 };
396
-
397
-#define GFS2_MIN_LVB_SIZE 32 /* Min size of LVB that gfs2 supports */
398393
399394 enum {
400395 GIF_INVALID = 0,
401396 GIF_QD_LOCKED = 1,
402397 GIF_ALLOC_FAILED = 2,
403398 GIF_SW_PAGED = 3,
404
- GIF_ORDERED = 4,
405399 GIF_FREE_VFS_INODE = 5,
406400 GIF_GLOP_PENDING = 6,
401
+ GIF_DEFERRED_DELETE = 7,
407402 };
408403
409404 struct gfs2_inode {
....@@ -417,8 +412,10 @@
417412 struct gfs2_holder i_iopen_gh;
418413 struct gfs2_holder i_gh; /* for prepare/commit_write only */
419414 struct gfs2_qadata *i_qadata; /* quota allocation data */
415
+ struct gfs2_holder i_rgd_gh;
420416 struct gfs2_blkreserv i_res; /* rgrp multi-block reservation */
421417 u64 i_goal; /* goal block for allocations */
418
+ atomic_t i_sizehint; /* hint of the write size */
422419 struct rw_semaphore i_rw_mutex;
423420 struct list_head i_ordered;
424421 struct list_head i_trunc_list;
....@@ -538,7 +535,7 @@
538535 unsigned long jd_flags;
539536 #define JDF_RECOVERY 1
540537 unsigned int jd_jid;
541
- unsigned int jd_blocks;
538
+ u32 jd_blocks;
542539 int jd_recover_error;
543540 /* Replay stuff */
544541
....@@ -549,6 +546,7 @@
549546 struct list_head jd_revoke_list;
550547 unsigned int jd_replay_tail;
551548
549
+ u64 jd_no_addr;
552550 };
553551
554552 struct gfs2_statfs_change_host {
....@@ -590,10 +588,10 @@
590588 unsigned int ar_rgrplvb:1; /* use lvbs for rgrp info */
591589 unsigned int ar_loccookie:1; /* use location based readdir
592590 cookies */
593
- int ar_commit; /* Commit interval */
594
- int ar_statfs_quantum; /* The fast statfs interval */
595
- int ar_quota_quantum; /* The quota interval */
596
- int ar_statfs_percent; /* The % change to force sync */
591
+ s32 ar_commit; /* Commit interval */
592
+ s32 ar_statfs_quantum; /* The fast statfs interval */
593
+ s32 ar_quota_quantum; /* The quota interval */
594
+ s32 ar_statfs_percent; /* The % change to force sync */
597595 };
598596
599597 struct gfs2_tune {
....@@ -615,7 +613,7 @@
615613 enum {
616614 SDF_JOURNAL_CHECKED = 0,
617615 SDF_JOURNAL_LIVE = 1,
618
- SDF_SHUTDOWN = 2,
616
+ SDF_WITHDRAWN = 2,
619617 SDF_NOBARRIERS = 3,
620618 SDF_NORECOVERY = 4,
621619 SDF_DEMOTE = 5,
....@@ -623,7 +621,12 @@
623621 SDF_RORECOVERY = 7, /* read only recovery */
624622 SDF_SKIP_DLM_UNLOCK = 8,
625623 SDF_FORCE_AIL_FLUSH = 9,
626
- SDF_AIL1_IO_ERROR = 10,
624
+ SDF_FS_FROZEN = 10,
625
+ SDF_WITHDRAWING = 11, /* Will withdraw eventually */
626
+ SDF_WITHDRAW_IN_PROG = 12, /* Withdraw is in progress */
627
+ SDF_REMOTE_WITHDRAW = 13, /* Performing remote recovery */
628
+ SDF_WITHDRAW_RECOVERY = 14, /* Wait for journal recovery when we are
629
+ withdrawing */
627630 };
628631
629632 enum gfs2_freeze_state {
....@@ -695,10 +698,18 @@
695698 struct gfs2_lkstats lkstats[10];
696699 };
697700
701
+/* List of local (per node) statfs inodes */
702
+struct local_statfs_inode {
703
+ struct list_head si_list;
704
+ struct inode *si_sc_inode;
705
+ unsigned int si_jid; /* journal id this statfs inode corresponds to */
706
+};
707
+
698708 struct gfs2_sbd {
699709 struct super_block *sd_vfs;
700710 struct gfs2_pcpu_lkstats __percpu *sd_lkstats;
701711 struct kobject sd_kobj;
712
+ struct completion sd_kobj_unregister;
702713 unsigned long sd_flags; /* SDF_... */
703714 struct gfs2_sb_host sd_sb;
704715
....@@ -708,6 +719,7 @@
708719 u32 sd_fsb2bb_shift;
709720 u32 sd_diptrs; /* Number of pointers in a dinode */
710721 u32 sd_inptrs; /* Number of pointers in a indirect block */
722
+ u32 sd_ldptrs; /* Number of pointers in a log descriptor block */
711723 u32 sd_jbsize; /* Size of a journaled data block */
712724 u32 sd_hash_bsize; /* sizeof(exhash block) */
713725 u32 sd_hash_bsize_shift;
....@@ -730,6 +742,7 @@
730742 struct gfs2_glock *sd_freeze_gl;
731743 struct work_struct sd_freeze_work;
732744 wait_queue_head_t sd_glock_wait;
745
+ wait_queue_head_t sd_async_glock_wait;
733746 atomic_t sd_glock_disposal;
734747 struct completion sd_locking_init;
735748 struct completion sd_wdack;
....@@ -743,6 +756,7 @@
743756 struct inode *sd_jindex;
744757 struct inode *sd_statfs_inode;
745758 struct inode *sd_sc_inode;
759
+ struct list_head sd_sc_inodes_list;
746760 struct inode *sd_qc_inode;
747761 struct inode *sd_rindex;
748762 struct inode *sd_quota_inode;
....@@ -772,6 +786,7 @@
772786 struct gfs2_jdesc *sd_jdesc;
773787 struct gfs2_holder sd_journal_gh;
774788 struct gfs2_holder sd_jinode_gh;
789
+ struct gfs2_glock *sd_jinode_gl;
775790
776791 struct gfs2_holder sd_sc_gh;
777792 struct gfs2_holder sd_qc_gh;
....@@ -807,13 +822,13 @@
807822
808823 struct gfs2_trans *sd_log_tr;
809824 unsigned int sd_log_blks_reserved;
810
- int sd_log_commited_revoke;
825
+ int sd_log_committed_revoke;
811826
812827 atomic_t sd_log_pinned;
813828 unsigned int sd_log_num_revoke;
814829
815
- struct list_head sd_log_le_revoke;
816
- struct list_head sd_log_le_ordered;
830
+ struct list_head sd_log_revokes;
831
+ struct list_head sd_log_ordered;
817832 spinlock_t sd_ordered_lock;
818833
819834 atomic_t sd_log_thresh1;
....@@ -832,7 +847,8 @@
832847 atomic_t sd_log_in_flight;
833848 struct bio *sd_log_bio;
834849 wait_queue_head_t sd_log_flush_wait;
835
- int sd_log_error;
850
+ int sd_log_error; /* First log error */
851
+ wait_queue_head_t sd_withdraw_wait;
836852
837853 atomic_t sd_reserving_log;
838854 wait_queue_head_t sd_reserving_log_wait;
....@@ -856,9 +872,7 @@
856872
857873 unsigned long sd_last_warning;
858874 struct dentry *debugfs_dir; /* debugfs directory */
859
- struct dentry *debugfs_dentry_glocks;
860
- struct dentry *debugfs_dentry_glstats;
861
- struct dentry *debugfs_dentry_sbstats;
875
+ unsigned long sd_glock_dqs_held;
862876 };
863877
864878 static inline void gfs2_glstats_inc(struct gfs2_glock *gl, int which)