.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. |
---|
3 | 4 | * 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. |
---|
8 | 5 | */ |
---|
9 | 6 | |
---|
10 | 7 | #ifndef __INCORE_DOT_H__ |
---|
.. | .. |
---|
44 | 41 | u32 lh_flags; /* GFS2_LOG_HEAD_... */ |
---|
45 | 42 | u32 lh_tail; /* Block number of log tail */ |
---|
46 | 43 | u32 lh_blkno; |
---|
| 44 | + |
---|
| 45 | + s64 lh_local_total; |
---|
| 46 | + s64 lh_local_free; |
---|
| 47 | + s64 lh_local_dinodes; |
---|
47 | 48 | }; |
---|
48 | 49 | |
---|
49 | 50 | /* |
---|
.. | .. |
---|
92 | 93 | unsigned long bi_flags; |
---|
93 | 94 | u32 bi_offset; |
---|
94 | 95 | u32 bi_start; |
---|
95 | | - u32 bi_len; |
---|
| 96 | + u32 bi_bytes; |
---|
96 | 97 | u32 bi_blocks; |
---|
97 | 98 | }; |
---|
98 | 99 | |
---|
.. | .. |
---|
165 | 166 | u64 bd_blkno; |
---|
166 | 167 | |
---|
167 | 168 | struct list_head bd_list; |
---|
168 | | - const struct gfs2_log_operations *bd_ops; |
---|
169 | 169 | |
---|
170 | 170 | struct gfs2_trans *bd_tr; |
---|
171 | 171 | struct list_head bd_ail_st_list; |
---|
.. | .. |
---|
238 | 238 | |
---|
239 | 239 | |
---|
240 | 240 | struct gfs2_glock_operations { |
---|
241 | | - void (*go_sync) (struct gfs2_glock *gl); |
---|
| 241 | + int (*go_sync) (struct gfs2_glock *gl); |
---|
242 | 242 | int (*go_xmote_bh) (struct gfs2_glock *gl, struct gfs2_holder *gh); |
---|
243 | 243 | void (*go_inval) (struct gfs2_glock *gl, int flags); |
---|
244 | 244 | int (*go_demote_ok) (const struct gfs2_glock *gl); |
---|
245 | 245 | 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); |
---|
248 | 248 | void (*go_callback)(struct gfs2_glock *gl, bool remote); |
---|
| 249 | + void (*go_free)(struct gfs2_glock *gl); |
---|
| 250 | + const int go_subclass; |
---|
249 | 251 | const int go_type; |
---|
250 | 252 | 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 */ |
---|
254 | 257 | }; |
---|
255 | 258 | |
---|
256 | 259 | enum { |
---|
.. | .. |
---|
297 | 300 | struct gfs2_quota_data *qa_qd[2 * GFS2_MAXQUOTAS]; |
---|
298 | 301 | struct gfs2_holder qa_qd_ghs[2 * GFS2_MAXQUOTAS]; |
---|
299 | 302 | unsigned int qa_qd_num; |
---|
| 303 | + int qa_ref; |
---|
300 | 304 | }; |
---|
301 | 305 | |
---|
302 | 306 | /* Resource group multi-block reservation, in order of appearance: |
---|
.. | .. |
---|
309 | 313 | */ |
---|
310 | 314 | |
---|
311 | 315 | 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 */ |
---|
316 | 316 | struct rb_node rs_node; /* link to other block reservations */ |
---|
317 | 317 | struct gfs2_rbm rs_rbm; /* Start of reservation */ |
---|
318 | 318 | u32 rs_free; /* how many blocks are still free */ |
---|
.. | .. |
---|
345 | 345 | GLF_REPLY_PENDING = 9, |
---|
346 | 346 | GLF_INITIAL = 10, |
---|
347 | 347 | GLF_FROZEN = 11, |
---|
348 | | - GLF_QUEUED = 12, |
---|
349 | 348 | GLF_LRU = 13, |
---|
350 | 349 | GLF_OBJECT = 14, /* Used only for tracing */ |
---|
351 | 350 | GLF_BLOCKING = 15, |
---|
352 | 351 | GLF_INODE_CREATING = 16, /* Inode creation occurring */ |
---|
| 352 | + GLF_PENDING_DELETE = 17, |
---|
| 353 | + GLF_FREEING = 18, /* Wait for glock to be freed */ |
---|
353 | 354 | }; |
---|
354 | 355 | |
---|
355 | 356 | struct gfs2_glock { |
---|
.. | .. |
---|
381 | 382 | atomic_t gl_ail_count; |
---|
382 | 383 | atomic_t gl_revokes; |
---|
383 | 384 | 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; |
---|
392 | 389 | }; |
---|
393 | 390 | struct rcu_head gl_rcu; |
---|
394 | 391 | struct rhash_head gl_node; |
---|
395 | 392 | }; |
---|
396 | | - |
---|
397 | | -#define GFS2_MIN_LVB_SIZE 32 /* Min size of LVB that gfs2 supports */ |
---|
398 | 393 | |
---|
399 | 394 | enum { |
---|
400 | 395 | GIF_INVALID = 0, |
---|
401 | 396 | GIF_QD_LOCKED = 1, |
---|
402 | 397 | GIF_ALLOC_FAILED = 2, |
---|
403 | 398 | GIF_SW_PAGED = 3, |
---|
404 | | - GIF_ORDERED = 4, |
---|
405 | 399 | GIF_FREE_VFS_INODE = 5, |
---|
406 | 400 | GIF_GLOP_PENDING = 6, |
---|
| 401 | + GIF_DEFERRED_DELETE = 7, |
---|
407 | 402 | }; |
---|
408 | 403 | |
---|
409 | 404 | struct gfs2_inode { |
---|
.. | .. |
---|
417 | 412 | struct gfs2_holder i_iopen_gh; |
---|
418 | 413 | struct gfs2_holder i_gh; /* for prepare/commit_write only */ |
---|
419 | 414 | struct gfs2_qadata *i_qadata; /* quota allocation data */ |
---|
| 415 | + struct gfs2_holder i_rgd_gh; |
---|
420 | 416 | struct gfs2_blkreserv i_res; /* rgrp multi-block reservation */ |
---|
421 | 417 | u64 i_goal; /* goal block for allocations */ |
---|
| 418 | + atomic_t i_sizehint; /* hint of the write size */ |
---|
422 | 419 | struct rw_semaphore i_rw_mutex; |
---|
423 | 420 | struct list_head i_ordered; |
---|
424 | 421 | struct list_head i_trunc_list; |
---|
.. | .. |
---|
538 | 535 | unsigned long jd_flags; |
---|
539 | 536 | #define JDF_RECOVERY 1 |
---|
540 | 537 | unsigned int jd_jid; |
---|
541 | | - unsigned int jd_blocks; |
---|
| 538 | + u32 jd_blocks; |
---|
542 | 539 | int jd_recover_error; |
---|
543 | 540 | /* Replay stuff */ |
---|
544 | 541 | |
---|
.. | .. |
---|
549 | 546 | struct list_head jd_revoke_list; |
---|
550 | 547 | unsigned int jd_replay_tail; |
---|
551 | 548 | |
---|
| 549 | + u64 jd_no_addr; |
---|
552 | 550 | }; |
---|
553 | 551 | |
---|
554 | 552 | struct gfs2_statfs_change_host { |
---|
.. | .. |
---|
590 | 588 | unsigned int ar_rgrplvb:1; /* use lvbs for rgrp info */ |
---|
591 | 589 | unsigned int ar_loccookie:1; /* use location based readdir |
---|
592 | 590 | 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 */ |
---|
597 | 595 | }; |
---|
598 | 596 | |
---|
599 | 597 | struct gfs2_tune { |
---|
.. | .. |
---|
615 | 613 | enum { |
---|
616 | 614 | SDF_JOURNAL_CHECKED = 0, |
---|
617 | 615 | SDF_JOURNAL_LIVE = 1, |
---|
618 | | - SDF_SHUTDOWN = 2, |
---|
| 616 | + SDF_WITHDRAWN = 2, |
---|
619 | 617 | SDF_NOBARRIERS = 3, |
---|
620 | 618 | SDF_NORECOVERY = 4, |
---|
621 | 619 | SDF_DEMOTE = 5, |
---|
.. | .. |
---|
623 | 621 | SDF_RORECOVERY = 7, /* read only recovery */ |
---|
624 | 622 | SDF_SKIP_DLM_UNLOCK = 8, |
---|
625 | 623 | 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 */ |
---|
627 | 630 | }; |
---|
628 | 631 | |
---|
629 | 632 | enum gfs2_freeze_state { |
---|
.. | .. |
---|
695 | 698 | struct gfs2_lkstats lkstats[10]; |
---|
696 | 699 | }; |
---|
697 | 700 | |
---|
| 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 | + |
---|
698 | 708 | struct gfs2_sbd { |
---|
699 | 709 | struct super_block *sd_vfs; |
---|
700 | 710 | struct gfs2_pcpu_lkstats __percpu *sd_lkstats; |
---|
701 | 711 | struct kobject sd_kobj; |
---|
| 712 | + struct completion sd_kobj_unregister; |
---|
702 | 713 | unsigned long sd_flags; /* SDF_... */ |
---|
703 | 714 | struct gfs2_sb_host sd_sb; |
---|
704 | 715 | |
---|
.. | .. |
---|
708 | 719 | u32 sd_fsb2bb_shift; |
---|
709 | 720 | u32 sd_diptrs; /* Number of pointers in a dinode */ |
---|
710 | 721 | u32 sd_inptrs; /* Number of pointers in a indirect block */ |
---|
| 722 | + u32 sd_ldptrs; /* Number of pointers in a log descriptor block */ |
---|
711 | 723 | u32 sd_jbsize; /* Size of a journaled data block */ |
---|
712 | 724 | u32 sd_hash_bsize; /* sizeof(exhash block) */ |
---|
713 | 725 | u32 sd_hash_bsize_shift; |
---|
.. | .. |
---|
730 | 742 | struct gfs2_glock *sd_freeze_gl; |
---|
731 | 743 | struct work_struct sd_freeze_work; |
---|
732 | 744 | wait_queue_head_t sd_glock_wait; |
---|
| 745 | + wait_queue_head_t sd_async_glock_wait; |
---|
733 | 746 | atomic_t sd_glock_disposal; |
---|
734 | 747 | struct completion sd_locking_init; |
---|
735 | 748 | struct completion sd_wdack; |
---|
.. | .. |
---|
743 | 756 | struct inode *sd_jindex; |
---|
744 | 757 | struct inode *sd_statfs_inode; |
---|
745 | 758 | struct inode *sd_sc_inode; |
---|
| 759 | + struct list_head sd_sc_inodes_list; |
---|
746 | 760 | struct inode *sd_qc_inode; |
---|
747 | 761 | struct inode *sd_rindex; |
---|
748 | 762 | struct inode *sd_quota_inode; |
---|
.. | .. |
---|
772 | 786 | struct gfs2_jdesc *sd_jdesc; |
---|
773 | 787 | struct gfs2_holder sd_journal_gh; |
---|
774 | 788 | struct gfs2_holder sd_jinode_gh; |
---|
| 789 | + struct gfs2_glock *sd_jinode_gl; |
---|
775 | 790 | |
---|
776 | 791 | struct gfs2_holder sd_sc_gh; |
---|
777 | 792 | struct gfs2_holder sd_qc_gh; |
---|
.. | .. |
---|
807 | 822 | |
---|
808 | 823 | struct gfs2_trans *sd_log_tr; |
---|
809 | 824 | unsigned int sd_log_blks_reserved; |
---|
810 | | - int sd_log_commited_revoke; |
---|
| 825 | + int sd_log_committed_revoke; |
---|
811 | 826 | |
---|
812 | 827 | atomic_t sd_log_pinned; |
---|
813 | 828 | unsigned int sd_log_num_revoke; |
---|
814 | 829 | |
---|
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; |
---|
817 | 832 | spinlock_t sd_ordered_lock; |
---|
818 | 833 | |
---|
819 | 834 | atomic_t sd_log_thresh1; |
---|
.. | .. |
---|
832 | 847 | atomic_t sd_log_in_flight; |
---|
833 | 848 | struct bio *sd_log_bio; |
---|
834 | 849 | 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; |
---|
836 | 852 | |
---|
837 | 853 | atomic_t sd_reserving_log; |
---|
838 | 854 | wait_queue_head_t sd_reserving_log_wait; |
---|
.. | .. |
---|
856 | 872 | |
---|
857 | 873 | unsigned long sd_last_warning; |
---|
858 | 874 | 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; |
---|
862 | 876 | }; |
---|
863 | 877 | |
---|
864 | 878 | static inline void gfs2_glstats_inc(struct gfs2_glock *gl, int which) |
---|