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

TOMOYO Linux Cross Reference
Linux/fs/reiserfs/procfs.c

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ 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.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /fs/reiserfs/procfs.c (Version linux-6.12-rc7) and /fs/reiserfs/procfs.c (Version linux-5.8.18)


  1 /* -*- linux-c -*- */                               1 /* -*- linux-c -*- */
  2                                                     2 
  3 /* fs/reiserfs/procfs.c */                          3 /* fs/reiserfs/procfs.c */
  4                                                     4 
  5 /*                                                  5 /*
  6  * Copyright 2000 by Hans Reiser, licensing go      6  * Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README
  7  */                                                 7  */
  8                                                     8 
  9 /* proc info support a la one created by Sizif      9 /* proc info support a la one created by Sizif@Botik.RU for PGC */
 10                                                    10 
 11 #include <linux/module.h>                          11 #include <linux/module.h>
 12 #include <linux/time.h>                            12 #include <linux/time.h>
 13 #include <linux/seq_file.h>                        13 #include <linux/seq_file.h>
 14 #include <linux/uaccess.h>                         14 #include <linux/uaccess.h>
 15 #include "reiserfs.h"                              15 #include "reiserfs.h"
 16 #include <linux/init.h>                            16 #include <linux/init.h>
 17 #include <linux/proc_fs.h>                         17 #include <linux/proc_fs.h>
 18 #include <linux/blkdev.h>                      << 
 19                                                    18 
 20 /*                                                 19 /*
 21  * LOCKING:                                        20  * LOCKING:
 22  *                                                 21  *
 23  * These guys are evicted from procfs as the v     22  * These guys are evicted from procfs as the very first step in ->kill_sb().
 24  *                                                 23  *
 25  */                                                24  */
 26                                                    25 
 27 static int show_version(struct seq_file *m, vo     26 static int show_version(struct seq_file *m, void *unused)
 28 {                                                  27 {
 29         struct super_block *sb = m->private;       28         struct super_block *sb = m->private;
 30         char *format;                              29         char *format;
 31                                                    30 
 32         if (REISERFS_SB(sb)->s_properties & (1     31         if (REISERFS_SB(sb)->s_properties & (1 << REISERFS_3_6)) {
 33                 format = "3.6";                    32                 format = "3.6";
 34         } else if (REISERFS_SB(sb)->s_properti     33         } else if (REISERFS_SB(sb)->s_properties & (1 << REISERFS_3_5)) {
 35                 format = "3.5";                    34                 format = "3.5";
 36         } else {                                   35         } else {
 37                 format = "unknown";                36                 format = "unknown";
 38         }                                          37         }
 39                                                    38 
 40         seq_printf(m, "%s format\twith checks      39         seq_printf(m, "%s format\twith checks %s\n", format,
 41 #if defined( CONFIG_REISERFS_CHECK )               40 #if defined( CONFIG_REISERFS_CHECK )
 42                    "on"                            41                    "on"
 43 #else                                              42 #else
 44                    "off"                           43                    "off"
 45 #endif                                             44 #endif
 46             );                                     45             );
 47         return 0;                                  46         return 0;
 48 }                                                  47 }
 49                                                    48 
 50 #define SF( x ) ( r -> x )                         49 #define SF( x ) ( r -> x )
 51 #define SFP( x ) SF( s_proc_info_data.x )          50 #define SFP( x ) SF( s_proc_info_data.x )
 52 #define SFPL( x ) SFP( x[ level ] )                51 #define SFPL( x ) SFP( x[ level ] )
 53 #define SFPF( x ) SFP( scan_bitmap.x )             52 #define SFPF( x ) SFP( scan_bitmap.x )
 54 #define SFPJ( x ) SFP( journal.x )                 53 #define SFPJ( x ) SFP( journal.x )
 55                                                    54 
 56 #define D2C( x ) le16_to_cpu( x )                  55 #define D2C( x ) le16_to_cpu( x )
 57 #define D4C( x ) le32_to_cpu( x )                  56 #define D4C( x ) le32_to_cpu( x )
 58 #define DF( x ) D2C( rs -> s_v1.x )                57 #define DF( x ) D2C( rs -> s_v1.x )
 59 #define DFL( x ) D4C( rs -> s_v1.x )               58 #define DFL( x ) D4C( rs -> s_v1.x )
 60                                                    59 
 61 #define objectid_map( s, rs ) (old_format_only     60 #define objectid_map( s, rs ) (old_format_only (s) ?                            \
 62                          (__le32 *)((struct re     61                          (__le32 *)((struct reiserfs_super_block_v1 *)rs + 1) : \
 63                          (__le32 *)(rs + 1))       62                          (__le32 *)(rs + 1))
 64 #define MAP( i ) D4C( objectid_map( sb, rs )[      63 #define MAP( i ) D4C( objectid_map( sb, rs )[ i ] )
 65                                                    64 
 66 #define DJF( x ) le32_to_cpu( rs -> x )            65 #define DJF( x ) le32_to_cpu( rs -> x )
 67 #define DJP( x ) le32_to_cpu( jp -> x )            66 #define DJP( x ) le32_to_cpu( jp -> x )
 68 #define JF( x ) ( r -> s_journal -> x )            67 #define JF( x ) ( r -> s_journal -> x )
 69                                                    68 
 70 static int show_super(struct seq_file *m, void     69 static int show_super(struct seq_file *m, void *unused)
 71 {                                                  70 {
 72         struct super_block *sb = m->private;       71         struct super_block *sb = m->private;
 73         struct reiserfs_sb_info *r = REISERFS_     72         struct reiserfs_sb_info *r = REISERFS_SB(sb);
 74                                                    73 
 75         seq_printf(m, "state: \t%s\n"              74         seq_printf(m, "state: \t%s\n"
 76                    "mount options: \t%s%s%s%s%     75                    "mount options: \t%s%s%s%s%s%s%s%s%s%s%s\n"
 77                    "gen. counter: \t%i\n"          76                    "gen. counter: \t%i\n"
 78                    "s_disk_reads: \t%i\n"          77                    "s_disk_reads: \t%i\n"
 79                    "s_disk_writes: \t%i\n"         78                    "s_disk_writes: \t%i\n"
 80                    "s_fix_nodes: \t%i\n"           79                    "s_fix_nodes: \t%i\n"
 81                    "s_do_balance: \t%i\n"          80                    "s_do_balance: \t%i\n"
 82                    "s_unneeded_left_neighbor:      81                    "s_unneeded_left_neighbor: \t%i\n"
 83                    "s_good_search_by_key_reada     82                    "s_good_search_by_key_reada: \t%i\n"
 84                    "s_bmaps: \t%i\n"               83                    "s_bmaps: \t%i\n"
 85                    "s_bmaps_without_search: \t     84                    "s_bmaps_without_search: \t%i\n"
 86                    "s_direct2indirect: \t%i\n"     85                    "s_direct2indirect: \t%i\n"
 87                    "s_indirect2direct: \t%i\n"     86                    "s_indirect2direct: \t%i\n"
 88                    "\n"                            87                    "\n"
 89                    "max_hash_collisions: \t%i\     88                    "max_hash_collisions: \t%i\n"
 90                    "breads: \t%lu\n"               89                    "breads: \t%lu\n"
 91                    "bread_misses: \t%lu\n"         90                    "bread_misses: \t%lu\n"
 92                    "search_by_key: \t%lu\n"        91                    "search_by_key: \t%lu\n"
 93                    "search_by_key_fs_changed:      92                    "search_by_key_fs_changed: \t%lu\n"
 94                    "search_by_key_restarted: \     93                    "search_by_key_restarted: \t%lu\n"
 95                    "insert_item_restarted: \t%     94                    "insert_item_restarted: \t%lu\n"
 96                    "paste_into_item_restarted:     95                    "paste_into_item_restarted: \t%lu\n"
 97                    "cut_from_item_restarted: \     96                    "cut_from_item_restarted: \t%lu\n"
 98                    "delete_solid_item_restarte     97                    "delete_solid_item_restarted: \t%lu\n"
 99                    "delete_item_restarted: \t%     98                    "delete_item_restarted: \t%lu\n"
100                    "leaked_oid: \t%lu\n"           99                    "leaked_oid: \t%lu\n"
101                    "leaves_removable: \t%lu\n"    100                    "leaves_removable: \t%lu\n",
102                    SF(s_mount_state) == REISER    101                    SF(s_mount_state) == REISERFS_VALID_FS ?
103                    "REISERFS_VALID_FS" : "REIS    102                    "REISERFS_VALID_FS" : "REISERFS_ERROR_FS",
104                    reiserfs_r5_hash(sb) ? "FOR    103                    reiserfs_r5_hash(sb) ? "FORCE_R5 " : "",
105                    reiserfs_rupasov_hash(sb) ?    104                    reiserfs_rupasov_hash(sb) ? "FORCE_RUPASOV " : "",
106                    reiserfs_tea_hash(sb) ? "FO    105                    reiserfs_tea_hash(sb) ? "FORCE_TEA " : "",
107                    reiserfs_hash_detect(sb) ?     106                    reiserfs_hash_detect(sb) ? "DETECT_HASH " : "",
108                    reiserfs_no_border(sb) ? "N    107                    reiserfs_no_border(sb) ? "NO_BORDER " : "BORDER ",
109                    reiserfs_no_unhashed_reloca    108                    reiserfs_no_unhashed_relocation(sb) ?
110                    "NO_UNHASHED_RELOCATION " :    109                    "NO_UNHASHED_RELOCATION " : "",
111                    reiserfs_hashed_relocation(    110                    reiserfs_hashed_relocation(sb) ? "UNHASHED_RELOCATION " : "",
112                    reiserfs_test4(sb) ? "TEST4    111                    reiserfs_test4(sb) ? "TEST4 " : "",
113                    have_large_tails(sb) ? "TAI    112                    have_large_tails(sb) ? "TAILS " : have_small_tails(sb) ?
114                    "SMALL_TAILS " : "NO_TAILS     113                    "SMALL_TAILS " : "NO_TAILS ",
115                    replay_only(sb) ? "REPLAY_O    114                    replay_only(sb) ? "REPLAY_ONLY " : "",
116                    convert_reiserfs(sb) ? "CON    115                    convert_reiserfs(sb) ? "CONV " : "",
117                    atomic_read(&r->s_generatio    116                    atomic_read(&r->s_generation_counter),
118                    SF(s_disk_reads), SF(s_disk    117                    SF(s_disk_reads), SF(s_disk_writes), SF(s_fix_nodes),
119                    SF(s_do_balance), SF(s_unne    118                    SF(s_do_balance), SF(s_unneeded_left_neighbor),
120                    SF(s_good_search_by_key_rea    119                    SF(s_good_search_by_key_reada), SF(s_bmaps),
121                    SF(s_bmaps_without_search),    120                    SF(s_bmaps_without_search), SF(s_direct2indirect),
122                    SF(s_indirect2direct), SFP(    121                    SF(s_indirect2direct), SFP(max_hash_collisions), SFP(breads),
123                    SFP(bread_miss), SFP(search    122                    SFP(bread_miss), SFP(search_by_key),
124                    SFP(search_by_key_fs_change    123                    SFP(search_by_key_fs_changed), SFP(search_by_key_restarted),
125                    SFP(insert_item_restarted),    124                    SFP(insert_item_restarted), SFP(paste_into_item_restarted),
126                    SFP(cut_from_item_restarted    125                    SFP(cut_from_item_restarted),
127                    SFP(delete_solid_item_resta    126                    SFP(delete_solid_item_restarted), SFP(delete_item_restarted),
128                    SFP(leaked_oid), SFP(leaves    127                    SFP(leaked_oid), SFP(leaves_removable));
129                                                   128 
130         return 0;                                 129         return 0;
131 }                                                 130 }
132                                                   131 
133 static int show_per_level(struct seq_file *m,     132 static int show_per_level(struct seq_file *m, void *unused)
134 {                                                 133 {
135         struct super_block *sb = m->private;      134         struct super_block *sb = m->private;
136         struct reiserfs_sb_info *r = REISERFS_    135         struct reiserfs_sb_info *r = REISERFS_SB(sb);
137         int level;                                136         int level;
138                                                   137 
139         seq_printf(m, "level\t"                   138         seq_printf(m, "level\t"
140                    "     balances"                139                    "     balances"
141                    " [sbk:  reads"                140                    " [sbk:  reads"
142                    "   fs_changed"                141                    "   fs_changed"
143                    "   restarted]"                142                    "   restarted]"
144                    "   free space"                143                    "   free space"
145                    "        items"                144                    "        items"
146                    "   can_remove"                145                    "   can_remove"
147                    "         lnum"                146                    "         lnum"
148                    "         rnum"                147                    "         rnum"
149                    "       lbytes"                148                    "       lbytes"
150                    "       rbytes"                149                    "       rbytes"
151                    "     get_neig"                150                    "     get_neig"
152                    " get_neig_res" "  need_l_n    151                    " get_neig_res" "  need_l_neig" "  need_r_neig" "\n");
153                                                   152 
154         for (level = 0; level < MAX_HEIGHT; ++    153         for (level = 0; level < MAX_HEIGHT; ++level) {
155                 seq_printf(m, "%i\t"              154                 seq_printf(m, "%i\t"
156                            " %12lu"               155                            " %12lu"
157                            " %12lu"               156                            " %12lu"
158                            " %12lu"               157                            " %12lu"
159                            " %12lu"               158                            " %12lu"
160                            " %12lu"               159                            " %12lu"
161                            " %12lu"               160                            " %12lu"
162                            " %12lu"               161                            " %12lu"
163                            " %12li"               162                            " %12li"
164                            " %12li"               163                            " %12li"
165                            " %12li"               164                            " %12li"
166                            " %12li"               165                            " %12li"
167                            " %12lu"               166                            " %12lu"
168                            " %12lu"               167                            " %12lu"
169                            " %12lu"               168                            " %12lu"
170                            " %12lu"               169                            " %12lu"
171                            "\n",                  170                            "\n",
172                            level,                 171                            level,
173                            SFPL(balance_at),      172                            SFPL(balance_at),
174                            SFPL(sbk_read_at),     173                            SFPL(sbk_read_at),
175                            SFPL(sbk_fs_changed    174                            SFPL(sbk_fs_changed),
176                            SFPL(sbk_restarted)    175                            SFPL(sbk_restarted),
177                            SFPL(free_at),         176                            SFPL(free_at),
178                            SFPL(items_at),        177                            SFPL(items_at),
179                            SFPL(can_node_be_re    178                            SFPL(can_node_be_removed),
180                            SFPL(lnum),            179                            SFPL(lnum),
181                            SFPL(rnum),            180                            SFPL(rnum),
182                            SFPL(lbytes),          181                            SFPL(lbytes),
183                            SFPL(rbytes),          182                            SFPL(rbytes),
184                            SFPL(get_neighbors)    183                            SFPL(get_neighbors),
185                            SFPL(get_neighbors_    184                            SFPL(get_neighbors_restart),
186                            SFPL(need_l_neighbo    185                            SFPL(need_l_neighbor), SFPL(need_r_neighbor)
187                     );                            186                     );
188         }                                         187         }
189         return 0;                                 188         return 0;
190 }                                                 189 }
191                                                   190 
192 static int show_bitmap(struct seq_file *m, voi    191 static int show_bitmap(struct seq_file *m, void *unused)
193 {                                                 192 {
194         struct super_block *sb = m->private;      193         struct super_block *sb = m->private;
195         struct reiserfs_sb_info *r = REISERFS_    194         struct reiserfs_sb_info *r = REISERFS_SB(sb);
196                                                   195 
197         seq_printf(m, "free_block: %lu\n"         196         seq_printf(m, "free_block: %lu\n"
198                    "  scan_bitmap:"               197                    "  scan_bitmap:"
199                    "          wait"               198                    "          wait"
200                    "          bmap"               199                    "          bmap"
201                    "         retry"               200                    "         retry"
202                    "        stolen"               201                    "        stolen"
203                    "  journal_hint"               202                    "  journal_hint"
204                    "journal_nohint"               203                    "journal_nohint"
205                    "\n"                           204                    "\n"
206                    " %14lu"                       205                    " %14lu"
207                    " %14lu"                       206                    " %14lu"
208                    " %14lu"                       207                    " %14lu"
209                    " %14lu"                       208                    " %14lu"
210                    " %14lu"                       209                    " %14lu"
211                    " %14lu"                       210                    " %14lu"
212                    " %14lu"                       211                    " %14lu"
213                    "\n",                          212                    "\n",
214                    SFP(free_block),               213                    SFP(free_block),
215                    SFPF(call),                    214                    SFPF(call),
216                    SFPF(wait),                    215                    SFPF(wait),
217                    SFPF(bmap),                    216                    SFPF(bmap),
218                    SFPF(retry),                   217                    SFPF(retry),
219                    SFPF(stolen),                  218                    SFPF(stolen),
220                    SFPF(in_journal_hint), SFPF    219                    SFPF(in_journal_hint), SFPF(in_journal_nohint));
221                                                   220 
222         return 0;                                 221         return 0;
223 }                                                 222 }
224                                                   223 
225 static int show_on_disk_super(struct seq_file     224 static int show_on_disk_super(struct seq_file *m, void *unused)
226 {                                                 225 {
227         struct super_block *sb = m->private;      226         struct super_block *sb = m->private;
228         struct reiserfs_sb_info *sb_info = REI    227         struct reiserfs_sb_info *sb_info = REISERFS_SB(sb);
229         struct reiserfs_super_block *rs = sb_i    228         struct reiserfs_super_block *rs = sb_info->s_rs;
230         int hash_code = DFL(s_hash_function_co    229         int hash_code = DFL(s_hash_function_code);
231         __u32 flags = DJF(s_flags);               230         __u32 flags = DJF(s_flags);
232                                                   231 
233         seq_printf(m, "block_count: \t%i\n"       232         seq_printf(m, "block_count: \t%i\n"
234                    "free_blocks: \t%i\n"          233                    "free_blocks: \t%i\n"
235                    "root_block: \t%i\n"           234                    "root_block: \t%i\n"
236                    "blocksize: \t%i\n"            235                    "blocksize: \t%i\n"
237                    "oid_maxsize: \t%i\n"          236                    "oid_maxsize: \t%i\n"
238                    "oid_cursize: \t%i\n"          237                    "oid_cursize: \t%i\n"
239                    "umount_state: \t%i\n"         238                    "umount_state: \t%i\n"
240                    "magic: \t%10.10s\n"           239                    "magic: \t%10.10s\n"
241                    "fs_state: \t%i\n"             240                    "fs_state: \t%i\n"
242                    "hash: \t%s\n"                 241                    "hash: \t%s\n"
243                    "tree_height: \t%i\n"          242                    "tree_height: \t%i\n"
244                    "bmap_nr: \t%i\n"              243                    "bmap_nr: \t%i\n"
245                    "version: \t%i\n"              244                    "version: \t%i\n"
246                    "flags: \t%x[%s]\n"            245                    "flags: \t%x[%s]\n"
247                    "reserved_for_journal: \t%i    246                    "reserved_for_journal: \t%i\n",
248                    DFL(s_block_count),            247                    DFL(s_block_count),
249                    DFL(s_free_blocks),            248                    DFL(s_free_blocks),
250                    DFL(s_root_block),             249                    DFL(s_root_block),
251                    DF(s_blocksize),               250                    DF(s_blocksize),
252                    DF(s_oid_maxsize),             251                    DF(s_oid_maxsize),
253                    DF(s_oid_cursize),             252                    DF(s_oid_cursize),
254                    DF(s_umount_state),            253                    DF(s_umount_state),
255                    rs->s_v1.s_magic,              254                    rs->s_v1.s_magic,
256                    DF(s_fs_state),                255                    DF(s_fs_state),
257                    hash_code == TEA_HASH ? "te    256                    hash_code == TEA_HASH ? "tea" :
258                    (hash_code == YURA_HASH) ?     257                    (hash_code == YURA_HASH) ? "rupasov" :
259                    (hash_code == R5_HASH) ? "r    258                    (hash_code == R5_HASH) ? "r5" :
260                    (hash_code == UNSET_HASH) ?    259                    (hash_code == UNSET_HASH) ? "unset" : "unknown",
261                    DF(s_tree_height),             260                    DF(s_tree_height),
262                    DF(s_bmap_nr),                 261                    DF(s_bmap_nr),
263                    DF(s_version), flags, (flag    262                    DF(s_version), flags, (flags & reiserfs_attrs_cleared)
264                    ? "attrs_cleared" : "", DF(    263                    ? "attrs_cleared" : "", DF(s_reserved_for_journal));
265                                                   264 
266         return 0;                                 265         return 0;
267 }                                                 266 }
268                                                   267 
269 static int show_oidmap(struct seq_file *m, voi    268 static int show_oidmap(struct seq_file *m, void *unused)
270 {                                                 269 {
271         struct super_block *sb = m->private;      270         struct super_block *sb = m->private;
272         struct reiserfs_sb_info *sb_info = REI    271         struct reiserfs_sb_info *sb_info = REISERFS_SB(sb);
273         struct reiserfs_super_block *rs = sb_i    272         struct reiserfs_super_block *rs = sb_info->s_rs;
274         unsigned int mapsize = le16_to_cpu(rs-    273         unsigned int mapsize = le16_to_cpu(rs->s_v1.s_oid_cursize);
275         unsigned long total_used = 0;             274         unsigned long total_used = 0;
276         int i;                                    275         int i;
277                                                   276 
278         for (i = 0; i < mapsize; ++i) {           277         for (i = 0; i < mapsize; ++i) {
279                 __u32 right;                      278                 __u32 right;
280                                                   279 
281                 right = (i == mapsize - 1) ? M    280                 right = (i == mapsize - 1) ? MAX_KEY_OBJECTID : MAP(i + 1);
282                 seq_printf(m, "%s: [ %x .. %x     281                 seq_printf(m, "%s: [ %x .. %x )\n",
283                            (i & 1) ? "free" :     282                            (i & 1) ? "free" : "used", MAP(i), right);
284                 if (!(i & 1)) {                   283                 if (!(i & 1)) {
285                         total_used += right -     284                         total_used += right - MAP(i);
286                 }                                 285                 }
287         }                                         286         }
288 #if defined( REISERFS_USE_OIDMAPF )               287 #if defined( REISERFS_USE_OIDMAPF )
289         if (sb_info->oidmap.use_file && (sb_in    288         if (sb_info->oidmap.use_file && (sb_info->oidmap.mapf != NULL)) {
290                 loff_t size = file_inode(sb_in    289                 loff_t size = file_inode(sb_info->oidmap.mapf)->i_size;
291                 total_used += size / sizeof(re    290                 total_used += size / sizeof(reiserfs_oidinterval_d_t);
292         }                                         291         }
293 #endif                                            292 #endif
294         seq_printf(m, "total: \t%i [%i/%i] use    293         seq_printf(m, "total: \t%i [%i/%i] used: %lu [exact]\n",
295                    mapsize,                       294                    mapsize,
296                    mapsize, le16_to_cpu(rs->s_    295                    mapsize, le16_to_cpu(rs->s_v1.s_oid_maxsize), total_used);
297         return 0;                                 296         return 0;
298 }                                                 297 }
299                                                   298 
300 static time64_t ktime_mono_to_real_seconds(tim    299 static time64_t ktime_mono_to_real_seconds(time64_t mono)
301 {                                                 300 {
302         ktime_t kt = ktime_set(mono, NSEC_PER_    301         ktime_t kt = ktime_set(mono, NSEC_PER_SEC/2);
303                                                   302 
304         return ktime_divns(ktime_mono_to_real(    303         return ktime_divns(ktime_mono_to_real(kt), NSEC_PER_SEC);
305 }                                                 304 }
306                                                   305 
307 static int show_journal(struct seq_file *m, vo    306 static int show_journal(struct seq_file *m, void *unused)
308 {                                                 307 {
309         struct super_block *sb = m->private;      308         struct super_block *sb = m->private;
310         struct reiserfs_sb_info *r = REISERFS_    309         struct reiserfs_sb_info *r = REISERFS_SB(sb);
311         struct reiserfs_super_block *rs = r->s    310         struct reiserfs_super_block *rs = r->s_rs;
312         struct journal_params *jp = &rs->s_v1.    311         struct journal_params *jp = &rs->s_v1.s_journal;
313                                                   312 
314         seq_printf(m,           /* on-disk fie    313         seq_printf(m,           /* on-disk fields */
315                    "jp_journal_1st_block: \t%i    314                    "jp_journal_1st_block: \t%i\n"
316                    "jp_journal_dev: \t%pg[%x]\    315                    "jp_journal_dev: \t%pg[%x]\n"
317                    "jp_journal_size: \t%i\n"      316                    "jp_journal_size: \t%i\n"
318                    "jp_journal_trans_max: \t%i    317                    "jp_journal_trans_max: \t%i\n"
319                    "jp_journal_magic: \t%i\n"     318                    "jp_journal_magic: \t%i\n"
320                    "jp_journal_max_batch: \t%i    319                    "jp_journal_max_batch: \t%i\n"
321                    "jp_journal_max_commit_age:    320                    "jp_journal_max_commit_age: \t%i\n"
322                    "jp_journal_max_trans_age:     321                    "jp_journal_max_trans_age: \t%i\n"
323                    /* incore fields */            322                    /* incore fields */
324                    "j_1st_reserved_block: \t%i    323                    "j_1st_reserved_block: \t%i\n"
325                    "j_state: \t%li\n"             324                    "j_state: \t%li\n"
326                    "j_trans_id: \t%u\n"           325                    "j_trans_id: \t%u\n"
327                    "j_mount_id: \t%lu\n"          326                    "j_mount_id: \t%lu\n"
328                    "j_start: \t%lu\n"             327                    "j_start: \t%lu\n"
329                    "j_len: \t%lu\n"               328                    "j_len: \t%lu\n"
330                    "j_len_alloc: \t%lu\n"         329                    "j_len_alloc: \t%lu\n"
331                    "j_wcount: \t%i\n"             330                    "j_wcount: \t%i\n"
332                    "j_bcount: \t%lu\n"            331                    "j_bcount: \t%lu\n"
333                    "j_first_unflushed_offset:     332                    "j_first_unflushed_offset: \t%lu\n"
334                    "j_last_flush_trans_id: \t%    333                    "j_last_flush_trans_id: \t%u\n"
335                    "j_trans_start_time: \t%lli    334                    "j_trans_start_time: \t%lli\n"
336                    "j_list_bitmap_index: \t%i\    335                    "j_list_bitmap_index: \t%i\n"
337                    "j_must_wait: \t%i\n"          336                    "j_must_wait: \t%i\n"
338                    "j_next_full_flush: \t%i\n"    337                    "j_next_full_flush: \t%i\n"
339                    "j_next_async_flush: \t%i\n    338                    "j_next_async_flush: \t%i\n"
340                    "j_cnode_used: \t%i\n" "j_c    339                    "j_cnode_used: \t%i\n" "j_cnode_free: \t%i\n" "\n"
341                    /* reiserfs_proc_info_data_    340                    /* reiserfs_proc_info_data_t.journal fields */
342                    "in_journal: \t%12lu\n"        341                    "in_journal: \t%12lu\n"
343                    "in_journal_bitmap: \t%12lu    342                    "in_journal_bitmap: \t%12lu\n"
344                    "in_journal_reusable: \t%12    343                    "in_journal_reusable: \t%12lu\n"
345                    "lock_journal: \t%12lu\n"      344                    "lock_journal: \t%12lu\n"
346                    "lock_journal_wait: \t%12lu    345                    "lock_journal_wait: \t%12lu\n"
347                    "journal_begin: \t%12lu\n"     346                    "journal_begin: \t%12lu\n"
348                    "journal_relock_writers: \t    347                    "journal_relock_writers: \t%12lu\n"
349                    "journal_relock_wcount: \t%    348                    "journal_relock_wcount: \t%12lu\n"
350                    "mark_dirty: \t%12lu\n"        349                    "mark_dirty: \t%12lu\n"
351                    "mark_dirty_already: \t%12l    350                    "mark_dirty_already: \t%12lu\n"
352                    "mark_dirty_notjournal: \t%    351                    "mark_dirty_notjournal: \t%12lu\n"
353                    "restore_prepared: \t%12lu\    352                    "restore_prepared: \t%12lu\n"
354                    "prepare: \t%12lu\n"           353                    "prepare: \t%12lu\n"
355                    "prepare_retry: \t%12lu\n",    354                    "prepare_retry: \t%12lu\n",
356                    DJP(jp_journal_1st_block),     355                    DJP(jp_journal_1st_block),
357                    file_bdev(SB_JOURNAL(sb)->j !! 356                    SB_JOURNAL(sb)->j_dev_bd,
358                    DJP(jp_journal_dev),           357                    DJP(jp_journal_dev),
359                    DJP(jp_journal_size),          358                    DJP(jp_journal_size),
360                    DJP(jp_journal_trans_max),     359                    DJP(jp_journal_trans_max),
361                    DJP(jp_journal_magic),         360                    DJP(jp_journal_magic),
362                    DJP(jp_journal_max_batch),     361                    DJP(jp_journal_max_batch),
363                    SB_JOURNAL(sb)->j_max_commi    362                    SB_JOURNAL(sb)->j_max_commit_age,
364                    DJP(jp_journal_max_trans_ag    363                    DJP(jp_journal_max_trans_age),
365                    JF(j_1st_reserved_block),      364                    JF(j_1st_reserved_block),
366                    JF(j_state),                   365                    JF(j_state),
367                    JF(j_trans_id),                366                    JF(j_trans_id),
368                    JF(j_mount_id),                367                    JF(j_mount_id),
369                    JF(j_start),                   368                    JF(j_start),
370                    JF(j_len),                     369                    JF(j_len),
371                    JF(j_len_alloc),               370                    JF(j_len_alloc),
372                    atomic_read(&r->s_journal->    371                    atomic_read(&r->s_journal->j_wcount),
373                    JF(j_bcount),                  372                    JF(j_bcount),
374                    JF(j_first_unflushed_offset    373                    JF(j_first_unflushed_offset),
375                    JF(j_last_flush_trans_id),     374                    JF(j_last_flush_trans_id),
376                    ktime_mono_to_real_seconds(    375                    ktime_mono_to_real_seconds(JF(j_trans_start_time)),
377                    JF(j_list_bitmap_index),       376                    JF(j_list_bitmap_index),
378                    JF(j_must_wait),               377                    JF(j_must_wait),
379                    JF(j_next_full_flush),         378                    JF(j_next_full_flush),
380                    JF(j_next_async_flush),        379                    JF(j_next_async_flush),
381                    JF(j_cnode_used),              380                    JF(j_cnode_used),
382                    JF(j_cnode_free),              381                    JF(j_cnode_free),
383                    SFPJ(in_journal),              382                    SFPJ(in_journal),
384                    SFPJ(in_journal_bitmap),       383                    SFPJ(in_journal_bitmap),
385                    SFPJ(in_journal_reusable),     384                    SFPJ(in_journal_reusable),
386                    SFPJ(lock_journal),            385                    SFPJ(lock_journal),
387                    SFPJ(lock_journal_wait),       386                    SFPJ(lock_journal_wait),
388                    SFPJ(journal_being),           387                    SFPJ(journal_being),
389                    SFPJ(journal_relock_writers    388                    SFPJ(journal_relock_writers),
390                    SFPJ(journal_relock_wcount)    389                    SFPJ(journal_relock_wcount),
391                    SFPJ(mark_dirty),              390                    SFPJ(mark_dirty),
392                    SFPJ(mark_dirty_already),      391                    SFPJ(mark_dirty_already),
393                    SFPJ(mark_dirty_notjournal)    392                    SFPJ(mark_dirty_notjournal),
394                    SFPJ(restore_prepared), SFP    393                    SFPJ(restore_prepared), SFPJ(prepare), SFPJ(prepare_retry)
395             );                                    394             );
396         return 0;                                 395         return 0;
397 }                                                 396 }
398                                                   397 
399 static struct proc_dir_entry *proc_info_root =    398 static struct proc_dir_entry *proc_info_root = NULL;
400 static const char proc_info_root_name[] = "fs/    399 static const char proc_info_root_name[] = "fs/reiserfs";
401                                                   400 
402 static void add_file(struct super_block *sb, c    401 static void add_file(struct super_block *sb, char *name,
403                      int (*func) (struct seq_f    402                      int (*func) (struct seq_file *, void *))
404 {                                                 403 {
405         proc_create_single_data(name, 0, REISE    404         proc_create_single_data(name, 0, REISERFS_SB(sb)->procdir, func, sb);
406 }                                                 405 }
407                                                   406 
408 int reiserfs_proc_info_init(struct super_block    407 int reiserfs_proc_info_init(struct super_block *sb)
409 {                                                 408 {
410         char b[BDEVNAME_SIZE];                    409         char b[BDEVNAME_SIZE];
411         char *s;                                  410         char *s;
412                                                   411 
413         /* Some block devices use /'s */          412         /* Some block devices use /'s */
414         strscpy(b, sb->s_id, BDEVNAME_SIZE);   !! 413         strlcpy(b, sb->s_id, BDEVNAME_SIZE);
415         s = strchr(b, '/');                       414         s = strchr(b, '/');
416         if (s)                                    415         if (s)
417                 *s = '!';                         416                 *s = '!';
418                                                   417 
419         spin_lock_init(&__PINFO(sb).lock);        418         spin_lock_init(&__PINFO(sb).lock);
420         REISERFS_SB(sb)->procdir = proc_mkdir_    419         REISERFS_SB(sb)->procdir = proc_mkdir_data(b, 0, proc_info_root, sb);
421         if (REISERFS_SB(sb)->procdir) {           420         if (REISERFS_SB(sb)->procdir) {
422                 add_file(sb, "version", show_v    421                 add_file(sb, "version", show_version);
423                 add_file(sb, "super", show_sup    422                 add_file(sb, "super", show_super);
424                 add_file(sb, "per-level", show    423                 add_file(sb, "per-level", show_per_level);
425                 add_file(sb, "bitmap", show_bi    424                 add_file(sb, "bitmap", show_bitmap);
426                 add_file(sb, "on-disk-super",     425                 add_file(sb, "on-disk-super", show_on_disk_super);
427                 add_file(sb, "oidmap", show_oi    426                 add_file(sb, "oidmap", show_oidmap);
428                 add_file(sb, "journal", show_j    427                 add_file(sb, "journal", show_journal);
429                 return 0;                         428                 return 0;
430         }                                         429         }
431         reiserfs_warning(sb, "cannot create /p    430         reiserfs_warning(sb, "cannot create /proc/%s/%s",
432                          proc_info_root_name,     431                          proc_info_root_name, b);
433         return 1;                                 432         return 1;
434 }                                                 433 }
435                                                   434 
436 int reiserfs_proc_info_done(struct super_block    435 int reiserfs_proc_info_done(struct super_block *sb)
437 {                                                 436 {
438         struct proc_dir_entry *de = REISERFS_S    437         struct proc_dir_entry *de = REISERFS_SB(sb)->procdir;
439         if (de) {                                 438         if (de) {
440                 char b[BDEVNAME_SIZE];            439                 char b[BDEVNAME_SIZE];
441                 char *s;                          440                 char *s;
442                                                   441 
443                 /* Some block devices use /'s     442                 /* Some block devices use /'s */
444                 strscpy(b, sb->s_id, BDEVNAME_ !! 443                 strlcpy(b, sb->s_id, BDEVNAME_SIZE);
445                 s = strchr(b, '/');               444                 s = strchr(b, '/');
446                 if (s)                            445                 if (s)
447                         *s = '!';                 446                         *s = '!';
448                                                   447 
449                 remove_proc_subtree(b, proc_in    448                 remove_proc_subtree(b, proc_info_root);
450                 REISERFS_SB(sb)->procdir = NUL    449                 REISERFS_SB(sb)->procdir = NULL;
451         }                                         450         }
452         return 0;                                 451         return 0;
453 }                                                 452 }
454                                                   453 
455 int reiserfs_proc_info_global_init(void)          454 int reiserfs_proc_info_global_init(void)
456 {                                                 455 {
457         if (proc_info_root == NULL) {             456         if (proc_info_root == NULL) {
458                 proc_info_root = proc_mkdir(pr    457                 proc_info_root = proc_mkdir(proc_info_root_name, NULL);
459                 if (!proc_info_root) {            458                 if (!proc_info_root) {
460                         reiserfs_warning(NULL,    459                         reiserfs_warning(NULL, "cannot create /proc/%s",
461                                          proc_    460                                          proc_info_root_name);
462                         return 1;                 461                         return 1;
463                 }                                 462                 }
464         }                                         463         }
465         return 0;                                 464         return 0;
466 }                                                 465 }
467                                                   466 
468 int reiserfs_proc_info_global_done(void)          467 int reiserfs_proc_info_global_done(void)
469 {                                                 468 {
470         if (proc_info_root != NULL) {             469         if (proc_info_root != NULL) {
471                 proc_info_root = NULL;            470                 proc_info_root = NULL;
472                 remove_proc_entry(proc_info_ro    471                 remove_proc_entry(proc_info_root_name, NULL);
473         }                                         472         }
474         return 0;                                 473         return 0;
475 }                                                 474 }
476 /*                                                475 /*
477  * Revision 1.1.8.2  2001/07/15 17:08:42  god     476  * Revision 1.1.8.2  2001/07/15 17:08:42  god
478  *  . use get_super() in procfs.c                 477  *  . use get_super() in procfs.c
479  *  . remove remove_save_link() from reiserfs_    478  *  . remove remove_save_link() from reiserfs_do_truncate()
480  *                                                479  *
481  * I accept terms and conditions stated in the    480  * I accept terms and conditions stated in the Legal Agreement
482  * (available at http://www.namesys.com/legale    481  * (available at http://www.namesys.com/legalese.html)
483  *                                                482  *
484  * Revision 1.1.8.1  2001/07/11 16:48:50  god     483  * Revision 1.1.8.1  2001/07/11 16:48:50  god
485  * proc info support                              484  * proc info support
486  *                                                485  *
487  * I accept terms and conditions stated in the    486  * I accept terms and conditions stated in the Legal Agreement
488  * (available at http://www.namesys.com/legale    487  * (available at http://www.namesys.com/legalese.html)
489  *                                                488  *
                                                   >> 489  */
                                                   >> 490 
                                                   >> 491 /*
                                                   >> 492  * Make Linus happy.
                                                   >> 493  * Local variables:
                                                   >> 494  * c-indentation-style: "K&R"
                                                   >> 495  * mode-name: "LC"
                                                   >> 496  * c-basic-offset: 8
                                                   >> 497  * tab-width: 8
                                                   >> 498  * End:
490  */                                               499  */
491                                                   500 

~ [ 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