~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/fs/jfs/jfs_metapage.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-or-later */
  2 /*
  3  *   Copyright (C) International Business Machines Corp., 2000-2002
  4  *   Portions Copyright (C) Christoph Hellwig, 2001-2002
  5  */
  6 #ifndef _H_JFS_METAPAGE
  7 #define _H_JFS_METAPAGE
  8 
  9 #include <linux/pagemap.h>
 10 
 11 struct metapage {
 12         /* Common logsyncblk prefix (see jfs_logmgr.h) */
 13         u16 xflag;
 14         u16 unused;
 15         lid_t lid;
 16         int lsn;
 17         struct list_head synclist;
 18         /* End of logsyncblk prefix */
 19 
 20         unsigned long flag;     /* See Below */
 21         unsigned long count;    /* Reference count */
 22         void *data;             /* Data pointer */
 23         sector_t index;         /* block address of page */
 24         wait_queue_head_t wait;
 25 
 26         /* implementation */
 27         struct folio *folio;
 28         struct super_block *sb;
 29         unsigned int logical_size;
 30 
 31         /* Journal management */
 32         int clsn;
 33         int nohomeok;
 34         struct jfs_log *log;
 35 };
 36 
 37 /* metapage flag */
 38 #define META_locked     0
 39 #define META_dirty      2
 40 #define META_sync       3
 41 #define META_discard    4
 42 #define META_forcewrite 5
 43 #define META_io         6
 44 
 45 #define mark_metapage_dirty(mp) set_bit(META_dirty, &(mp)->flag)
 46 
 47 /* function prototypes */
 48 extern int metapage_init(void);
 49 extern void metapage_exit(void);
 50 extern struct metapage *__get_metapage(struct inode *inode,
 51                                   unsigned long lblock, unsigned int size,
 52                                   int absolute, unsigned long new);
 53 
 54 #define read_metapage(inode, lblock, size, absolute)\
 55          __get_metapage(inode, lblock, size, absolute, false)
 56 
 57 #define get_metapage(inode, lblock, size, absolute)\
 58          __get_metapage(inode, lblock, size, absolute, true)
 59 
 60 extern void release_metapage(struct metapage *);
 61 extern void grab_metapage(struct metapage *);
 62 extern void force_metapage(struct metapage *);
 63 
 64 /*
 65  * hold_metapage and put_metapage are used in conjunction.  The page lock
 66  * is not dropped between the two, so no other threads can get or release
 67  * the metapage
 68  */
 69 extern void hold_metapage(struct metapage *);
 70 extern void put_metapage(struct metapage *);
 71 
 72 static inline void write_metapage(struct metapage *mp)
 73 {
 74         set_bit(META_dirty, &mp->flag);
 75         release_metapage(mp);
 76 }
 77 
 78 static inline void flush_metapage(struct metapage *mp)
 79 {
 80         set_bit(META_sync, &mp->flag);
 81         write_metapage(mp);
 82 }
 83 
 84 static inline void discard_metapage(struct metapage *mp)
 85 {
 86         clear_bit(META_dirty, &mp->flag);
 87         set_bit(META_discard, &mp->flag);
 88         release_metapage(mp);
 89 }
 90 
 91 static inline void metapage_nohomeok(struct metapage *mp)
 92 {
 93         struct folio *folio = mp->folio;
 94         folio_lock(folio);
 95         if (!mp->nohomeok++) {
 96                 mark_metapage_dirty(mp);
 97                 folio_get(folio);
 98                 folio_wait_writeback(folio);
 99         }
100         folio_unlock(folio);
101 }
102 
103 /*
104  * This serializes access to mp->lsn when metapages are added to logsynclist
105  * without setting nohomeok.  i.e. updating imap & dmap
106  */
107 static inline void metapage_wait_for_io(struct metapage *mp)
108 {
109         if (test_bit(META_io, &mp->flag))
110                 folio_wait_writeback(mp->folio);
111 }
112 
113 /*
114  * This is called when already holding the metapage
115  */
116 static inline void _metapage_homeok(struct metapage *mp)
117 {
118         if (!--mp->nohomeok)
119                 folio_put(mp->folio);
120 }
121 
122 static inline void metapage_homeok(struct metapage *mp)
123 {
124         hold_metapage(mp);
125         _metapage_homeok(mp);
126         put_metapage(mp);
127 }
128 
129 extern const struct address_space_operations jfs_metapage_aops;
130 
131 /*
132  * This routines invalidate all pages for an extent.
133  */
134 extern void __invalidate_metapages(struct inode *, s64, int);
135 #define invalidate_pxd_metapages(ip, pxd) \
136         __invalidate_metapages((ip), addressPXD(&(pxd)), lengthPXD(&(pxd)))
137 #define invalidate_dxd_metapages(ip, dxd) \
138         __invalidate_metapages((ip), addressDXD(&(dxd)), lengthDXD(&(dxd)))
139 #define invalidate_xad_metapages(ip, xad) \
140         __invalidate_metapages((ip), addressXAD(&(xad)), lengthXAD(&(xad)))
141 
142 #endif                          /* _H_JFS_METAPAGE */
143 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php