diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-03-29 22:30:07 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-03-31 16:03:16 -0400 |
commit | 4613ad180d19082f99551477dcb13cb23d23661b (patch) | |
tree | c90407d53b5e7270c55831e394bd879825e0c6e9 | |
parent | f7699f2b0114fcd0ea5ad5f8aa2142f1bcc27fd0 (diff) |
ext3: move headers to fs/ext3/
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/ext3/acl.c | 8 | ||||
-rw-r--r-- | fs/ext3/balloc.c | 10 | ||||
-rw-r--r-- | fs/ext3/bitmap.c | 4 | ||||
-rw-r--r-- | fs/ext3/dir.c | 7 | ||||
-rw-r--r-- | fs/ext3/ext3.h (renamed from include/linux/ext3_fs.h) | 488 | ||||
-rw-r--r-- | fs/ext3/ext3_jbd.c | 2 | ||||
-rw-r--r-- | fs/ext3/file.c | 6 | ||||
-rw-r--r-- | fs/ext3/fsync.c | 8 | ||||
-rw-r--r-- | fs/ext3/hash.c | 4 | ||||
-rw-r--r-- | fs/ext3/ialloc.c | 13 | ||||
-rw-r--r-- | fs/ext3/inode.c | 12 | ||||
-rw-r--r-- | fs/ext3/ioctl.c | 7 | ||||
-rw-r--r-- | fs/ext3/namei.c | 14 | ||||
-rw-r--r-- | fs/ext3/resize.c | 5 | ||||
-rw-r--r-- | fs/ext3/super.c | 18 | ||||
-rw-r--r-- | fs/ext3/symlink.c | 4 | ||||
-rw-r--r-- | fs/ext3/xattr.c | 7 | ||||
-rw-r--r-- | fs/ext3/xattr_security.c | 6 | ||||
-rw-r--r-- | fs/ext3/xattr_trusted.c | 6 | ||||
-rw-r--r-- | fs/ext3/xattr_user.c | 5 | ||||
-rw-r--r-- | include/linux/ext3_fs_i.h | 151 | ||||
-rw-r--r-- | include/linux/ext3_fs_sb.h | 91 | ||||
-rw-r--r-- | include/linux/ext3_jbd.h | 229 |
23 files changed, 437 insertions, 668 deletions
diff --git a/fs/ext3/acl.c b/fs/ext3/acl.c index 3091f62e55b6..c76832c8d192 100644 --- a/fs/ext3/acl.c +++ b/fs/ext3/acl.c | |||
@@ -4,13 +4,7 @@ | |||
4 | * Copyright (C) 2001-2003 Andreas Gruenbacher, <agruen@suse.de> | 4 | * Copyright (C) 2001-2003 Andreas Gruenbacher, <agruen@suse.de> |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <linux/init.h> | 7 | #include "ext3.h" |
8 | #include <linux/sched.h> | ||
9 | #include <linux/slab.h> | ||
10 | #include <linux/capability.h> | ||
11 | #include <linux/fs.h> | ||
12 | #include <linux/ext3_jbd.h> | ||
13 | #include <linux/ext3_fs.h> | ||
14 | #include "xattr.h" | 8 | #include "xattr.h" |
15 | #include "acl.h" | 9 | #include "acl.h" |
16 | 10 | ||
diff --git a/fs/ext3/balloc.c b/fs/ext3/balloc.c index 1e036b79384c..baac1b129fba 100644 --- a/fs/ext3/balloc.c +++ b/fs/ext3/balloc.c | |||
@@ -11,17 +11,9 @@ | |||
11 | * David S. Miller (davem@caip.rutgers.edu), 1995 | 11 | * David S. Miller (davem@caip.rutgers.edu), 1995 |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/time.h> | ||
15 | #include <linux/capability.h> | ||
16 | #include <linux/fs.h> | ||
17 | #include <linux/slab.h> | ||
18 | #include <linux/jbd.h> | ||
19 | #include <linux/ext3_fs.h> | ||
20 | #include <linux/ext3_jbd.h> | ||
21 | #include <linux/quotaops.h> | 14 | #include <linux/quotaops.h> |
22 | #include <linux/buffer_head.h> | ||
23 | #include <linux/blkdev.h> | 15 | #include <linux/blkdev.h> |
24 | #include <trace/events/ext3.h> | 16 | #include "ext3.h" |
25 | 17 | ||
26 | /* | 18 | /* |
27 | * balloc.c contains the blocks allocation and deallocation routines | 19 | * balloc.c contains the blocks allocation and deallocation routines |
diff --git a/fs/ext3/bitmap.c b/fs/ext3/bitmap.c index 6afc39d80253..909d13e26560 100644 --- a/fs/ext3/bitmap.c +++ b/fs/ext3/bitmap.c | |||
@@ -7,9 +7,7 @@ | |||
7 | * Universite Pierre et Marie Curie (Paris VI) | 7 | * Universite Pierre et Marie Curie (Paris VI) |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/buffer_head.h> | 10 | #include "ext3.h" |
11 | #include <linux/jbd.h> | ||
12 | #include <linux/ext3_fs.h> | ||
13 | 11 | ||
14 | #ifdef EXT3FS_DEBUG | 12 | #ifdef EXT3FS_DEBUG |
15 | 13 | ||
diff --git a/fs/ext3/dir.c b/fs/ext3/dir.c index 34f0a072b935..cc761ad8fa57 100644 --- a/fs/ext3/dir.c +++ b/fs/ext3/dir.c | |||
@@ -21,12 +21,7 @@ | |||
21 | * | 21 | * |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <linux/fs.h> | 24 | #include "ext3.h" |
25 | #include <linux/jbd.h> | ||
26 | #include <linux/ext3_fs.h> | ||
27 | #include <linux/buffer_head.h> | ||
28 | #include <linux/slab.h> | ||
29 | #include <linux/rbtree.h> | ||
30 | 25 | ||
31 | static unsigned char ext3_filetype_table[] = { | 26 | static unsigned char ext3_filetype_table[] = { |
32 | DT_UNKNOWN, DT_REG, DT_DIR, DT_CHR, DT_BLK, DT_FIFO, DT_SOCK, DT_LNK | 27 | DT_UNKNOWN, DT_REG, DT_DIR, DT_CHR, DT_BLK, DT_FIFO, DT_SOCK, DT_LNK |
diff --git a/include/linux/ext3_fs.h b/fs/ext3/ext3.h index f5a84eef6ed2..b6515fd7e56c 100644 --- a/include/linux/ext3_fs.h +++ b/fs/ext3/ext3.h | |||
@@ -1,5 +1,11 @@ | |||
1 | /* | 1 | /* |
2 | * linux/include/linux/ext3_fs.h | 2 | * Written by Stephen C. Tweedie <sct@redhat.com>, 1999 |
3 | * | ||
4 | * Copyright 1998--1999 Red Hat corp --- All Rights Reserved | ||
5 | * | ||
6 | * This file is part of the Linux kernel and is made available under | ||
7 | * the terms of the GNU General Public License, version 2, or at your | ||
8 | * option, any later version, incorporated herein by reference. | ||
3 | * | 9 | * |
4 | * Copyright (C) 1992, 1993, 1994, 1995 | 10 | * Copyright (C) 1992, 1993, 1994, 1995 |
5 | * Remy Card (card@masi.ibp.fr) | 11 | * Remy Card (card@masi.ibp.fr) |
@@ -13,12 +19,11 @@ | |||
13 | * Copyright (C) 1991, 1992 Linus Torvalds | 19 | * Copyright (C) 1991, 1992 Linus Torvalds |
14 | */ | 20 | */ |
15 | 21 | ||
16 | #ifndef _LINUX_EXT3_FS_H | 22 | #include <linux/fs.h> |
17 | #define _LINUX_EXT3_FS_H | 23 | #include <linux/jbd.h> |
18 | |||
19 | #include <linux/types.h> | ||
20 | #include <linux/magic.h> | 24 | #include <linux/magic.h> |
21 | #include <linux/bug.h> | 25 | #include <linux/bug.h> |
26 | #include <linux/blockgroup_lock.h> | ||
22 | 27 | ||
23 | /* | 28 | /* |
24 | * The second extended filesystem constants/structures | 29 | * The second extended filesystem constants/structures |
@@ -75,29 +80,12 @@ | |||
75 | #define EXT3_MIN_BLOCK_SIZE 1024 | 80 | #define EXT3_MIN_BLOCK_SIZE 1024 |
76 | #define EXT3_MAX_BLOCK_SIZE 65536 | 81 | #define EXT3_MAX_BLOCK_SIZE 65536 |
77 | #define EXT3_MIN_BLOCK_LOG_SIZE 10 | 82 | #define EXT3_MIN_BLOCK_LOG_SIZE 10 |
78 | #ifdef __KERNEL__ | 83 | #define EXT3_BLOCK_SIZE(s) ((s)->s_blocksize) |
79 | # define EXT3_BLOCK_SIZE(s) ((s)->s_blocksize) | ||
80 | #else | ||
81 | # define EXT3_BLOCK_SIZE(s) (EXT3_MIN_BLOCK_SIZE << (s)->s_log_block_size) | ||
82 | #endif | ||
83 | #define EXT3_ADDR_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / sizeof (__u32)) | 84 | #define EXT3_ADDR_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / sizeof (__u32)) |
84 | #ifdef __KERNEL__ | 85 | #define EXT3_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits) |
85 | # define EXT3_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits) | ||
86 | #else | ||
87 | # define EXT3_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10) | ||
88 | #endif | ||
89 | #ifdef __KERNEL__ | ||
90 | #define EXT3_ADDR_PER_BLOCK_BITS(s) (EXT3_SB(s)->s_addr_per_block_bits) | 86 | #define EXT3_ADDR_PER_BLOCK_BITS(s) (EXT3_SB(s)->s_addr_per_block_bits) |
91 | #define EXT3_INODE_SIZE(s) (EXT3_SB(s)->s_inode_size) | 87 | #define EXT3_INODE_SIZE(s) (EXT3_SB(s)->s_inode_size) |
92 | #define EXT3_FIRST_INO(s) (EXT3_SB(s)->s_first_ino) | 88 | #define EXT3_FIRST_INO(s) (EXT3_SB(s)->s_first_ino) |
93 | #else | ||
94 | #define EXT3_INODE_SIZE(s) (((s)->s_rev_level == EXT3_GOOD_OLD_REV) ? \ | ||
95 | EXT3_GOOD_OLD_INODE_SIZE : \ | ||
96 | (s)->s_inode_size) | ||
97 | #define EXT3_FIRST_INO(s) (((s)->s_rev_level == EXT3_GOOD_OLD_REV) ? \ | ||
98 | EXT3_GOOD_OLD_FIRST_INO : \ | ||
99 | (s)->s_first_ino) | ||
100 | #endif | ||
101 | 89 | ||
102 | /* | 90 | /* |
103 | * Macro-instructions used to manage fragments | 91 | * Macro-instructions used to manage fragments |
@@ -105,13 +93,8 @@ | |||
105 | #define EXT3_MIN_FRAG_SIZE 1024 | 93 | #define EXT3_MIN_FRAG_SIZE 1024 |
106 | #define EXT3_MAX_FRAG_SIZE 4096 | 94 | #define EXT3_MAX_FRAG_SIZE 4096 |
107 | #define EXT3_MIN_FRAG_LOG_SIZE 10 | 95 | #define EXT3_MIN_FRAG_LOG_SIZE 10 |
108 | #ifdef __KERNEL__ | 96 | #define EXT3_FRAG_SIZE(s) (EXT3_SB(s)->s_frag_size) |
109 | # define EXT3_FRAG_SIZE(s) (EXT3_SB(s)->s_frag_size) | 97 | #define EXT3_FRAGS_PER_BLOCK(s) (EXT3_SB(s)->s_frags_per_block) |
110 | # define EXT3_FRAGS_PER_BLOCK(s) (EXT3_SB(s)->s_frags_per_block) | ||
111 | #else | ||
112 | # define EXT3_FRAG_SIZE(s) (EXT3_MIN_FRAG_SIZE << (s)->s_log_frag_size) | ||
113 | # define EXT3_FRAGS_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / EXT3_FRAG_SIZE(s)) | ||
114 | #endif | ||
115 | 98 | ||
116 | /* | 99 | /* |
117 | * Structure of a blocks group descriptor | 100 | * Structure of a blocks group descriptor |
@@ -131,16 +114,10 @@ struct ext3_group_desc | |||
131 | /* | 114 | /* |
132 | * Macro-instructions used to manage group descriptors | 115 | * Macro-instructions used to manage group descriptors |
133 | */ | 116 | */ |
134 | #ifdef __KERNEL__ | 117 | #define EXT3_BLOCKS_PER_GROUP(s) (EXT3_SB(s)->s_blocks_per_group) |
135 | # define EXT3_BLOCKS_PER_GROUP(s) (EXT3_SB(s)->s_blocks_per_group) | 118 | #define EXT3_DESC_PER_BLOCK(s) (EXT3_SB(s)->s_desc_per_block) |
136 | # define EXT3_DESC_PER_BLOCK(s) (EXT3_SB(s)->s_desc_per_block) | 119 | #define EXT3_INODES_PER_GROUP(s) (EXT3_SB(s)->s_inodes_per_group) |
137 | # define EXT3_INODES_PER_GROUP(s) (EXT3_SB(s)->s_inodes_per_group) | 120 | #define EXT3_DESC_PER_BLOCK_BITS(s) (EXT3_SB(s)->s_desc_per_block_bits) |
138 | # define EXT3_DESC_PER_BLOCK_BITS(s) (EXT3_SB(s)->s_desc_per_block_bits) | ||
139 | #else | ||
140 | # define EXT3_BLOCKS_PER_GROUP(s) ((s)->s_blocks_per_group) | ||
141 | # define EXT3_DESC_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / sizeof (struct ext3_group_desc)) | ||
142 | # define EXT3_INODES_PER_GROUP(s) ((s)->s_inodes_per_group) | ||
143 | #endif | ||
144 | 121 | ||
145 | /* | 122 | /* |
146 | * Constants relative to the data blocks | 123 | * Constants relative to the data blocks |
@@ -336,7 +313,6 @@ struct ext3_inode { | |||
336 | 313 | ||
337 | #define i_size_high i_dir_acl | 314 | #define i_size_high i_dir_acl |
338 | 315 | ||
339 | #if defined(__KERNEL__) || defined(__linux__) | ||
340 | #define i_reserved1 osd1.linux1.l_i_reserved1 | 316 | #define i_reserved1 osd1.linux1.l_i_reserved1 |
341 | #define i_frag osd2.linux2.l_i_frag | 317 | #define i_frag osd2.linux2.l_i_frag |
342 | #define i_fsize osd2.linux2.l_i_fsize | 318 | #define i_fsize osd2.linux2.l_i_fsize |
@@ -346,24 +322,6 @@ struct ext3_inode { | |||
346 | #define i_gid_high osd2.linux2.l_i_gid_high | 322 | #define i_gid_high osd2.linux2.l_i_gid_high |
347 | #define i_reserved2 osd2.linux2.l_i_reserved2 | 323 | #define i_reserved2 osd2.linux2.l_i_reserved2 |
348 | 324 | ||
349 | #elif defined(__GNU__) | ||
350 | |||
351 | #define i_translator osd1.hurd1.h_i_translator | ||
352 | #define i_frag osd2.hurd2.h_i_frag; | ||
353 | #define i_fsize osd2.hurd2.h_i_fsize; | ||
354 | #define i_uid_high osd2.hurd2.h_i_uid_high | ||
355 | #define i_gid_high osd2.hurd2.h_i_gid_high | ||
356 | #define i_author osd2.hurd2.h_i_author | ||
357 | |||
358 | #elif defined(__masix__) | ||
359 | |||
360 | #define i_reserved1 osd1.masix1.m_i_reserved1 | ||
361 | #define i_frag osd2.masix2.m_i_frag | ||
362 | #define i_fsize osd2.masix2.m_i_fsize | ||
363 | #define i_reserved2 osd2.masix2.m_i_reserved2 | ||
364 | |||
365 | #endif /* defined(__KERNEL__) || defined(__linux__) */ | ||
366 | |||
367 | /* | 325 | /* |
368 | * File system states | 326 | * File system states |
369 | */ | 327 | */ |
@@ -531,9 +489,197 @@ struct ext3_super_block { | |||
531 | __u32 s_reserved[162]; /* Padding to the end of the block */ | 489 | __u32 s_reserved[162]; /* Padding to the end of the block */ |
532 | }; | 490 | }; |
533 | 491 | ||
534 | #ifdef __KERNEL__ | 492 | /* data type for block offset of block group */ |
535 | #include <linux/ext3_fs_i.h> | 493 | typedef int ext3_grpblk_t; |
536 | #include <linux/ext3_fs_sb.h> | 494 | |
495 | /* data type for filesystem-wide blocks number */ | ||
496 | typedef unsigned long ext3_fsblk_t; | ||
497 | |||
498 | #define E3FSBLK "%lu" | ||
499 | |||
500 | struct ext3_reserve_window { | ||
501 | ext3_fsblk_t _rsv_start; /* First byte reserved */ | ||
502 | ext3_fsblk_t _rsv_end; /* Last byte reserved or 0 */ | ||
503 | }; | ||
504 | |||
505 | struct ext3_reserve_window_node { | ||
506 | struct rb_node rsv_node; | ||
507 | __u32 rsv_goal_size; | ||
508 | __u32 rsv_alloc_hit; | ||
509 | struct ext3_reserve_window rsv_window; | ||
510 | }; | ||
511 | |||
512 | struct ext3_block_alloc_info { | ||
513 | /* information about reservation window */ | ||
514 | struct ext3_reserve_window_node rsv_window_node; | ||
515 | /* | ||
516 | * was i_next_alloc_block in ext3_inode_info | ||
517 | * is the logical (file-relative) number of the | ||
518 | * most-recently-allocated block in this file. | ||
519 | * We use this for detecting linearly ascending allocation requests. | ||
520 | */ | ||
521 | __u32 last_alloc_logical_block; | ||
522 | /* | ||
523 | * Was i_next_alloc_goal in ext3_inode_info | ||
524 | * is the *physical* companion to i_next_alloc_block. | ||
525 | * it the physical block number of the block which was most-recentl | ||
526 | * allocated to this file. This give us the goal (target) for the next | ||
527 | * allocation when we detect linearly ascending requests. | ||
528 | */ | ||
529 | ext3_fsblk_t last_alloc_physical_block; | ||
530 | }; | ||
531 | |||
532 | #define rsv_start rsv_window._rsv_start | ||
533 | #define rsv_end rsv_window._rsv_end | ||
534 | |||
535 | /* | ||
536 | * third extended file system inode data in memory | ||
537 | */ | ||
538 | struct ext3_inode_info { | ||
539 | __le32 i_data[15]; /* unconverted */ | ||
540 | __u32 i_flags; | ||
541 | #ifdef EXT3_FRAGMENTS | ||
542 | __u32 i_faddr; | ||
543 | __u8 i_frag_no; | ||
544 | __u8 i_frag_size; | ||
545 | #endif | ||
546 | ext3_fsblk_t i_file_acl; | ||
547 | __u32 i_dir_acl; | ||
548 | __u32 i_dtime; | ||
549 | |||
550 | /* | ||
551 | * i_block_group is the number of the block group which contains | ||
552 | * this file's inode. Constant across the lifetime of the inode, | ||
553 | * it is ued for making block allocation decisions - we try to | ||
554 | * place a file's data blocks near its inode block, and new inodes | ||
555 | * near to their parent directory's inode. | ||
556 | */ | ||
557 | __u32 i_block_group; | ||
558 | unsigned long i_state_flags; /* Dynamic state flags for ext3 */ | ||
559 | |||
560 | /* block reservation info */ | ||
561 | struct ext3_block_alloc_info *i_block_alloc_info; | ||
562 | |||
563 | __u32 i_dir_start_lookup; | ||
564 | #ifdef CONFIG_EXT3_FS_XATTR | ||
565 | /* | ||
566 | * Extended attributes can be read independently of the main file | ||
567 | * data. Taking i_mutex even when reading would cause contention | ||
568 | * between readers of EAs and writers of regular file data, so | ||
569 | * instead we synchronize on xattr_sem when reading or changing | ||
570 | * EAs. | ||
571 | */ | ||
572 | struct rw_semaphore xattr_sem; | ||
573 | #endif | ||
574 | |||
575 | struct list_head i_orphan; /* unlinked but open inodes */ | ||
576 | |||
577 | /* | ||
578 | * i_disksize keeps track of what the inode size is ON DISK, not | ||
579 | * in memory. During truncate, i_size is set to the new size by | ||
580 | * the VFS prior to calling ext3_truncate(), but the filesystem won't | ||
581 | * set i_disksize to 0 until the truncate is actually under way. | ||
582 | * | ||
583 | * The intent is that i_disksize always represents the blocks which | ||
584 | * are used by this file. This allows recovery to restart truncate | ||
585 | * on orphans if we crash during truncate. We actually write i_disksize | ||
586 | * into the on-disk inode when writing inodes out, instead of i_size. | ||
587 | * | ||
588 | * The only time when i_disksize and i_size may be different is when | ||
589 | * a truncate is in progress. The only things which change i_disksize | ||
590 | * are ext3_get_block (growth) and ext3_truncate (shrinkth). | ||
591 | */ | ||
592 | loff_t i_disksize; | ||
593 | |||
594 | /* on-disk additional length */ | ||
595 | __u16 i_extra_isize; | ||
596 | |||
597 | /* | ||
598 | * truncate_mutex is for serialising ext3_truncate() against | ||
599 | * ext3_getblock(). In the 2.4 ext2 design, great chunks of inode's | ||
600 | * data tree are chopped off during truncate. We can't do that in | ||
601 | * ext3 because whenever we perform intermediate commits during | ||
602 | * truncate, the inode and all the metadata blocks *must* be in a | ||
603 | * consistent state which allows truncation of the orphans to restart | ||
604 | * during recovery. Hence we must fix the get_block-vs-truncate race | ||
605 | * by other means, so we have truncate_mutex. | ||
606 | */ | ||
607 | struct mutex truncate_mutex; | ||
608 | |||
609 | /* | ||
610 | * Transactions that contain inode's metadata needed to complete | ||
611 | * fsync and fdatasync, respectively. | ||
612 | */ | ||
613 | atomic_t i_sync_tid; | ||
614 | atomic_t i_datasync_tid; | ||
615 | |||
616 | struct inode vfs_inode; | ||
617 | }; | ||
618 | |||
619 | /* | ||
620 | * third extended-fs super-block data in memory | ||
621 | */ | ||
622 | struct ext3_sb_info { | ||
623 | unsigned long s_frag_size; /* Size of a fragment in bytes */ | ||
624 | unsigned long s_frags_per_block;/* Number of fragments per block */ | ||
625 | unsigned long s_inodes_per_block;/* Number of inodes per block */ | ||
626 | unsigned long s_frags_per_group;/* Number of fragments in a group */ | ||
627 | unsigned long s_blocks_per_group;/* Number of blocks in a group */ | ||
628 | unsigned long s_inodes_per_group;/* Number of inodes in a group */ | ||
629 | unsigned long s_itb_per_group; /* Number of inode table blocks per group */ | ||
630 | unsigned long s_gdb_count; /* Number of group descriptor blocks */ | ||
631 | unsigned long s_desc_per_block; /* Number of group descriptors per block */ | ||
632 | unsigned long s_groups_count; /* Number of groups in the fs */ | ||
633 | unsigned long s_overhead_last; /* Last calculated overhead */ | ||
634 | unsigned long s_blocks_last; /* Last seen block count */ | ||
635 | struct buffer_head * s_sbh; /* Buffer containing the super block */ | ||
636 | struct ext3_super_block * s_es; /* Pointer to the super block in the buffer */ | ||
637 | struct buffer_head ** s_group_desc; | ||
638 | unsigned long s_mount_opt; | ||
639 | ext3_fsblk_t s_sb_block; | ||
640 | uid_t s_resuid; | ||
641 | gid_t s_resgid; | ||
642 | unsigned short s_mount_state; | ||
643 | unsigned short s_pad; | ||
644 | int s_addr_per_block_bits; | ||
645 | int s_desc_per_block_bits; | ||
646 | int s_inode_size; | ||
647 | int s_first_ino; | ||
648 | spinlock_t s_next_gen_lock; | ||
649 | u32 s_next_generation; | ||
650 | u32 s_hash_seed[4]; | ||
651 | int s_def_hash_version; | ||
652 | int s_hash_unsigned; /* 3 if hash should be signed, 0 if not */ | ||
653 | struct percpu_counter s_freeblocks_counter; | ||
654 | struct percpu_counter s_freeinodes_counter; | ||
655 | struct percpu_counter s_dirs_counter; | ||
656 | struct blockgroup_lock *s_blockgroup_lock; | ||
657 | |||
658 | /* root of the per fs reservation window tree */ | ||
659 | spinlock_t s_rsv_window_lock; | ||
660 | struct rb_root s_rsv_window_root; | ||
661 | struct ext3_reserve_window_node s_rsv_window_head; | ||
662 | |||
663 | /* Journaling */ | ||
664 | struct inode * s_journal_inode; | ||
665 | struct journal_s * s_journal; | ||
666 | struct list_head s_orphan; | ||
667 | struct mutex s_orphan_lock; | ||
668 | struct mutex s_resize_lock; | ||
669 | unsigned long s_commit_interval; | ||
670 | struct block_device *journal_bdev; | ||
671 | #ifdef CONFIG_QUOTA | ||
672 | char *s_qf_names[MAXQUOTAS]; /* Names of quota files with journalled quota */ | ||
673 | int s_jquota_fmt; /* Format of quota to use */ | ||
674 | #endif | ||
675 | }; | ||
676 | |||
677 | static inline spinlock_t * | ||
678 | sb_bgl_lock(struct ext3_sb_info *sbi, unsigned int block_group) | ||
679 | { | ||
680 | return bgl_lock_ptr(sbi->s_blockgroup_lock, block_group); | ||
681 | } | ||
682 | |||
537 | static inline struct ext3_sb_info * EXT3_SB(struct super_block *sb) | 683 | static inline struct ext3_sb_info * EXT3_SB(struct super_block *sb) |
538 | { | 684 | { |
539 | return sb->s_fs_info; | 685 | return sb->s_fs_info; |
@@ -576,12 +722,6 @@ static inline void ext3_clear_inode_state(struct inode *inode, int bit) | |||
576 | { | 722 | { |
577 | clear_bit(bit, &EXT3_I(inode)->i_state_flags); | 723 | clear_bit(bit, &EXT3_I(inode)->i_state_flags); |
578 | } | 724 | } |
579 | #else | ||
580 | /* Assume that user mode programs are passing in an ext3fs superblock, not | ||
581 | * a kernel struct super_block. This will allow us to call the feature-test | ||
582 | * macros from user land. */ | ||
583 | #define EXT3_SB(sb) (sb) | ||
584 | #endif | ||
585 | 725 | ||
586 | #define NEXT_ORPHAN(inode) EXT3_I(inode)->i_dtime | 726 | #define NEXT_ORPHAN(inode) EXT3_I(inode)->i_dtime |
587 | 727 | ||
@@ -771,8 +911,6 @@ static inline __le16 ext3_rec_len_to_disk(unsigned len) | |||
771 | #define DX_HASH_HALF_MD4_UNSIGNED 4 | 911 | #define DX_HASH_HALF_MD4_UNSIGNED 4 |
772 | #define DX_HASH_TEA_UNSIGNED 5 | 912 | #define DX_HASH_TEA_UNSIGNED 5 |
773 | 913 | ||
774 | #ifdef __KERNEL__ | ||
775 | |||
776 | /* hash info structure used by the directory hash */ | 914 | /* hash info structure used by the directory hash */ |
777 | struct dx_hash_info | 915 | struct dx_hash_info |
778 | { | 916 | { |
@@ -974,7 +1112,211 @@ extern const struct inode_operations ext3_special_inode_operations; | |||
974 | extern const struct inode_operations ext3_symlink_inode_operations; | 1112 | extern const struct inode_operations ext3_symlink_inode_operations; |
975 | extern const struct inode_operations ext3_fast_symlink_inode_operations; | 1113 | extern const struct inode_operations ext3_fast_symlink_inode_operations; |
976 | 1114 | ||
1115 | #define EXT3_JOURNAL(inode) (EXT3_SB((inode)->i_sb)->s_journal) | ||
1116 | |||
1117 | /* Define the number of blocks we need to account to a transaction to | ||
1118 | * modify one block of data. | ||
1119 | * | ||
1120 | * We may have to touch one inode, one bitmap buffer, up to three | ||
1121 | * indirection blocks, the group and superblock summaries, and the data | ||
1122 | * block to complete the transaction. */ | ||
1123 | |||
1124 | #define EXT3_SINGLEDATA_TRANS_BLOCKS 8U | ||
1125 | |||
1126 | /* Extended attribute operations touch at most two data buffers, | ||
1127 | * two bitmap buffers, and two group summaries, in addition to the inode | ||
1128 | * and the superblock, which are already accounted for. */ | ||
1129 | |||
1130 | #define EXT3_XATTR_TRANS_BLOCKS 6U | ||
1131 | |||
1132 | /* Define the minimum size for a transaction which modifies data. This | ||
1133 | * needs to take into account the fact that we may end up modifying two | ||
1134 | * quota files too (one for the group, one for the user quota). The | ||
1135 | * superblock only gets updated once, of course, so don't bother | ||
1136 | * counting that again for the quota updates. */ | ||
1137 | |||
1138 | #define EXT3_DATA_TRANS_BLOCKS(sb) (EXT3_SINGLEDATA_TRANS_BLOCKS + \ | ||
1139 | EXT3_XATTR_TRANS_BLOCKS - 2 + \ | ||
1140 | EXT3_MAXQUOTAS_TRANS_BLOCKS(sb)) | ||
1141 | |||
1142 | /* Delete operations potentially hit one directory's namespace plus an | ||
1143 | * entire inode, plus arbitrary amounts of bitmap/indirection data. Be | ||
1144 | * generous. We can grow the delete transaction later if necessary. */ | ||
1145 | |||
1146 | #define EXT3_DELETE_TRANS_BLOCKS(sb) (EXT3_MAXQUOTAS_TRANS_BLOCKS(sb) + 64) | ||
1147 | |||
1148 | /* Define an arbitrary limit for the amount of data we will anticipate | ||
1149 | * writing to any given transaction. For unbounded transactions such as | ||
1150 | * write(2) and truncate(2) we can write more than this, but we always | ||
1151 | * start off at the maximum transaction size and grow the transaction | ||
1152 | * optimistically as we go. */ | ||
1153 | |||
1154 | #define EXT3_MAX_TRANS_DATA 64U | ||
1155 | |||
1156 | /* We break up a large truncate or write transaction once the handle's | ||
1157 | * buffer credits gets this low, we need either to extend the | ||
1158 | * transaction or to start a new one. Reserve enough space here for | ||
1159 | * inode, bitmap, superblock, group and indirection updates for at least | ||
1160 | * one block, plus two quota updates. Quota allocations are not | ||
1161 | * needed. */ | ||
1162 | |||
1163 | #define EXT3_RESERVE_TRANS_BLOCKS 12U | ||
1164 | |||
1165 | #define EXT3_INDEX_EXTRA_TRANS_BLOCKS 8 | ||
1166 | |||
1167 | #ifdef CONFIG_QUOTA | ||
1168 | /* Amount of blocks needed for quota update - we know that the structure was | ||
1169 | * allocated so we need to update only inode+data */ | ||
1170 | #define EXT3_QUOTA_TRANS_BLOCKS(sb) (test_opt(sb, QUOTA) ? 2 : 0) | ||
1171 | /* Amount of blocks needed for quota insert/delete - we do some block writes | ||
1172 | * but inode, sb and group updates are done only once */ | ||
1173 | #define EXT3_QUOTA_INIT_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_INIT_ALLOC*\ | ||
1174 | (EXT3_SINGLEDATA_TRANS_BLOCKS-3)+3+DQUOT_INIT_REWRITE) : 0) | ||
1175 | #define EXT3_QUOTA_DEL_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_DEL_ALLOC*\ | ||
1176 | (EXT3_SINGLEDATA_TRANS_BLOCKS-3)+3+DQUOT_DEL_REWRITE) : 0) | ||
1177 | #else | ||
1178 | #define EXT3_QUOTA_TRANS_BLOCKS(sb) 0 | ||
1179 | #define EXT3_QUOTA_INIT_BLOCKS(sb) 0 | ||
1180 | #define EXT3_QUOTA_DEL_BLOCKS(sb) 0 | ||
1181 | #endif | ||
1182 | #define EXT3_MAXQUOTAS_TRANS_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_TRANS_BLOCKS(sb)) | ||
1183 | #define EXT3_MAXQUOTAS_INIT_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_INIT_BLOCKS(sb)) | ||
1184 | #define EXT3_MAXQUOTAS_DEL_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_DEL_BLOCKS(sb)) | ||
1185 | |||
1186 | int | ||
1187 | ext3_mark_iloc_dirty(handle_t *handle, | ||
1188 | struct inode *inode, | ||
1189 | struct ext3_iloc *iloc); | ||
1190 | |||
1191 | /* | ||
1192 | * On success, We end up with an outstanding reference count against | ||
1193 | * iloc->bh. This _must_ be cleaned up later. | ||
1194 | */ | ||
1195 | |||
1196 | int ext3_reserve_inode_write(handle_t *handle, struct inode *inode, | ||
1197 | struct ext3_iloc *iloc); | ||
1198 | |||
1199 | int ext3_mark_inode_dirty(handle_t *handle, struct inode *inode); | ||
1200 | |||
1201 | /* | ||
1202 | * Wrapper functions with which ext3 calls into JBD. The intent here is | ||
1203 | * to allow these to be turned into appropriate stubs so ext3 can control | ||
1204 | * ext2 filesystems, so ext2+ext3 systems only nee one fs. This work hasn't | ||
1205 | * been done yet. | ||
1206 | */ | ||
1207 | |||
1208 | static inline void ext3_journal_release_buffer(handle_t *handle, | ||
1209 | struct buffer_head *bh) | ||
1210 | { | ||
1211 | journal_release_buffer(handle, bh); | ||
1212 | } | ||
1213 | |||
1214 | void ext3_journal_abort_handle(const char *caller, const char *err_fn, | ||
1215 | struct buffer_head *bh, handle_t *handle, int err); | ||
1216 | |||
1217 | int __ext3_journal_get_undo_access(const char *where, handle_t *handle, | ||
1218 | struct buffer_head *bh); | ||
1219 | |||
1220 | int __ext3_journal_get_write_access(const char *where, handle_t *handle, | ||
1221 | struct buffer_head *bh); | ||
1222 | |||
1223 | int __ext3_journal_forget(const char *where, handle_t *handle, | ||
1224 | struct buffer_head *bh); | ||
977 | 1225 | ||
978 | #endif /* __KERNEL__ */ | 1226 | int __ext3_journal_revoke(const char *where, handle_t *handle, |
1227 | unsigned long blocknr, struct buffer_head *bh); | ||
1228 | |||
1229 | int __ext3_journal_get_create_access(const char *where, | ||
1230 | handle_t *handle, struct buffer_head *bh); | ||
1231 | |||
1232 | int __ext3_journal_dirty_metadata(const char *where, | ||
1233 | handle_t *handle, struct buffer_head *bh); | ||
1234 | |||
1235 | #define ext3_journal_get_undo_access(handle, bh) \ | ||
1236 | __ext3_journal_get_undo_access(__func__, (handle), (bh)) | ||
1237 | #define ext3_journal_get_write_access(handle, bh) \ | ||
1238 | __ext3_journal_get_write_access(__func__, (handle), (bh)) | ||
1239 | #define ext3_journal_revoke(handle, blocknr, bh) \ | ||
1240 | __ext3_journal_revoke(__func__, (handle), (blocknr), (bh)) | ||
1241 | #define ext3_journal_get_create_access(handle, bh) \ | ||
1242 | __ext3_journal_get_create_access(__func__, (handle), (bh)) | ||
1243 | #define ext3_journal_dirty_metadata(handle, bh) \ | ||
1244 | __ext3_journal_dirty_metadata(__func__, (handle), (bh)) | ||
1245 | #define ext3_journal_forget(handle, bh) \ | ||
1246 | __ext3_journal_forget(__func__, (handle), (bh)) | ||
1247 | |||
1248 | int ext3_journal_dirty_data(handle_t *handle, struct buffer_head *bh); | ||
1249 | |||
1250 | handle_t *ext3_journal_start_sb(struct super_block *sb, int nblocks); | ||
1251 | int __ext3_journal_stop(const char *where, handle_t *handle); | ||
1252 | |||
1253 | static inline handle_t *ext3_journal_start(struct inode *inode, int nblocks) | ||
1254 | { | ||
1255 | return ext3_journal_start_sb(inode->i_sb, nblocks); | ||
1256 | } | ||
1257 | |||
1258 | #define ext3_journal_stop(handle) \ | ||
1259 | __ext3_journal_stop(__func__, (handle)) | ||
1260 | |||
1261 | static inline handle_t *ext3_journal_current_handle(void) | ||
1262 | { | ||
1263 | return journal_current_handle(); | ||
1264 | } | ||
1265 | |||
1266 | static inline int ext3_journal_extend(handle_t *handle, int nblocks) | ||
1267 | { | ||
1268 | return journal_extend(handle, nblocks); | ||
1269 | } | ||
1270 | |||
1271 | static inline int ext3_journal_restart(handle_t *handle, int nblocks) | ||
1272 | { | ||
1273 | return journal_restart(handle, nblocks); | ||
1274 | } | ||
1275 | |||
1276 | static inline int ext3_journal_blocks_per_page(struct inode *inode) | ||
1277 | { | ||
1278 | return journal_blocks_per_page(inode); | ||
1279 | } | ||
1280 | |||
1281 | static inline int ext3_journal_force_commit(journal_t *journal) | ||
1282 | { | ||
1283 | return journal_force_commit(journal); | ||
1284 | } | ||
1285 | |||
1286 | /* super.c */ | ||
1287 | int ext3_force_commit(struct super_block *sb); | ||
1288 | |||
1289 | static inline int ext3_should_journal_data(struct inode *inode) | ||
1290 | { | ||
1291 | if (!S_ISREG(inode->i_mode)) | ||
1292 | return 1; | ||
1293 | if (test_opt(inode->i_sb, DATA_FLAGS) == EXT3_MOUNT_JOURNAL_DATA) | ||
1294 | return 1; | ||
1295 | if (EXT3_I(inode)->i_flags & EXT3_JOURNAL_DATA_FL) | ||
1296 | return 1; | ||
1297 | return 0; | ||
1298 | } | ||
1299 | |||
1300 | static inline int ext3_should_order_data(struct inode *inode) | ||
1301 | { | ||
1302 | if (!S_ISREG(inode->i_mode)) | ||
1303 | return 0; | ||
1304 | if (EXT3_I(inode)->i_flags & EXT3_JOURNAL_DATA_FL) | ||
1305 | return 0; | ||
1306 | if (test_opt(inode->i_sb, DATA_FLAGS) == EXT3_MOUNT_ORDERED_DATA) | ||
1307 | return 1; | ||
1308 | return 0; | ||
1309 | } | ||
1310 | |||
1311 | static inline int ext3_should_writeback_data(struct inode *inode) | ||
1312 | { | ||
1313 | if (!S_ISREG(inode->i_mode)) | ||
1314 | return 0; | ||
1315 | if (EXT3_I(inode)->i_flags & EXT3_JOURNAL_DATA_FL) | ||
1316 | return 0; | ||
1317 | if (test_opt(inode->i_sb, DATA_FLAGS) == EXT3_MOUNT_WRITEBACK_DATA) | ||
1318 | return 1; | ||
1319 | return 0; | ||
1320 | } | ||
979 | 1321 | ||
980 | #endif /* _LINUX_EXT3_FS_H */ | 1322 | #include <trace/events/ext3.h> |
diff --git a/fs/ext3/ext3_jbd.c b/fs/ext3/ext3_jbd.c index d401f148d74d..785a3261a26c 100644 --- a/fs/ext3/ext3_jbd.c +++ b/fs/ext3/ext3_jbd.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * Interface between ext3 and JBD | 2 | * Interface between ext3 and JBD |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #include <linux/ext3_jbd.h> | 5 | #include "ext3.h" |
6 | 6 | ||
7 | int __ext3_journal_get_undo_access(const char *where, handle_t *handle, | 7 | int __ext3_journal_get_undo_access(const char *where, handle_t *handle, |
8 | struct buffer_head *bh) | 8 | struct buffer_head *bh) |
diff --git a/fs/ext3/file.c b/fs/ext3/file.c index 724df69847dc..25cb413277e9 100644 --- a/fs/ext3/file.c +++ b/fs/ext3/file.c | |||
@@ -18,12 +18,8 @@ | |||
18 | * (jj@sunsite.ms.mff.cuni.cz) | 18 | * (jj@sunsite.ms.mff.cuni.cz) |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/time.h> | ||
22 | #include <linux/fs.h> | ||
23 | #include <linux/jbd.h> | ||
24 | #include <linux/quotaops.h> | 21 | #include <linux/quotaops.h> |
25 | #include <linux/ext3_fs.h> | 22 | #include "ext3.h" |
26 | #include <linux/ext3_jbd.h> | ||
27 | #include "xattr.h" | 23 | #include "xattr.h" |
28 | #include "acl.h" | 24 | #include "acl.h" |
29 | 25 | ||
diff --git a/fs/ext3/fsync.c b/fs/ext3/fsync.c index 1860ed356323..d4dff278cbd8 100644 --- a/fs/ext3/fsync.c +++ b/fs/ext3/fsync.c | |||
@@ -22,15 +22,9 @@ | |||
22 | * we can depend on generic_block_fdatasync() to sync the data blocks. | 22 | * we can depend on generic_block_fdatasync() to sync the data blocks. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <linux/time.h> | ||
26 | #include <linux/blkdev.h> | 25 | #include <linux/blkdev.h> |
27 | #include <linux/fs.h> | ||
28 | #include <linux/sched.h> | ||
29 | #include <linux/writeback.h> | 26 | #include <linux/writeback.h> |
30 | #include <linux/jbd.h> | 27 | #include "ext3.h" |
31 | #include <linux/ext3_fs.h> | ||
32 | #include <linux/ext3_jbd.h> | ||
33 | #include <trace/events/ext3.h> | ||
34 | 28 | ||
35 | /* | 29 | /* |
36 | * akpm: A new design for ext3_sync_file(). | 30 | * akpm: A new design for ext3_sync_file(). |
diff --git a/fs/ext3/hash.c b/fs/ext3/hash.c index 7d215b4d4f2e..d10231ddcf8a 100644 --- a/fs/ext3/hash.c +++ b/fs/ext3/hash.c | |||
@@ -9,9 +9,7 @@ | |||
9 | * License. | 9 | * License. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/fs.h> | 12 | #include "ext3.h" |
13 | #include <linux/jbd.h> | ||
14 | #include <linux/ext3_fs.h> | ||
15 | #include <linux/cryptohash.h> | 13 | #include <linux/cryptohash.h> |
16 | 14 | ||
17 | #define DELTA 0x9E3779B9 | 15 | #define DELTA 0x9E3779B9 |
diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c index 1cde28438014..e3c39e4cec19 100644 --- a/fs/ext3/ialloc.c +++ b/fs/ext3/ialloc.c | |||
@@ -12,21 +12,10 @@ | |||
12 | * David S. Miller (davem@caip.rutgers.edu), 1995 | 12 | * David S. Miller (davem@caip.rutgers.edu), 1995 |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/time.h> | ||
16 | #include <linux/fs.h> | ||
17 | #include <linux/jbd.h> | ||
18 | #include <linux/ext3_fs.h> | ||
19 | #include <linux/ext3_jbd.h> | ||
20 | #include <linux/stat.h> | ||
21 | #include <linux/string.h> | ||
22 | #include <linux/quotaops.h> | 15 | #include <linux/quotaops.h> |
23 | #include <linux/buffer_head.h> | ||
24 | #include <linux/random.h> | 16 | #include <linux/random.h> |
25 | #include <linux/bitops.h> | ||
26 | #include <trace/events/ext3.h> | ||
27 | |||
28 | #include <asm/byteorder.h> | ||
29 | 17 | ||
18 | #include "ext3.h" | ||
30 | #include "xattr.h" | 19 | #include "xattr.h" |
31 | #include "acl.h" | 20 | #include "acl.h" |
32 | 21 | ||
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c index 6d3418662b54..10d7812f6021 100644 --- a/fs/ext3/inode.c +++ b/fs/ext3/inode.c | |||
@@ -22,22 +22,12 @@ | |||
22 | * Assorted race fixes, rewrite of ext3_get_block() by Al Viro, 2000 | 22 | * Assorted race fixes, rewrite of ext3_get_block() by Al Viro, 2000 |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <linux/fs.h> | ||
26 | #include <linux/time.h> | ||
27 | #include <linux/ext3_jbd.h> | ||
28 | #include <linux/jbd.h> | ||
29 | #include <linux/highuid.h> | 25 | #include <linux/highuid.h> |
30 | #include <linux/pagemap.h> | ||
31 | #include <linux/quotaops.h> | 26 | #include <linux/quotaops.h> |
32 | #include <linux/string.h> | ||
33 | #include <linux/buffer_head.h> | ||
34 | #include <linux/writeback.h> | 27 | #include <linux/writeback.h> |
35 | #include <linux/mpage.h> | 28 | #include <linux/mpage.h> |
36 | #include <linux/uio.h> | ||
37 | #include <linux/bio.h> | ||
38 | #include <linux/fiemap.h> | ||
39 | #include <linux/namei.h> | 29 | #include <linux/namei.h> |
40 | #include <trace/events/ext3.h> | 30 | #include "ext3.h" |
41 | #include "xattr.h" | 31 | #include "xattr.h" |
42 | #include "acl.h" | 32 | #include "acl.h" |
43 | 33 | ||
diff --git a/fs/ext3/ioctl.c b/fs/ext3/ioctl.c index 4af574ce4a46..677a5c27dc69 100644 --- a/fs/ext3/ioctl.c +++ b/fs/ext3/ioctl.c | |||
@@ -7,15 +7,10 @@ | |||
7 | * Universite Pierre et Marie Curie (Paris VI) | 7 | * Universite Pierre et Marie Curie (Paris VI) |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/fs.h> | ||
11 | #include <linux/jbd.h> | ||
12 | #include <linux/capability.h> | ||
13 | #include <linux/ext3_fs.h> | ||
14 | #include <linux/ext3_jbd.h> | ||
15 | #include <linux/mount.h> | 10 | #include <linux/mount.h> |
16 | #include <linux/time.h> | ||
17 | #include <linux/compat.h> | 11 | #include <linux/compat.h> |
18 | #include <asm/uaccess.h> | 12 | #include <asm/uaccess.h> |
13 | #include "ext3.h" | ||
19 | 14 | ||
20 | long ext3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | 15 | long ext3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
21 | { | 16 | { |
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c index e8e211795e9f..d7940b24cf68 100644 --- a/fs/ext3/namei.c +++ b/fs/ext3/namei.c | |||
@@ -24,20 +24,8 @@ | |||
24 | * Theodore Ts'o, 2002 | 24 | * Theodore Ts'o, 2002 |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <linux/fs.h> | ||
28 | #include <linux/pagemap.h> | ||
29 | #include <linux/jbd.h> | ||
30 | #include <linux/time.h> | ||
31 | #include <linux/ext3_fs.h> | ||
32 | #include <linux/ext3_jbd.h> | ||
33 | #include <linux/fcntl.h> | ||
34 | #include <linux/stat.h> | ||
35 | #include <linux/string.h> | ||
36 | #include <linux/quotaops.h> | 27 | #include <linux/quotaops.h> |
37 | #include <linux/buffer_head.h> | 28 | #include "ext3.h" |
38 | #include <linux/bio.h> | ||
39 | #include <trace/events/ext3.h> | ||
40 | |||
41 | #include "namei.h" | 29 | #include "namei.h" |
42 | #include "xattr.h" | 30 | #include "xattr.h" |
43 | #include "acl.h" | 31 | #include "acl.h" |
diff --git a/fs/ext3/resize.c b/fs/ext3/resize.c index 7916e4ce166a..0f814f3450de 100644 --- a/fs/ext3/resize.c +++ b/fs/ext3/resize.c | |||
@@ -11,10 +11,7 @@ | |||
11 | 11 | ||
12 | #define EXT3FS_DEBUG | 12 | #define EXT3FS_DEBUG |
13 | 13 | ||
14 | #include <linux/ext3_jbd.h> | 14 | #include "ext3.h" |
15 | |||
16 | #include <linux/errno.h> | ||
17 | #include <linux/slab.h> | ||
18 | 15 | ||
19 | 16 | ||
20 | #define outside(b, first, last) ((b) < (first) || (b) >= (last)) | 17 | #define outside(b, first, last) ((b) < (first) || (b) >= (last)) |
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index e0b45b93327b..cf0b5921cf0f 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -17,22 +17,12 @@ | |||
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
20 | #include <linux/string.h> | ||
21 | #include <linux/fs.h> | ||
22 | #include <linux/time.h> | ||
23 | #include <linux/jbd.h> | ||
24 | #include <linux/ext3_fs.h> | ||
25 | #include <linux/ext3_jbd.h> | ||
26 | #include <linux/slab.h> | ||
27 | #include <linux/init.h> | ||
28 | #include <linux/blkdev.h> | 20 | #include <linux/blkdev.h> |
29 | #include <linux/parser.h> | 21 | #include <linux/parser.h> |
30 | #include <linux/buffer_head.h> | ||
31 | #include <linux/exportfs.h> | 22 | #include <linux/exportfs.h> |
32 | #include <linux/vfs.h> | 23 | #include <linux/statfs.h> |
33 | #include <linux/random.h> | 24 | #include <linux/random.h> |
34 | #include <linux/mount.h> | 25 | #include <linux/mount.h> |
35 | #include <linux/namei.h> | ||
36 | #include <linux/quotaops.h> | 26 | #include <linux/quotaops.h> |
37 | #include <linux/seq_file.h> | 27 | #include <linux/seq_file.h> |
38 | #include <linux/log2.h> | 28 | #include <linux/log2.h> |
@@ -40,13 +30,13 @@ | |||
40 | 30 | ||
41 | #include <asm/uaccess.h> | 31 | #include <asm/uaccess.h> |
42 | 32 | ||
33 | #define CREATE_TRACE_POINTS | ||
34 | |||
35 | #include "ext3.h" | ||
43 | #include "xattr.h" | 36 | #include "xattr.h" |
44 | #include "acl.h" | 37 | #include "acl.h" |
45 | #include "namei.h" | 38 | #include "namei.h" |
46 | 39 | ||
47 | #define CREATE_TRACE_POINTS | ||
48 | #include <trace/events/ext3.h> | ||
49 | |||
50 | #ifdef CONFIG_EXT3_DEFAULTS_TO_ORDERED | 40 | #ifdef CONFIG_EXT3_DEFAULTS_TO_ORDERED |
51 | #define EXT3_MOUNT_DEFAULT_DATA_MODE EXT3_MOUNT_ORDERED_DATA | 41 | #define EXT3_MOUNT_DEFAULT_DATA_MODE EXT3_MOUNT_ORDERED_DATA |
52 | #else | 42 | #else |
diff --git a/fs/ext3/symlink.c b/fs/ext3/symlink.c index 7c4898207776..6b01c3eab1f3 100644 --- a/fs/ext3/symlink.c +++ b/fs/ext3/symlink.c | |||
@@ -17,10 +17,8 @@ | |||
17 | * ext3 symlink handling code | 17 | * ext3 symlink handling code |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <linux/fs.h> | ||
21 | #include <linux/jbd.h> | ||
22 | #include <linux/ext3_fs.h> | ||
23 | #include <linux/namei.h> | 20 | #include <linux/namei.h> |
21 | #include "ext3.h" | ||
24 | #include "xattr.h" | 22 | #include "xattr.h" |
25 | 23 | ||
26 | static void * ext3_follow_link(struct dentry *dentry, struct nameidata *nd) | 24 | static void * ext3_follow_link(struct dentry *dentry, struct nameidata *nd) |
diff --git a/fs/ext3/xattr.c b/fs/ext3/xattr.c index d565759d82ee..d22ebb7a4f55 100644 --- a/fs/ext3/xattr.c +++ b/fs/ext3/xattr.c | |||
@@ -50,14 +50,9 @@ | |||
50 | * by the buffer lock. | 50 | * by the buffer lock. |
51 | */ | 51 | */ |
52 | 52 | ||
53 | #include <linux/init.h> | 53 | #include "ext3.h" |
54 | #include <linux/fs.h> | ||
55 | #include <linux/slab.h> | ||
56 | #include <linux/ext3_jbd.h> | ||
57 | #include <linux/ext3_fs.h> | ||
58 | #include <linux/mbcache.h> | 54 | #include <linux/mbcache.h> |
59 | #include <linux/quotaops.h> | 55 | #include <linux/quotaops.h> |
60 | #include <linux/rwsem.h> | ||
61 | #include "xattr.h" | 56 | #include "xattr.h" |
62 | #include "acl.h" | 57 | #include "acl.h" |
63 | 58 | ||
diff --git a/fs/ext3/xattr_security.c b/fs/ext3/xattr_security.c index ea26f2acab94..3387664ad70e 100644 --- a/fs/ext3/xattr_security.c +++ b/fs/ext3/xattr_security.c | |||
@@ -3,12 +3,8 @@ | |||
3 | * Handler for storing security labels as extended attributes. | 3 | * Handler for storing security labels as extended attributes. |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/slab.h> | ||
7 | #include <linux/string.h> | ||
8 | #include <linux/fs.h> | ||
9 | #include <linux/ext3_jbd.h> | ||
10 | #include <linux/ext3_fs.h> | ||
11 | #include <linux/security.h> | 6 | #include <linux/security.h> |
7 | #include "ext3.h" | ||
12 | #include "xattr.h" | 8 | #include "xattr.h" |
13 | 9 | ||
14 | static size_t | 10 | static size_t |
diff --git a/fs/ext3/xattr_trusted.c b/fs/ext3/xattr_trusted.c index 2526a8829de8..d75727cc67fa 100644 --- a/fs/ext3/xattr_trusted.c +++ b/fs/ext3/xattr_trusted.c | |||
@@ -5,11 +5,7 @@ | |||
5 | * Copyright (C) 2003 by Andreas Gruenbacher, <a.gruenbacher@computer.org> | 5 | * Copyright (C) 2003 by Andreas Gruenbacher, <a.gruenbacher@computer.org> |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <linux/string.h> | 8 | #include "ext3.h" |
9 | #include <linux/capability.h> | ||
10 | #include <linux/fs.h> | ||
11 | #include <linux/ext3_jbd.h> | ||
12 | #include <linux/ext3_fs.h> | ||
13 | #include "xattr.h" | 9 | #include "xattr.h" |
14 | 10 | ||
15 | static size_t | 11 | static size_t |
diff --git a/fs/ext3/xattr_user.c b/fs/ext3/xattr_user.c index b32e473a1e33..5612af3567e0 100644 --- a/fs/ext3/xattr_user.c +++ b/fs/ext3/xattr_user.c | |||
@@ -5,10 +5,7 @@ | |||
5 | * Copyright (C) 2001 by Andreas Gruenbacher, <a.gruenbacher@computer.org> | 5 | * Copyright (C) 2001 by Andreas Gruenbacher, <a.gruenbacher@computer.org> |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <linux/string.h> | 8 | #include "ext3.h" |
9 | #include <linux/fs.h> | ||
10 | #include <linux/ext3_jbd.h> | ||
11 | #include <linux/ext3_fs.h> | ||
12 | #include "xattr.h" | 9 | #include "xattr.h" |
13 | 10 | ||
14 | static size_t | 11 | static size_t |
diff --git a/include/linux/ext3_fs_i.h b/include/linux/ext3_fs_i.h deleted file mode 100644 index f42c098aed8d..000000000000 --- a/include/linux/ext3_fs_i.h +++ /dev/null | |||
@@ -1,151 +0,0 @@ | |||
1 | /* | ||
2 | * linux/include/linux/ext3_fs_i.h | ||
3 | * | ||
4 | * Copyright (C) 1992, 1993, 1994, 1995 | ||
5 | * Remy Card (card@masi.ibp.fr) | ||
6 | * Laboratoire MASI - Institut Blaise Pascal | ||
7 | * Universite Pierre et Marie Curie (Paris VI) | ||
8 | * | ||
9 | * from | ||
10 | * | ||
11 | * linux/include/linux/minix_fs_i.h | ||
12 | * | ||
13 | * Copyright (C) 1991, 1992 Linus Torvalds | ||
14 | */ | ||
15 | |||
16 | #ifndef _LINUX_EXT3_FS_I | ||
17 | #define _LINUX_EXT3_FS_I | ||
18 | |||
19 | #include <linux/rwsem.h> | ||
20 | #include <linux/rbtree.h> | ||
21 | #include <linux/seqlock.h> | ||
22 | #include <linux/mutex.h> | ||
23 | |||
24 | /* data type for block offset of block group */ | ||
25 | typedef int ext3_grpblk_t; | ||
26 | |||
27 | /* data type for filesystem-wide blocks number */ | ||
28 | typedef unsigned long ext3_fsblk_t; | ||
29 | |||
30 | #define E3FSBLK "%lu" | ||
31 | |||
32 | struct ext3_reserve_window { | ||
33 | ext3_fsblk_t _rsv_start; /* First byte reserved */ | ||
34 | ext3_fsblk_t _rsv_end; /* Last byte reserved or 0 */ | ||
35 | }; | ||
36 | |||
37 | struct ext3_reserve_window_node { | ||
38 | struct rb_node rsv_node; | ||
39 | __u32 rsv_goal_size; | ||
40 | __u32 rsv_alloc_hit; | ||
41 | struct ext3_reserve_window rsv_window; | ||
42 | }; | ||
43 | |||
44 | struct ext3_block_alloc_info { | ||
45 | /* information about reservation window */ | ||
46 | struct ext3_reserve_window_node rsv_window_node; | ||
47 | /* | ||
48 | * was i_next_alloc_block in ext3_inode_info | ||
49 | * is the logical (file-relative) number of the | ||
50 | * most-recently-allocated block in this file. | ||
51 | * We use this for detecting linearly ascending allocation requests. | ||
52 | */ | ||
53 | __u32 last_alloc_logical_block; | ||
54 | /* | ||
55 | * Was i_next_alloc_goal in ext3_inode_info | ||
56 | * is the *physical* companion to i_next_alloc_block. | ||
57 | * it the physical block number of the block which was most-recentl | ||
58 | * allocated to this file. This give us the goal (target) for the next | ||
59 | * allocation when we detect linearly ascending requests. | ||
60 | */ | ||
61 | ext3_fsblk_t last_alloc_physical_block; | ||
62 | }; | ||
63 | |||
64 | #define rsv_start rsv_window._rsv_start | ||
65 | #define rsv_end rsv_window._rsv_end | ||
66 | |||
67 | /* | ||
68 | * third extended file system inode data in memory | ||
69 | */ | ||
70 | struct ext3_inode_info { | ||
71 | __le32 i_data[15]; /* unconverted */ | ||
72 | __u32 i_flags; | ||
73 | #ifdef EXT3_FRAGMENTS | ||
74 | __u32 i_faddr; | ||
75 | __u8 i_frag_no; | ||
76 | __u8 i_frag_size; | ||
77 | #endif | ||
78 | ext3_fsblk_t i_file_acl; | ||
79 | __u32 i_dir_acl; | ||
80 | __u32 i_dtime; | ||
81 | |||
82 | /* | ||
83 | * i_block_group is the number of the block group which contains | ||
84 | * this file's inode. Constant across the lifetime of the inode, | ||
85 | * it is ued for making block allocation decisions - we try to | ||
86 | * place a file's data blocks near its inode block, and new inodes | ||
87 | * near to their parent directory's inode. | ||
88 | */ | ||
89 | __u32 i_block_group; | ||
90 | unsigned long i_state_flags; /* Dynamic state flags for ext3 */ | ||
91 | |||
92 | /* block reservation info */ | ||
93 | struct ext3_block_alloc_info *i_block_alloc_info; | ||
94 | |||
95 | __u32 i_dir_start_lookup; | ||
96 | #ifdef CONFIG_EXT3_FS_XATTR | ||
97 | /* | ||
98 | * Extended attributes can be read independently of the main file | ||
99 | * data. Taking i_mutex even when reading would cause contention | ||
100 | * between readers of EAs and writers of regular file data, so | ||
101 | * instead we synchronize on xattr_sem when reading or changing | ||
102 | * EAs. | ||
103 | */ | ||
104 | struct rw_semaphore xattr_sem; | ||
105 | #endif | ||
106 | |||
107 | struct list_head i_orphan; /* unlinked but open inodes */ | ||
108 | |||
109 | /* | ||
110 | * i_disksize keeps track of what the inode size is ON DISK, not | ||
111 | * in memory. During truncate, i_size is set to the new size by | ||
112 | * the VFS prior to calling ext3_truncate(), but the filesystem won't | ||
113 | * set i_disksize to 0 until the truncate is actually under way. | ||
114 | * | ||
115 | * The intent is that i_disksize always represents the blocks which | ||
116 | * are used by this file. This allows recovery to restart truncate | ||
117 | * on orphans if we crash during truncate. We actually write i_disksize | ||
118 | * into the on-disk inode when writing inodes out, instead of i_size. | ||
119 | * | ||
120 | * The only time when i_disksize and i_size may be different is when | ||
121 | * a truncate is in progress. The only things which change i_disksize | ||
122 | * are ext3_get_block (growth) and ext3_truncate (shrinkth). | ||
123 | */ | ||
124 | loff_t i_disksize; | ||
125 | |||
126 | /* on-disk additional length */ | ||
127 | __u16 i_extra_isize; | ||
128 | |||
129 | /* | ||
130 | * truncate_mutex is for serialising ext3_truncate() against | ||
131 | * ext3_getblock(). In the 2.4 ext2 design, great chunks of inode's | ||
132 | * data tree are chopped off during truncate. We can't do that in | ||
133 | * ext3 because whenever we perform intermediate commits during | ||
134 | * truncate, the inode and all the metadata blocks *must* be in a | ||
135 | * consistent state which allows truncation of the orphans to restart | ||
136 | * during recovery. Hence we must fix the get_block-vs-truncate race | ||
137 | * by other means, so we have truncate_mutex. | ||
138 | */ | ||
139 | struct mutex truncate_mutex; | ||
140 | |||
141 | /* | ||
142 | * Transactions that contain inode's metadata needed to complete | ||
143 | * fsync and fdatasync, respectively. | ||
144 | */ | ||
145 | atomic_t i_sync_tid; | ||
146 | atomic_t i_datasync_tid; | ||
147 | |||
148 | struct inode vfs_inode; | ||
149 | }; | ||
150 | |||
151 | #endif /* _LINUX_EXT3_FS_I */ | ||
diff --git a/include/linux/ext3_fs_sb.h b/include/linux/ext3_fs_sb.h deleted file mode 100644 index 64365252f1b0..000000000000 --- a/include/linux/ext3_fs_sb.h +++ /dev/null | |||
@@ -1,91 +0,0 @@ | |||
1 | /* | ||
2 | * linux/include/linux/ext3_fs_sb.h | ||
3 | * | ||
4 | * Copyright (C) 1992, 1993, 1994, 1995 | ||
5 | * Remy Card (card@masi.ibp.fr) | ||
6 | * Laboratoire MASI - Institut Blaise Pascal | ||
7 | * Universite Pierre et Marie Curie (Paris VI) | ||
8 | * | ||
9 | * from | ||
10 | * | ||
11 | * linux/include/linux/minix_fs_sb.h | ||
12 | * | ||
13 | * Copyright (C) 1991, 1992 Linus Torvalds | ||
14 | */ | ||
15 | |||
16 | #ifndef _LINUX_EXT3_FS_SB | ||
17 | #define _LINUX_EXT3_FS_SB | ||
18 | |||
19 | #ifdef __KERNEL__ | ||
20 | #include <linux/timer.h> | ||
21 | #include <linux/wait.h> | ||
22 | #include <linux/blockgroup_lock.h> | ||
23 | #include <linux/percpu_counter.h> | ||
24 | #endif | ||
25 | #include <linux/rbtree.h> | ||
26 | |||
27 | /* | ||
28 | * third extended-fs super-block data in memory | ||
29 | */ | ||
30 | struct ext3_sb_info { | ||
31 | unsigned long s_frag_size; /* Size of a fragment in bytes */ | ||
32 | unsigned long s_frags_per_block;/* Number of fragments per block */ | ||
33 | unsigned long s_inodes_per_block;/* Number of inodes per block */ | ||
34 | unsigned long s_frags_per_group;/* Number of fragments in a group */ | ||
35 | unsigned long s_blocks_per_group;/* Number of blocks in a group */ | ||
36 | unsigned long s_inodes_per_group;/* Number of inodes in a group */ | ||
37 | unsigned long s_itb_per_group; /* Number of inode table blocks per group */ | ||
38 | unsigned long s_gdb_count; /* Number of group descriptor blocks */ | ||
39 | unsigned long s_desc_per_block; /* Number of group descriptors per block */ | ||
40 | unsigned long s_groups_count; /* Number of groups in the fs */ | ||
41 | unsigned long s_overhead_last; /* Last calculated overhead */ | ||
42 | unsigned long s_blocks_last; /* Last seen block count */ | ||
43 | struct buffer_head * s_sbh; /* Buffer containing the super block */ | ||
44 | struct ext3_super_block * s_es; /* Pointer to the super block in the buffer */ | ||
45 | struct buffer_head ** s_group_desc; | ||
46 | unsigned long s_mount_opt; | ||
47 | ext3_fsblk_t s_sb_block; | ||
48 | uid_t s_resuid; | ||
49 | gid_t s_resgid; | ||
50 | unsigned short s_mount_state; | ||
51 | unsigned short s_pad; | ||
52 | int s_addr_per_block_bits; | ||
53 | int s_desc_per_block_bits; | ||
54 | int s_inode_size; | ||
55 | int s_first_ino; | ||
56 | spinlock_t s_next_gen_lock; | ||
57 | u32 s_next_generation; | ||
58 | u32 s_hash_seed[4]; | ||
59 | int s_def_hash_version; | ||
60 | int s_hash_unsigned; /* 3 if hash should be signed, 0 if not */ | ||
61 | struct percpu_counter s_freeblocks_counter; | ||
62 | struct percpu_counter s_freeinodes_counter; | ||
63 | struct percpu_counter s_dirs_counter; | ||
64 | struct blockgroup_lock *s_blockgroup_lock; | ||
65 | |||
66 | /* root of the per fs reservation window tree */ | ||
67 | spinlock_t s_rsv_window_lock; | ||
68 | struct rb_root s_rsv_window_root; | ||
69 | struct ext3_reserve_window_node s_rsv_window_head; | ||
70 | |||
71 | /* Journaling */ | ||
72 | struct inode * s_journal_inode; | ||
73 | struct journal_s * s_journal; | ||
74 | struct list_head s_orphan; | ||
75 | struct mutex s_orphan_lock; | ||
76 | struct mutex s_resize_lock; | ||
77 | unsigned long s_commit_interval; | ||
78 | struct block_device *journal_bdev; | ||
79 | #ifdef CONFIG_QUOTA | ||
80 | char *s_qf_names[MAXQUOTAS]; /* Names of quota files with journalled quota */ | ||
81 | int s_jquota_fmt; /* Format of quota to use */ | ||
82 | #endif | ||
83 | }; | ||
84 | |||
85 | static inline spinlock_t * | ||
86 | sb_bgl_lock(struct ext3_sb_info *sbi, unsigned int block_group) | ||
87 | { | ||
88 | return bgl_lock_ptr(sbi->s_blockgroup_lock, block_group); | ||
89 | } | ||
90 | |||
91 | #endif /* _LINUX_EXT3_FS_SB */ | ||
diff --git a/include/linux/ext3_jbd.h b/include/linux/ext3_jbd.h deleted file mode 100644 index d7b5ddca99c2..000000000000 --- a/include/linux/ext3_jbd.h +++ /dev/null | |||
@@ -1,229 +0,0 @@ | |||
1 | /* | ||
2 | * linux/include/linux/ext3_jbd.h | ||
3 | * | ||
4 | * Written by Stephen C. Tweedie <sct@redhat.com>, 1999 | ||
5 | * | ||
6 | * Copyright 1998--1999 Red Hat corp --- All Rights Reserved | ||
7 | * | ||
8 | * This file is part of the Linux kernel and is made available under | ||
9 | * the terms of the GNU General Public License, version 2, or at your | ||
10 | * option, any later version, incorporated herein by reference. | ||
11 | * | ||
12 | * Ext3-specific journaling extensions. | ||
13 | */ | ||
14 | |||
15 | #ifndef _LINUX_EXT3_JBD_H | ||
16 | #define _LINUX_EXT3_JBD_H | ||
17 | |||
18 | #include <linux/fs.h> | ||
19 | #include <linux/jbd.h> | ||
20 | #include <linux/ext3_fs.h> | ||
21 | |||
22 | #define EXT3_JOURNAL(inode) (EXT3_SB((inode)->i_sb)->s_journal) | ||
23 | |||
24 | /* Define the number of blocks we need to account to a transaction to | ||
25 | * modify one block of data. | ||
26 | * | ||
27 | * We may have to touch one inode, one bitmap buffer, up to three | ||
28 | * indirection blocks, the group and superblock summaries, and the data | ||
29 | * block to complete the transaction. */ | ||
30 | |||
31 | #define EXT3_SINGLEDATA_TRANS_BLOCKS 8U | ||
32 | |||
33 | /* Extended attribute operations touch at most two data buffers, | ||
34 | * two bitmap buffers, and two group summaries, in addition to the inode | ||
35 | * and the superblock, which are already accounted for. */ | ||
36 | |||
37 | #define EXT3_XATTR_TRANS_BLOCKS 6U | ||
38 | |||
39 | /* Define the minimum size for a transaction which modifies data. This | ||
40 | * needs to take into account the fact that we may end up modifying two | ||
41 | * quota files too (one for the group, one for the user quota). The | ||
42 | * superblock only gets updated once, of course, so don't bother | ||
43 | * counting that again for the quota updates. */ | ||
44 | |||
45 | #define EXT3_DATA_TRANS_BLOCKS(sb) (EXT3_SINGLEDATA_TRANS_BLOCKS + \ | ||
46 | EXT3_XATTR_TRANS_BLOCKS - 2 + \ | ||
47 | EXT3_MAXQUOTAS_TRANS_BLOCKS(sb)) | ||
48 | |||
49 | /* Delete operations potentially hit one directory's namespace plus an | ||
50 | * entire inode, plus arbitrary amounts of bitmap/indirection data. Be | ||
51 | * generous. We can grow the delete transaction later if necessary. */ | ||
52 | |||
53 | #define EXT3_DELETE_TRANS_BLOCKS(sb) (EXT3_MAXQUOTAS_TRANS_BLOCKS(sb) + 64) | ||
54 | |||
55 | /* Define an arbitrary limit for the amount of data we will anticipate | ||
56 | * writing to any given transaction. For unbounded transactions such as | ||
57 | * write(2) and truncate(2) we can write more than this, but we always | ||
58 | * start off at the maximum transaction size and grow the transaction | ||
59 | * optimistically as we go. */ | ||
60 | |||
61 | #define EXT3_MAX_TRANS_DATA 64U | ||
62 | |||
63 | /* We break up a large truncate or write transaction once the handle's | ||
64 | * buffer credits gets this low, we need either to extend the | ||
65 | * transaction or to start a new one. Reserve enough space here for | ||
66 | * inode, bitmap, superblock, group and indirection updates for at least | ||
67 | * one block, plus two quota updates. Quota allocations are not | ||
68 | * needed. */ | ||
69 | |||
70 | #define EXT3_RESERVE_TRANS_BLOCKS 12U | ||
71 | |||
72 | #define EXT3_INDEX_EXTRA_TRANS_BLOCKS 8 | ||
73 | |||
74 | #ifdef CONFIG_QUOTA | ||
75 | /* Amount of blocks needed for quota update - we know that the structure was | ||
76 | * allocated so we need to update only inode+data */ | ||
77 | #define EXT3_QUOTA_TRANS_BLOCKS(sb) (test_opt(sb, QUOTA) ? 2 : 0) | ||
78 | /* Amount of blocks needed for quota insert/delete - we do some block writes | ||
79 | * but inode, sb and group updates are done only once */ | ||
80 | #define EXT3_QUOTA_INIT_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_INIT_ALLOC*\ | ||
81 | (EXT3_SINGLEDATA_TRANS_BLOCKS-3)+3+DQUOT_INIT_REWRITE) : 0) | ||
82 | #define EXT3_QUOTA_DEL_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_DEL_ALLOC*\ | ||
83 | (EXT3_SINGLEDATA_TRANS_BLOCKS-3)+3+DQUOT_DEL_REWRITE) : 0) | ||
84 | #else | ||
85 | #define EXT3_QUOTA_TRANS_BLOCKS(sb) 0 | ||
86 | #define EXT3_QUOTA_INIT_BLOCKS(sb) 0 | ||
87 | #define EXT3_QUOTA_DEL_BLOCKS(sb) 0 | ||
88 | #endif | ||
89 | #define EXT3_MAXQUOTAS_TRANS_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_TRANS_BLOCKS(sb)) | ||
90 | #define EXT3_MAXQUOTAS_INIT_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_INIT_BLOCKS(sb)) | ||
91 | #define EXT3_MAXQUOTAS_DEL_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_DEL_BLOCKS(sb)) | ||
92 | |||
93 | int | ||
94 | ext3_mark_iloc_dirty(handle_t *handle, | ||
95 | struct inode *inode, | ||
96 | struct ext3_iloc *iloc); | ||
97 | |||
98 | /* | ||
99 | * On success, We end up with an outstanding reference count against | ||
100 | * iloc->bh. This _must_ be cleaned up later. | ||
101 | */ | ||
102 | |||
103 | int ext3_reserve_inode_write(handle_t *handle, struct inode *inode, | ||
104 | struct ext3_iloc *iloc); | ||
105 | |||
106 | int ext3_mark_inode_dirty(handle_t *handle, struct inode *inode); | ||
107 | |||
108 | /* | ||
109 | * Wrapper functions with which ext3 calls into JBD. The intent here is | ||
110 | * to allow these to be turned into appropriate stubs so ext3 can control | ||
111 | * ext2 filesystems, so ext2+ext3 systems only nee one fs. This work hasn't | ||
112 | * been done yet. | ||
113 | */ | ||
114 | |||
115 | static inline void ext3_journal_release_buffer(handle_t *handle, | ||
116 | struct buffer_head *bh) | ||
117 | { | ||
118 | journal_release_buffer(handle, bh); | ||
119 | } | ||
120 | |||
121 | void ext3_journal_abort_handle(const char *caller, const char *err_fn, | ||
122 | struct buffer_head *bh, handle_t *handle, int err); | ||
123 | |||
124 | int __ext3_journal_get_undo_access(const char *where, handle_t *handle, | ||
125 | struct buffer_head *bh); | ||
126 | |||
127 | int __ext3_journal_get_write_access(const char *where, handle_t *handle, | ||
128 | struct buffer_head *bh); | ||
129 | |||
130 | int __ext3_journal_forget(const char *where, handle_t *handle, | ||
131 | struct buffer_head *bh); | ||
132 | |||
133 | int __ext3_journal_revoke(const char *where, handle_t *handle, | ||
134 | unsigned long blocknr, struct buffer_head *bh); | ||
135 | |||
136 | int __ext3_journal_get_create_access(const char *where, | ||
137 | handle_t *handle, struct buffer_head *bh); | ||
138 | |||
139 | int __ext3_journal_dirty_metadata(const char *where, | ||
140 | handle_t *handle, struct buffer_head *bh); | ||
141 | |||
142 | #define ext3_journal_get_undo_access(handle, bh) \ | ||
143 | __ext3_journal_get_undo_access(__func__, (handle), (bh)) | ||
144 | #define ext3_journal_get_write_access(handle, bh) \ | ||
145 | __ext3_journal_get_write_access(__func__, (handle), (bh)) | ||
146 | #define ext3_journal_revoke(handle, blocknr, bh) \ | ||
147 | __ext3_journal_revoke(__func__, (handle), (blocknr), (bh)) | ||
148 | #define ext3_journal_get_create_access(handle, bh) \ | ||
149 | __ext3_journal_get_create_access(__func__, (handle), (bh)) | ||
150 | #define ext3_journal_dirty_metadata(handle, bh) \ | ||
151 | __ext3_journal_dirty_metadata(__func__, (handle), (bh)) | ||
152 | #define ext3_journal_forget(handle, bh) \ | ||
153 | __ext3_journal_forget(__func__, (handle), (bh)) | ||
154 | |||
155 | int ext3_journal_dirty_data(handle_t *handle, struct buffer_head *bh); | ||
156 | |||
157 | handle_t *ext3_journal_start_sb(struct super_block *sb, int nblocks); | ||
158 | int __ext3_journal_stop(const char *where, handle_t *handle); | ||
159 | |||
160 | static inline handle_t *ext3_journal_start(struct inode *inode, int nblocks) | ||
161 | { | ||
162 | return ext3_journal_start_sb(inode->i_sb, nblocks); | ||
163 | } | ||
164 | |||
165 | #define ext3_journal_stop(handle) \ | ||
166 | __ext3_journal_stop(__func__, (handle)) | ||
167 | |||
168 | static inline handle_t *ext3_journal_current_handle(void) | ||
169 | { | ||
170 | return journal_current_handle(); | ||
171 | } | ||
172 | |||
173 | static inline int ext3_journal_extend(handle_t *handle, int nblocks) | ||
174 | { | ||
175 | return journal_extend(handle, nblocks); | ||
176 | } | ||
177 | |||
178 | static inline int ext3_journal_restart(handle_t *handle, int nblocks) | ||
179 | { | ||
180 | return journal_restart(handle, nblocks); | ||
181 | } | ||
182 | |||
183 | static inline int ext3_journal_blocks_per_page(struct inode *inode) | ||
184 | { | ||
185 | return journal_blocks_per_page(inode); | ||
186 | } | ||
187 | |||
188 | static inline int ext3_journal_force_commit(journal_t *journal) | ||
189 | { | ||
190 | return journal_force_commit(journal); | ||
191 | } | ||
192 | |||
193 | /* super.c */ | ||
194 | int ext3_force_commit(struct super_block *sb); | ||
195 | |||
196 | static inline int ext3_should_journal_data(struct inode *inode) | ||
197 | { | ||
198 | if (!S_ISREG(inode->i_mode)) | ||
199 | return 1; | ||
200 | if (test_opt(inode->i_sb, DATA_FLAGS) == EXT3_MOUNT_JOURNAL_DATA) | ||
201 | return 1; | ||
202 | if (EXT3_I(inode)->i_flags & EXT3_JOURNAL_DATA_FL) | ||
203 | return 1; | ||
204 | return 0; | ||
205 | } | ||
206 | |||
207 | static inline int ext3_should_order_data(struct inode *inode) | ||
208 | { | ||
209 | if (!S_ISREG(inode->i_mode)) | ||
210 | return 0; | ||
211 | if (EXT3_I(inode)->i_flags & EXT3_JOURNAL_DATA_FL) | ||
212 | return 0; | ||
213 | if (test_opt(inode->i_sb, DATA_FLAGS) == EXT3_MOUNT_ORDERED_DATA) | ||
214 | return 1; | ||
215 | return 0; | ||
216 | } | ||
217 | |||
218 | static inline int ext3_should_writeback_data(struct inode *inode) | ||
219 | { | ||
220 | if (!S_ISREG(inode->i_mode)) | ||
221 | return 0; | ||
222 | if (EXT3_I(inode)->i_flags & EXT3_JOURNAL_DATA_FL) | ||
223 | return 0; | ||
224 | if (test_opt(inode->i_sb, DATA_FLAGS) == EXT3_MOUNT_WRITEBACK_DATA) | ||
225 | return 1; | ||
226 | return 0; | ||
227 | } | ||
228 | |||
229 | #endif /* _LINUX_EXT3_JBD_H */ | ||