Skip to content

Commit 2ac232f

Browse files
committed
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs-2.6
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs-2.6: jbd: change the field "b_cow_tid" of struct journal_head from type unsigned to tid_t ext3.txt: update the links in the section "useful links" to the latest ones ext3: Fix data corruption in inodes with journalled data ext2: check xattr name_len before acquiring xattr_sem in ext2_xattr_get ext3: Fix compilation with -DDX_DEBUG quota: Remove unused declaration jbd: Use WRITE_SYNC in journal checkpoint. jbd: Fix oops in journal_remove_journal_head() ext3: Return -EINVAL when start is beyond the end of fs in ext3_trim_fs() ext3/ioctl.c: silence sparse warnings about different address spaces ext3/ext4 Documentation: remove bh/nobh since it has been deprecated ext3: Improve truncate error handling ext3: use proper little-endian bitops ext2: include fs.h into ext2_fs.h ext3: Fix oops in ext3_try_to_allocate_with_rsv() jbd: fix a bug of leaking jh->b_jcount jbd: remove dependency on __GFP_NOFAIL ext3: Convert ext3 to new truncate calling convention jbd: Add fixed tracepoints ext3: Add fixed tracepoints Resolve conflicts in fs/ext3/fsync.c due to fsync locking push-down and new fixed tracepoints.
2 parents fa8f53a + 5cf49d7 commit 2ac232f

23 files changed

Lines changed: 1420 additions & 271 deletions

File tree

‎Documentation/filesystems/ext3.txt‎

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -147,15 +147,6 @@ grpjquota=<file> during journal replay. They replace the above
147147
package for more details
148148
(http://sourceforge.net/projects/linuxquota).
149149

150-
bh (*) ext3 associates buffer heads to data pages to
151-
nobh (a) cache disk block mapping information
152-
(b) link pages into transaction to provide
153-
ordering guarantees.
154-
"bh" option forces use of buffer heads.
155-
"nobh" option tries to avoid associating buffer
156-
heads (supported only for "writeback" mode).
157-
158-
159150
Specification
160151
=============
161152
Ext3 shares all disk implementation with the ext2 filesystem, and adds
@@ -227,5 +218,5 @@ kernel source: <file:fs/ext3/>
227218
programs: http://e2fsprogs.sourceforge.net/
228219
http://ext2resize.sourceforge.net
229220

230-
useful links: http://www.ibm.com/developerworks/library/l-fs7.html
231-
http://www.ibm.com/developerworks/library/l-fs8.html
221+
useful links: http://www.ibm.com/developerworks/library/l-fs7/index.html
222+
http://www.ibm.com/developerworks/library/l-fs8/index.html

‎Documentation/filesystems/ext4.txt‎

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ Note: More extensive information for getting started with ext4 can be
6868
'-o barriers=[0|1]' mount option for both ext3 and ext4 filesystems
6969
for a fair comparison. When tuning ext3 for best benchmark numbers,
7070
it is often worthwhile to try changing the data journaling mode; '-o
71-
data=writeback,nobh' can be faster for some workloads. (Note
72-
however that running mounted with data=writeback can potentially
73-
leave stale data exposed in recently written files in case of an
74-
unclean shutdown, which could be a security exposure in some
75-
situations.) Configuring the filesystem with a large journal can
76-
also be helpful for metadata-intensive workloads.
71+
data=writeback' can be faster for some workloads. (Note however that
72+
running mounted with data=writeback can potentially leave stale data
73+
exposed in recently written files in case of an unclean shutdown,
74+
which could be a security exposure in some situations.) Configuring
75+
the filesystem with a large journal can also be helpful for
76+
metadata-intensive workloads.
7777

7878
2. Features
7979
===========
@@ -272,14 +272,6 @@ grpjquota=<file> during journal replay. They replace the above
272272
package for more details
273273
(http://sourceforge.net/projects/linuxquota).
274274

275-
bh (*) ext4 associates buffer heads to data pages to
276-
nobh (a) cache disk block mapping information
277-
(b) link pages into transaction to provide
278-
ordering guarantees.
279-
"bh" option forces use of buffer heads.
280-
"nobh" option tries to avoid associating buffer
281-
heads (supported only for "writeback" mode).
282-
283275
stripe=n Number of filesystem blocks that mballoc will try
284276
to use for allocation size and alignment. For RAID5/6
285277
systems this should be the number of data
@@ -393,8 +385,7 @@ dioread_nolock locking. If the dioread_nolock option is specified
393385
write and convert the extent to initialized after IO
394386
completes. This approach allows ext4 code to avoid
395387
using inode mutex, which improves scalability on high
396-
speed storages. However this does not work with nobh
397-
option and the mount will fail. Nor does it work with
388+
speed storages. However this does not work with
398389
data journaling and dioread_nolock option will be
399390
ignored with kernel warning. Note that dioread_nolock
400391
code path is only used for extent-based files.

‎fs/ext2/xattr.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ ext2_xattr_get(struct inode *inode, int name_index, const char *name,
161161

162162
if (name == NULL)
163163
return -EINVAL;
164+
name_len = strlen(name);
165+
if (name_len > 255)
166+
return -ERANGE;
167+
164168
down_read(&EXT2_I(inode)->xattr_sem);
165169
error = -ENODATA;
166170
if (!EXT2_I(inode)->i_file_acl)
@@ -181,12 +185,8 @@ bad_block: ext2_error(inode->i_sb, "ext2_xattr_get",
181185
error = -EIO;
182186
goto cleanup;
183187
}
184-
/* find named attribute */
185-
name_len = strlen(name);
186188

187-
error = -ERANGE;
188-
if (name_len > 255)
189-
goto cleanup;
189+
/* find named attribute */
190190
entry = FIRST_ENTRY(bh);
191191
while (!IS_LAST_ENTRY(entry)) {
192192
struct ext2_xattr_entry *next =

‎fs/ext3/balloc.c‎

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <linux/quotaops.h>
2222
#include <linux/buffer_head.h>
2323
#include <linux/blkdev.h>
24+
#include <trace/events/ext3.h>
2425

2526
/*
2627
* balloc.c contains the blocks allocation and deallocation routines
@@ -161,6 +162,7 @@ read_block_bitmap(struct super_block *sb, unsigned int block_group)
161162
desc = ext3_get_group_desc(sb, block_group, NULL);
162163
if (!desc)
163164
return NULL;
165+
trace_ext3_read_block_bitmap(sb, block_group);
164166
bitmap_blk = le32_to_cpu(desc->bg_block_bitmap);
165167
bh = sb_getblk(sb, bitmap_blk);
166168
if (unlikely(!bh)) {
@@ -351,6 +353,7 @@ void ext3_rsv_window_add(struct super_block *sb,
351353
struct rb_node * parent = NULL;
352354
struct ext3_reserve_window_node *this;
353355

356+
trace_ext3_rsv_window_add(sb, rsv);
354357
while (*p)
355358
{
356359
parent = *p;
@@ -476,8 +479,10 @@ void ext3_discard_reservation(struct inode *inode)
476479
rsv = &block_i->rsv_window_node;
477480
if (!rsv_is_empty(&rsv->rsv_window)) {
478481
spin_lock(rsv_lock);
479-
if (!rsv_is_empty(&rsv->rsv_window))
482+
if (!rsv_is_empty(&rsv->rsv_window)) {
483+
trace_ext3_discard_reservation(inode, rsv);
480484
rsv_window_remove(inode->i_sb, rsv);
485+
}
481486
spin_unlock(rsv_lock);
482487
}
483488
}
@@ -683,14 +688,10 @@ void ext3_free_blocks_sb(handle_t *handle, struct super_block *sb,
683688
void ext3_free_blocks(handle_t *handle, struct inode *inode,
684689
ext3_fsblk_t block, unsigned long count)
685690
{
686-
struct super_block * sb;
691+
struct super_block *sb = inode->i_sb;
687692
unsigned long dquot_freed_blocks;
688693

689-
sb = inode->i_sb;
690-
if (!sb) {
691-
printk ("ext3_free_blocks: nonexistent device");
692-
return;
693-
}
694+
trace_ext3_free_blocks(inode, block, count);
694695
ext3_free_blocks_sb(handle, sb, block, count, &dquot_freed_blocks);
695696
if (dquot_freed_blocks)
696697
dquot_free_block(inode, dquot_freed_blocks);
@@ -1136,6 +1137,7 @@ static int alloc_new_reservation(struct ext3_reserve_window_node *my_rsv,
11361137
else
11371138
start_block = grp_goal + group_first_block;
11381139

1140+
trace_ext3_alloc_new_reservation(sb, start_block);
11391141
size = my_rsv->rsv_goal_size;
11401142

11411143
if (!rsv_is_empty(&my_rsv->rsv_window)) {
@@ -1230,8 +1232,11 @@ static int alloc_new_reservation(struct ext3_reserve_window_node *my_rsv,
12301232
* check if the first free block is within the
12311233
* free space we just reserved
12321234
*/
1233-
if (start_block >= my_rsv->rsv_start && start_block <= my_rsv->rsv_end)
1235+
if (start_block >= my_rsv->rsv_start &&
1236+
start_block <= my_rsv->rsv_end) {
1237+
trace_ext3_reserved(sb, start_block, my_rsv);
12341238
return 0; /* success */
1239+
}
12351240
/*
12361241
* if the first free bit we found is out of the reservable space
12371242
* continue search for next reservable space,
@@ -1514,10 +1519,6 @@ ext3_fsblk_t ext3_new_blocks(handle_t *handle, struct inode *inode,
15141519

15151520
*errp = -ENOSPC;
15161521
sb = inode->i_sb;
1517-
if (!sb) {
1518-
printk("ext3_new_block: nonexistent device");
1519-
return 0;
1520-
}
15211522

15221523
/*
15231524
* Check quota for allocation of this block.
@@ -1528,8 +1529,10 @@ ext3_fsblk_t ext3_new_blocks(handle_t *handle, struct inode *inode,
15281529
return 0;
15291530
}
15301531

1532+
trace_ext3_request_blocks(inode, goal, num);
1533+
15311534
sbi = EXT3_SB(sb);
1532-
es = EXT3_SB(sb)->s_es;
1535+
es = sbi->s_es;
15331536
ext3_debug("goal=%lu.\n", goal);
15341537
/*
15351538
* Allocate a block from reservation only when
@@ -1742,6 +1745,10 @@ ext3_fsblk_t ext3_new_blocks(handle_t *handle, struct inode *inode,
17421745
brelse(bitmap_bh);
17431746
dquot_free_block(inode, *count-num);
17441747
*count = num;
1748+
1749+
trace_ext3_allocate_blocks(inode, goal, num,
1750+
(unsigned long long)ret_block);
1751+
17451752
return ret_block;
17461753

17471754
io_error:
@@ -1996,6 +2003,7 @@ ext3_grpblk_t ext3_trim_all_free(struct super_block *sb, unsigned int group,
19962003
if ((next - start) < minblocks)
19972004
goto free_extent;
19982005

2006+
trace_ext3_discard_blocks(sb, discard_block, next - start);
19992007
/* Send the TRIM command down to the device */
20002008
err = sb_issue_discard(sb, discard_block, next - start,
20012009
GFP_NOFS, 0);
@@ -2100,7 +2108,7 @@ int ext3_trim_fs(struct super_block *sb, struct fstrim_range *range)
21002108
if (unlikely(minlen > EXT3_BLOCKS_PER_GROUP(sb)))
21012109
return -EINVAL;
21022110
if (start >= max_blks)
2103-
goto out;
2111+
return -EINVAL;
21042112
if (start + len > max_blks)
21052113
len = max_blks - start;
21062114

@@ -2148,8 +2156,6 @@ int ext3_trim_fs(struct super_block *sb, struct fstrim_range *range)
21482156

21492157
if (ret >= 0)
21502158
ret = 0;
2151-
2152-
out:
21532159
range->len = trimmed * sb->s_blocksize;
21542160

21552161
return ret;

‎fs/ext3/file.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ const struct file_operations ext3_file_operations = {
7171
};
7272

7373
const struct inode_operations ext3_file_inode_operations = {
74-
.truncate = ext3_truncate,
7574
.setattr = ext3_setattr,
7675
#ifdef CONFIG_EXT3_FS_XATTR
7776
.setxattr = generic_setxattr,

‎fs/ext3/fsync.c‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <linux/jbd.h>
3131
#include <linux/ext3_fs.h>
3232
#include <linux/ext3_jbd.h>
33+
#include <trace/events/ext3.h>
3334

3435
/*
3536
* akpm: A new design for ext3_sync_file().
@@ -51,12 +52,14 @@ int ext3_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
5152
int ret, needs_barrier = 0;
5253
tid_t commit_tid;
5354

55+
trace_ext3_sync_file_enter(file, datasync);
56+
5457
if (inode->i_sb->s_flags & MS_RDONLY)
5558
return 0;
5659

5760
ret = filemap_write_and_wait_range(inode->i_mapping, start, end);
5861
if (ret)
59-
return ret;
62+
goto out;
6063

6164
/*
6265
* Taking the mutex here just to keep consistent with how fsync was
@@ -83,7 +86,8 @@ int ext3_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
8386
*/
8487
if (ext3_should_journal_data(inode)) {
8588
mutex_unlock(&inode->i_mutex);
86-
return ext3_force_commit(inode->i_sb);
89+
ret = ext3_force_commit(inode->i_sb);
90+
goto out;
8791
}
8892

8993
if (datasync)
@@ -104,6 +108,9 @@ int ext3_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
104108
*/
105109
if (needs_barrier)
106110
blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL);
111+
107112
mutex_unlock(&inode->i_mutex);
113+
out:
114+
trace_ext3_sync_file_exit(inode, ret);
108115
return ret;
109116
}

‎fs/ext3/ialloc.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <linux/buffer_head.h>
2424
#include <linux/random.h>
2525
#include <linux/bitops.h>
26+
#include <trace/events/ext3.h>
2627

2728
#include <asm/byteorder.h>
2829

@@ -118,6 +119,7 @@ void ext3_free_inode (handle_t *handle, struct inode * inode)
118119

119120
ino = inode->i_ino;
120121
ext3_debug ("freeing inode %lu\n", ino);
122+
trace_ext3_free_inode(inode);
121123

122124
is_directory = S_ISDIR(inode->i_mode);
123125

@@ -426,6 +428,7 @@ struct inode *ext3_new_inode(handle_t *handle, struct inode * dir,
426428
return ERR_PTR(-EPERM);
427429

428430
sb = dir->i_sb;
431+
trace_ext3_request_inode(dir, mode);
429432
inode = new_inode(sb);
430433
if (!inode)
431434
return ERR_PTR(-ENOMEM);
@@ -601,6 +604,7 @@ struct inode *ext3_new_inode(handle_t *handle, struct inode * dir,
601604
}
602605

603606
ext3_debug("allocating inode %lu\n", inode->i_ino);
607+
trace_ext3_allocate_inode(inode, dir, mode);
604608
goto really_out;
605609
fail:
606610
ext3_std_error(sb, err);

0 commit comments

Comments
 (0)