Skip to content

Commit 439f1da

Browse files
committed
Merge tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
Pull ext4 fixes from Ted Ts'o: "Miscellaneous bug fixes and cleanups for ext4, including a fix for generic/388 in data=journal mode, removing some BUG_ON's, and cleaning up some compiler warnings" * tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: ext4: convert BUG_ON's to WARN_ON's in mballoc.c ext4: increase wait time needed before reuse of deleted inode numbers ext4: remove set but not used variable 'es' in ext4_jbd2.c ext4: remove set but not used variable 'es' ext4: do not zeroout extents beyond i_disksize ext4: fix return-value types in several function comments ext4: use non-movable memory for superblock readahead ext4: use matching invalidatepage in ext4_writepage
2 parents aee0314 + 907ea52 commit 439f1da

File tree

9 files changed

+34
-18
lines changed

9 files changed

+34
-18
lines changed

fs/buffer.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,6 +1371,17 @@ void __breadahead(struct block_device *bdev, sector_t block, unsigned size)
13711371
}
13721372
EXPORT_SYMBOL(__breadahead);
13731373

1374+
void __breadahead_gfp(struct block_device *bdev, sector_t block, unsigned size,
1375+
gfp_t gfp)
1376+
{
1377+
struct buffer_head *bh = __getblk_gfp(bdev, block, size, gfp);
1378+
if (likely(bh)) {
1379+
ll_rw_block(REQ_OP_READ, REQ_RAHEAD, 1, &bh);
1380+
brelse(bh);
1381+
}
1382+
}
1383+
EXPORT_SYMBOL(__breadahead_gfp);
1384+
13741385
/**
13751386
* __bread_gfp() - reads a specified block and returns the bh
13761387
* @bdev: the block_device to read from

fs/ext4/balloc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ static int ext4_validate_block_bitmap(struct super_block *sb,
410410
* Read the bitmap for a given block_group,and validate the
411411
* bits for block/inode/inode tables are set in the bitmaps
412412
*
413-
* Return buffer_head on success or NULL in case of failure.
413+
* Return buffer_head on success or an ERR_PTR in case of failure.
414414
*/
415415
struct buffer_head *
416416
ext4_read_block_bitmap_nowait(struct super_block *sb, ext4_group_t block_group)
@@ -502,7 +502,7 @@ ext4_read_block_bitmap_nowait(struct super_block *sb, ext4_group_t block_group)
502502
return ERR_PTR(err);
503503
}
504504

505-
/* Returns 0 on success, 1 on error */
505+
/* Returns 0 on success, -errno on error */
506506
int ext4_wait_block_bitmap(struct super_block *sb, ext4_group_t block_group,
507507
struct buffer_head *bh)
508508
{

fs/ext4/ext4_jbd2.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,9 +338,6 @@ int __ext4_handle_dirty_metadata(const char *where, unsigned int line,
338338
if (inode && inode_needs_sync(inode)) {
339339
sync_dirty_buffer(bh);
340340
if (buffer_req(bh) && !buffer_uptodate(bh)) {
341-
struct ext4_super_block *es;
342-
343-
es = EXT4_SB(inode->i_sb)->s_es;
344341
ext4_error_inode_err(inode, where, line,
345342
bh->b_blocknr, EIO,
346343
"IO error syncing itable block");

fs/ext4/extents.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3374,8 +3374,8 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,
33743374
(unsigned long long)map->m_lblk, map_len);
33753375

33763376
sbi = EXT4_SB(inode->i_sb);
3377-
eof_block = (inode->i_size + inode->i_sb->s_blocksize - 1) >>
3378-
inode->i_sb->s_blocksize_bits;
3377+
eof_block = (EXT4_I(inode)->i_disksize + inode->i_sb->s_blocksize - 1)
3378+
>> inode->i_sb->s_blocksize_bits;
33793379
if (eof_block < map->m_lblk + map_len)
33803380
eof_block = map->m_lblk + map_len;
33813381

@@ -3627,8 +3627,8 @@ static int ext4_split_convert_extents(handle_t *handle,
36273627
__func__, inode->i_ino,
36283628
(unsigned long long)map->m_lblk, map->m_len);
36293629

3630-
eof_block = (inode->i_size + inode->i_sb->s_blocksize - 1) >>
3631-
inode->i_sb->s_blocksize_bits;
3630+
eof_block = (EXT4_I(inode)->i_disksize + inode->i_sb->s_blocksize - 1)
3631+
>> inode->i_sb->s_blocksize_bits;
36323632
if (eof_block < map->m_lblk + map->m_len)
36333633
eof_block = map->m_lblk + map->m_len;
36343634
/*

fs/ext4/ialloc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ static int ext4_validate_inode_bitmap(struct super_block *sb,
113113
* Read the inode allocation bitmap for a given block_group, reading
114114
* into the specified slot in the superblock's bitmap cache.
115115
*
116-
* Return buffer_head of bitmap on success or NULL.
116+
* Return buffer_head of bitmap on success, or an ERR_PTR on error.
117117
*/
118118
static struct buffer_head *
119119
ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group)
@@ -662,7 +662,7 @@ static int find_group_other(struct super_block *sb, struct inode *parent,
662662
* block has been written back to disk. (Yes, these values are
663663
* somewhat arbitrary...)
664664
*/
665-
#define RECENTCY_MIN 5
665+
#define RECENTCY_MIN 60
666666
#define RECENTCY_DIRTY 300
667667

668668
static int recently_deleted(struct super_block *sb, ext4_group_t group, int ino)

fs/ext4/inode.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1973,7 +1973,7 @@ static int ext4_writepage(struct page *page,
19731973
bool keep_towrite = false;
19741974

19751975
if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb)))) {
1976-
ext4_invalidatepage(page, 0, PAGE_SIZE);
1976+
inode->i_mapping->a_ops->invalidatepage(page, 0, PAGE_SIZE);
19771977
unlock_page(page);
19781978
return -EIO;
19791979
}
@@ -4364,7 +4364,7 @@ static int __ext4_get_inode_loc(struct inode *inode,
43644364
if (end > table)
43654365
end = table;
43664366
while (b <= end)
4367-
sb_breadahead(sb, b++);
4367+
sb_breadahead_unmovable(sb, b++);
43684368
}
43694369

43704370
/*

fs/ext4/mballoc.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1943,7 +1943,8 @@ void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac,
19431943
int free;
19441944

19451945
free = e4b->bd_info->bb_free;
1946-
BUG_ON(free <= 0);
1946+
if (WARN_ON(free <= 0))
1947+
return;
19471948

19481949
i = e4b->bd_info->bb_first_free;
19491950

@@ -1966,7 +1967,8 @@ void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac,
19661967
}
19671968

19681969
mb_find_extent(e4b, i, ac->ac_g_ex.fe_len, &ex);
1969-
BUG_ON(ex.fe_len <= 0);
1970+
if (WARN_ON(ex.fe_len <= 0))
1971+
break;
19701972
if (free < ex.fe_len) {
19711973
ext4_grp_locked_error(sb, e4b->bd_group, 0, 0,
19721974
"%d free clusters as per "

fs/ext4/super.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -596,15 +596,13 @@ void __ext4_error_file(struct file *file, const char *function,
596596
{
597597
va_list args;
598598
struct va_format vaf;
599-
struct ext4_super_block *es;
600599
struct inode *inode = file_inode(file);
601600
char pathname[80], *path;
602601

603602
if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb))))
604603
return;
605604

606605
trace_ext4_error(inode->i_sb, function, line);
607-
es = EXT4_SB(inode->i_sb)->s_es;
608606
if (ext4_error_ratelimit(inode->i_sb)) {
609607
path = file_path(file, pathname, sizeof(pathname));
610608
if (IS_ERR(path))
@@ -4340,7 +4338,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
43404338
/* Pre-read the descriptors into the buffer cache */
43414339
for (i = 0; i < db_count; i++) {
43424340
block = descriptor_loc(sb, logical_sb_block, i);
4343-
sb_breadahead(sb, block);
4341+
sb_breadahead_unmovable(sb, block);
43444342
}
43454343

43464344
for (i = 0; i < db_count; i++) {

include/linux/buffer_head.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ struct buffer_head *__getblk_gfp(struct block_device *bdev, sector_t block,
189189
void __brelse(struct buffer_head *);
190190
void __bforget(struct buffer_head *);
191191
void __breadahead(struct block_device *, sector_t block, unsigned int size);
192+
void __breadahead_gfp(struct block_device *, sector_t block, unsigned int size,
193+
gfp_t gfp);
192194
struct buffer_head *__bread_gfp(struct block_device *,
193195
sector_t block, unsigned size, gfp_t gfp);
194196
void invalidate_bh_lrus(void);
@@ -319,6 +321,12 @@ sb_breadahead(struct super_block *sb, sector_t block)
319321
__breadahead(sb->s_bdev, block, sb->s_blocksize);
320322
}
321323

324+
static inline void
325+
sb_breadahead_unmovable(struct super_block *sb, sector_t block)
326+
{
327+
__breadahead_gfp(sb->s_bdev, block, sb->s_blocksize, 0);
328+
}
329+
322330
static inline struct buffer_head *
323331
sb_getblk(struct super_block *sb, sector_t block)
324332
{

0 commit comments

Comments
 (0)