Commit 439f1da9 authored by Linus Torvalds's avatar Linus Torvalds

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
parents aee0314b 907ea529
...@@ -1371,6 +1371,17 @@ void __breadahead(struct block_device *bdev, sector_t block, unsigned size) ...@@ -1371,6 +1371,17 @@ void __breadahead(struct block_device *bdev, sector_t block, unsigned size)
} }
EXPORT_SYMBOL(__breadahead); EXPORT_SYMBOL(__breadahead);
void __breadahead_gfp(struct block_device *bdev, sector_t block, unsigned size,
gfp_t gfp)
{
struct buffer_head *bh = __getblk_gfp(bdev, block, size, gfp);
if (likely(bh)) {
ll_rw_block(REQ_OP_READ, REQ_RAHEAD, 1, &bh);
brelse(bh);
}
}
EXPORT_SYMBOL(__breadahead_gfp);
/** /**
* __bread_gfp() - reads a specified block and returns the bh * __bread_gfp() - reads a specified block and returns the bh
* @bdev: the block_device to read from * @bdev: the block_device to read from
......
...@@ -410,7 +410,7 @@ static int ext4_validate_block_bitmap(struct super_block *sb, ...@@ -410,7 +410,7 @@ static int ext4_validate_block_bitmap(struct super_block *sb,
* Read the bitmap for a given block_group,and validate the * Read the bitmap for a given block_group,and validate the
* bits for block/inode/inode tables are set in the bitmaps * bits for block/inode/inode tables are set in the bitmaps
* *
* Return buffer_head on success or NULL in case of failure. * Return buffer_head on success or an ERR_PTR in case of failure.
*/ */
struct buffer_head * struct buffer_head *
ext4_read_block_bitmap_nowait(struct super_block *sb, ext4_group_t block_group) 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) ...@@ -502,7 +502,7 @@ ext4_read_block_bitmap_nowait(struct super_block *sb, ext4_group_t block_group)
return ERR_PTR(err); return ERR_PTR(err);
} }
/* Returns 0 on success, 1 on error */ /* Returns 0 on success, -errno on error */
int ext4_wait_block_bitmap(struct super_block *sb, ext4_group_t block_group, int ext4_wait_block_bitmap(struct super_block *sb, ext4_group_t block_group,
struct buffer_head *bh) struct buffer_head *bh)
{ {
......
...@@ -338,9 +338,6 @@ int __ext4_handle_dirty_metadata(const char *where, unsigned int line, ...@@ -338,9 +338,6 @@ int __ext4_handle_dirty_metadata(const char *where, unsigned int line,
if (inode && inode_needs_sync(inode)) { if (inode && inode_needs_sync(inode)) {
sync_dirty_buffer(bh); sync_dirty_buffer(bh);
if (buffer_req(bh) && !buffer_uptodate(bh)) { if (buffer_req(bh) && !buffer_uptodate(bh)) {
struct ext4_super_block *es;
es = EXT4_SB(inode->i_sb)->s_es;
ext4_error_inode_err(inode, where, line, ext4_error_inode_err(inode, where, line,
bh->b_blocknr, EIO, bh->b_blocknr, EIO,
"IO error syncing itable block"); "IO error syncing itable block");
......
...@@ -3374,8 +3374,8 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, ...@@ -3374,8 +3374,8 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,
(unsigned long long)map->m_lblk, map_len); (unsigned long long)map->m_lblk, map_len);
sbi = EXT4_SB(inode->i_sb); sbi = EXT4_SB(inode->i_sb);
eof_block = (inode->i_size + inode->i_sb->s_blocksize - 1) >> eof_block = (EXT4_I(inode)->i_disksize + inode->i_sb->s_blocksize - 1)
inode->i_sb->s_blocksize_bits; >> inode->i_sb->s_blocksize_bits;
if (eof_block < map->m_lblk + map_len) if (eof_block < map->m_lblk + map_len)
eof_block = map->m_lblk + map_len; eof_block = map->m_lblk + map_len;
...@@ -3627,8 +3627,8 @@ static int ext4_split_convert_extents(handle_t *handle, ...@@ -3627,8 +3627,8 @@ static int ext4_split_convert_extents(handle_t *handle,
__func__, inode->i_ino, __func__, inode->i_ino,
(unsigned long long)map->m_lblk, map->m_len); (unsigned long long)map->m_lblk, map->m_len);
eof_block = (inode->i_size + inode->i_sb->s_blocksize - 1) >> eof_block = (EXT4_I(inode)->i_disksize + inode->i_sb->s_blocksize - 1)
inode->i_sb->s_blocksize_bits; >> inode->i_sb->s_blocksize_bits;
if (eof_block < map->m_lblk + map->m_len) if (eof_block < map->m_lblk + map->m_len)
eof_block = map->m_lblk + map->m_len; eof_block = map->m_lblk + map->m_len;
/* /*
......
...@@ -113,7 +113,7 @@ static int ext4_validate_inode_bitmap(struct super_block *sb, ...@@ -113,7 +113,7 @@ static int ext4_validate_inode_bitmap(struct super_block *sb,
* Read the inode allocation bitmap for a given block_group, reading * Read the inode allocation bitmap for a given block_group, reading
* into the specified slot in the superblock's bitmap cache. * into the specified slot in the superblock's bitmap cache.
* *
* Return buffer_head of bitmap on success or NULL. * Return buffer_head of bitmap on success, or an ERR_PTR on error.
*/ */
static struct buffer_head * static struct buffer_head *
ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group) 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, ...@@ -662,7 +662,7 @@ static int find_group_other(struct super_block *sb, struct inode *parent,
* block has been written back to disk. (Yes, these values are * block has been written back to disk. (Yes, these values are
* somewhat arbitrary...) * somewhat arbitrary...)
*/ */
#define RECENTCY_MIN 5 #define RECENTCY_MIN 60
#define RECENTCY_DIRTY 300 #define RECENTCY_DIRTY 300
static int recently_deleted(struct super_block *sb, ext4_group_t group, int ino) static int recently_deleted(struct super_block *sb, ext4_group_t group, int ino)
......
...@@ -1973,7 +1973,7 @@ static int ext4_writepage(struct page *page, ...@@ -1973,7 +1973,7 @@ static int ext4_writepage(struct page *page,
bool keep_towrite = false; bool keep_towrite = false;
if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb)))) { if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb)))) {
ext4_invalidatepage(page, 0, PAGE_SIZE); inode->i_mapping->a_ops->invalidatepage(page, 0, PAGE_SIZE);
unlock_page(page); unlock_page(page);
return -EIO; return -EIO;
} }
...@@ -4364,7 +4364,7 @@ static int __ext4_get_inode_loc(struct inode *inode, ...@@ -4364,7 +4364,7 @@ static int __ext4_get_inode_loc(struct inode *inode,
if (end > table) if (end > table)
end = table; end = table;
while (b <= end) while (b <= end)
sb_breadahead(sb, b++); sb_breadahead_unmovable(sb, b++);
} }
/* /*
......
...@@ -1943,7 +1943,8 @@ void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac, ...@@ -1943,7 +1943,8 @@ void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac,
int free; int free;
free = e4b->bd_info->bb_free; free = e4b->bd_info->bb_free;
BUG_ON(free <= 0); if (WARN_ON(free <= 0))
return;
i = e4b->bd_info->bb_first_free; i = e4b->bd_info->bb_first_free;
...@@ -1966,7 +1967,8 @@ void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac, ...@@ -1966,7 +1967,8 @@ void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac,
} }
mb_find_extent(e4b, i, ac->ac_g_ex.fe_len, &ex); mb_find_extent(e4b, i, ac->ac_g_ex.fe_len, &ex);
BUG_ON(ex.fe_len <= 0); if (WARN_ON(ex.fe_len <= 0))
break;
if (free < ex.fe_len) { if (free < ex.fe_len) {
ext4_grp_locked_error(sb, e4b->bd_group, 0, 0, ext4_grp_locked_error(sb, e4b->bd_group, 0, 0,
"%d free clusters as per " "%d free clusters as per "
......
...@@ -596,7 +596,6 @@ void __ext4_error_file(struct file *file, const char *function, ...@@ -596,7 +596,6 @@ void __ext4_error_file(struct file *file, const char *function,
{ {
va_list args; va_list args;
struct va_format vaf; struct va_format vaf;
struct ext4_super_block *es;
struct inode *inode = file_inode(file); struct inode *inode = file_inode(file);
char pathname[80], *path; char pathname[80], *path;
...@@ -604,7 +603,6 @@ void __ext4_error_file(struct file *file, const char *function, ...@@ -604,7 +603,6 @@ void __ext4_error_file(struct file *file, const char *function,
return; return;
trace_ext4_error(inode->i_sb, function, line); trace_ext4_error(inode->i_sb, function, line);
es = EXT4_SB(inode->i_sb)->s_es;
if (ext4_error_ratelimit(inode->i_sb)) { if (ext4_error_ratelimit(inode->i_sb)) {
path = file_path(file, pathname, sizeof(pathname)); path = file_path(file, pathname, sizeof(pathname));
if (IS_ERR(path)) if (IS_ERR(path))
...@@ -4340,7 +4338,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) ...@@ -4340,7 +4338,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
/* Pre-read the descriptors into the buffer cache */ /* Pre-read the descriptors into the buffer cache */
for (i = 0; i < db_count; i++) { for (i = 0; i < db_count; i++) {
block = descriptor_loc(sb, logical_sb_block, i); block = descriptor_loc(sb, logical_sb_block, i);
sb_breadahead(sb, block); sb_breadahead_unmovable(sb, block);
} }
for (i = 0; i < db_count; i++) { for (i = 0; i < db_count; i++) {
......
...@@ -189,6 +189,8 @@ struct buffer_head *__getblk_gfp(struct block_device *bdev, sector_t block, ...@@ -189,6 +189,8 @@ struct buffer_head *__getblk_gfp(struct block_device *bdev, sector_t block,
void __brelse(struct buffer_head *); void __brelse(struct buffer_head *);
void __bforget(struct buffer_head *); void __bforget(struct buffer_head *);
void __breadahead(struct block_device *, sector_t block, unsigned int size); void __breadahead(struct block_device *, sector_t block, unsigned int size);
void __breadahead_gfp(struct block_device *, sector_t block, unsigned int size,
gfp_t gfp);
struct buffer_head *__bread_gfp(struct block_device *, struct buffer_head *__bread_gfp(struct block_device *,
sector_t block, unsigned size, gfp_t gfp); sector_t block, unsigned size, gfp_t gfp);
void invalidate_bh_lrus(void); void invalidate_bh_lrus(void);
...@@ -319,6 +321,12 @@ sb_breadahead(struct super_block *sb, sector_t block) ...@@ -319,6 +321,12 @@ sb_breadahead(struct super_block *sb, sector_t block)
__breadahead(sb->s_bdev, block, sb->s_blocksize); __breadahead(sb->s_bdev, block, sb->s_blocksize);
} }
static inline void
sb_breadahead_unmovable(struct super_block *sb, sector_t block)
{
__breadahead_gfp(sb->s_bdev, block, sb->s_blocksize, 0);
}
static inline struct buffer_head * static inline struct buffer_head *
sb_getblk(struct super_block *sb, sector_t block) sb_getblk(struct super_block *sb, sector_t block)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment