Commit a53b75b3 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4

Pull ext4 update from Ted Ts'o:
 "Bug fixes and cleanups for ext4.  We also enable the punch hole
  functionality for bigalloc file systems"

* tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
  ext4: delete "set but not used" variables
  ext4: don't pass freed handle to ext4_walk_page_buffers
  ext4: avoid clearing beyond i_blocks when truncating an inline data file
  ext4: ext4_inode_is_fast_symlink should use EXT4_CLUSTER_SIZE
  ext4: fix a typo in extents.c
  ext4: use %pd printk specificer
  ext4: standardize error handling in ext4_da_write_inline_data_begin()
  ext4: retry allocation when inline->extent conversion failed
  ext4: enable punch hole for bigalloc
parents 2b2b15c3 d7092ae2
...@@ -3477,7 +3477,7 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, ...@@ -3477,7 +3477,7 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,
WARN_ON(map->m_lblk < ee_block); WARN_ON(map->m_lblk < ee_block);
/* /*
* It is safe to convert extent to initialized via explicit * It is safe to convert extent to initialized via explicit
* zeroout only if extent is fully insde i_size or new_size. * zeroout only if extent is fully inside i_size or new_size.
*/ */
split_flag |= ee_block + ee_len <= eof_block ? EXT4_EXT_MAY_ZEROOUT : 0; split_flag |= ee_block + ee_len <= eof_block ? EXT4_EXT_MAY_ZEROOUT : 0;
......
...@@ -849,15 +849,16 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping, ...@@ -849,15 +849,16 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping,
handle_t *handle; handle_t *handle;
struct page *page; struct page *page;
struct ext4_iloc iloc; struct ext4_iloc iloc;
int retries;
ret = ext4_get_inode_loc(inode, &iloc); ret = ext4_get_inode_loc(inode, &iloc);
if (ret) if (ret)
return ret; return ret;
retry_journal:
handle = ext4_journal_start(inode, EXT4_HT_INODE, 1); handle = ext4_journal_start(inode, EXT4_HT_INODE, 1);
if (IS_ERR(handle)) { if (IS_ERR(handle)) {
ret = PTR_ERR(handle); ret = PTR_ERR(handle);
handle = NULL;
goto out; goto out;
} }
...@@ -867,7 +868,7 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping, ...@@ -867,7 +868,7 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping,
if (inline_size >= pos + len) { if (inline_size >= pos + len) {
ret = ext4_prepare_inline_data(handle, inode, pos + len); ret = ext4_prepare_inline_data(handle, inode, pos + len);
if (ret && ret != -ENOSPC) if (ret && ret != -ENOSPC)
goto out; goto out_journal;
} }
if (ret == -ENOSPC) { if (ret == -ENOSPC) {
...@@ -875,6 +876,10 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping, ...@@ -875,6 +876,10 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping,
inode, inode,
flags, flags,
fsdata); fsdata);
ext4_journal_stop(handle);
if (ret == -ENOSPC &&
ext4_should_retry_alloc(inode->i_sb, &retries))
goto retry_journal;
goto out; goto out;
} }
...@@ -887,7 +892,7 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping, ...@@ -887,7 +892,7 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping,
page = grab_cache_page_write_begin(mapping, 0, flags); page = grab_cache_page_write_begin(mapping, 0, flags);
if (!page) { if (!page) {
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out_journal;
} }
down_read(&EXT4_I(inode)->xattr_sem); down_read(&EXT4_I(inode)->xattr_sem);
...@@ -904,16 +909,15 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping, ...@@ -904,16 +909,15 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping,
up_read(&EXT4_I(inode)->xattr_sem); up_read(&EXT4_I(inode)->xattr_sem);
*pagep = page; *pagep = page;
handle = NULL;
brelse(iloc.bh); brelse(iloc.bh);
return 1; return 1;
out_release_page: out_release_page:
up_read(&EXT4_I(inode)->xattr_sem); up_read(&EXT4_I(inode)->xattr_sem);
unlock_page(page); unlock_page(page);
page_cache_release(page); page_cache_release(page);
out: out_journal:
if (handle)
ext4_journal_stop(handle); ext4_journal_stop(handle);
out:
brelse(iloc.bh); brelse(iloc.bh);
return ret; return ret;
} }
...@@ -1837,7 +1841,6 @@ int ext4_try_to_evict_inline_data(handle_t *handle, ...@@ -1837,7 +1841,6 @@ int ext4_try_to_evict_inline_data(handle_t *handle,
{ {
int error; int error;
struct ext4_xattr_entry *entry; struct ext4_xattr_entry *entry;
struct ext4_xattr_ibody_header *header;
struct ext4_inode *raw_inode; struct ext4_inode *raw_inode;
struct ext4_iloc iloc; struct ext4_iloc iloc;
...@@ -1846,7 +1849,6 @@ int ext4_try_to_evict_inline_data(handle_t *handle, ...@@ -1846,7 +1849,6 @@ int ext4_try_to_evict_inline_data(handle_t *handle,
return error; return error;
raw_inode = ext4_raw_inode(&iloc); raw_inode = ext4_raw_inode(&iloc);
header = IHDR(inode, raw_inode);
entry = (struct ext4_xattr_entry *)((void *)raw_inode + entry = (struct ext4_xattr_entry *)((void *)raw_inode +
EXT4_I(inode)->i_inline_off); EXT4_I(inode)->i_inline_off);
if (EXT4_XATTR_LEN(entry->e_name_len) + if (EXT4_XATTR_LEN(entry->e_name_len) +
...@@ -1924,9 +1926,11 @@ void ext4_inline_data_truncate(struct inode *inode, int *has_inline) ...@@ -1924,9 +1926,11 @@ void ext4_inline_data_truncate(struct inode *inode, int *has_inline)
} }
/* Clear the content within i_blocks. */ /* Clear the content within i_blocks. */
if (i_size < EXT4_MIN_INLINE_DATA_SIZE) if (i_size < EXT4_MIN_INLINE_DATA_SIZE) {
memset(ext4_raw_inode(&is.iloc)->i_block + i_size, 0, void *p = (void *) ext4_raw_inode(&is.iloc)->i_block;
memset(p + i_size, 0,
EXT4_MIN_INLINE_DATA_SIZE - i_size); EXT4_MIN_INLINE_DATA_SIZE - i_size);
}
EXT4_I(inode)->i_inline_size = i_size < EXT4_I(inode)->i_inline_size = i_size <
EXT4_MIN_INLINE_DATA_SIZE ? EXT4_MIN_INLINE_DATA_SIZE ?
......
...@@ -145,7 +145,7 @@ static int ext4_meta_trans_blocks(struct inode *inode, int lblocks, ...@@ -145,7 +145,7 @@ static int ext4_meta_trans_blocks(struct inode *inode, int lblocks,
static int ext4_inode_is_fast_symlink(struct inode *inode) static int ext4_inode_is_fast_symlink(struct inode *inode)
{ {
int ea_blocks = EXT4_I(inode)->i_file_acl ? int ea_blocks = EXT4_I(inode)->i_file_acl ?
(inode->i_sb->s_blocksize >> 9) : 0; EXT4_CLUSTER_SIZE(inode->i_sb) >> 9 : 0;
return (S_ISLNK(inode->i_mode) && inode->i_blocks - ea_blocks == 0); return (S_ISLNK(inode->i_mode) && inode->i_blocks - ea_blocks == 0);
} }
...@@ -1772,7 +1772,7 @@ static int __ext4_journalled_writepage(struct page *page, ...@@ -1772,7 +1772,7 @@ static int __ext4_journalled_writepage(struct page *page,
ret = err; ret = err;
if (!ext4_has_inline_data(inode)) if (!ext4_has_inline_data(inode))
ext4_walk_page_buffers(handle, page_bufs, 0, len, ext4_walk_page_buffers(NULL, page_bufs, 0, len,
NULL, bput_one); NULL, bput_one);
ext4_set_inode_state(inode, EXT4_STATE_JDATA); ext4_set_inode_state(inode, EXT4_STATE_JDATA);
out: out:
...@@ -3501,11 +3501,6 @@ int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length) ...@@ -3501,11 +3501,6 @@ int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length)
if (!S_ISREG(inode->i_mode)) if (!S_ISREG(inode->i_mode))
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (EXT4_SB(sb)->s_cluster_ratio > 1) {
/* TODO: Add support for bigalloc file systems */
return -EOPNOTSUPP;
}
trace_ext4_punch_hole(inode, offset, length); trace_ext4_punch_hole(inode, offset, length);
/* /*
......
...@@ -101,9 +101,8 @@ static long swap_inode_boot_loader(struct super_block *sb, ...@@ -101,9 +101,8 @@ static long swap_inode_boot_loader(struct super_block *sb,
handle_t *handle; handle_t *handle;
int err; int err;
struct inode *inode_bl; struct inode *inode_bl;
struct ext4_inode_info *ei;
struct ext4_inode_info *ei_bl; struct ext4_inode_info *ei_bl;
struct ext4_sb_info *sbi; struct ext4_sb_info *sbi = EXT4_SB(sb);
if (inode->i_nlink != 1 || !S_ISREG(inode->i_mode)) { if (inode->i_nlink != 1 || !S_ISREG(inode->i_mode)) {
err = -EINVAL; err = -EINVAL;
...@@ -115,9 +114,6 @@ static long swap_inode_boot_loader(struct super_block *sb, ...@@ -115,9 +114,6 @@ static long swap_inode_boot_loader(struct super_block *sb,
goto swap_boot_out; goto swap_boot_out;
} }
sbi = EXT4_SB(sb);
ei = EXT4_I(inode);
inode_bl = ext4_iget(sb, EXT4_BOOT_LOADER_INO); inode_bl = ext4_iget(sb, EXT4_BOOT_LOADER_INO);
if (IS_ERR(inode_bl)) { if (IS_ERR(inode_bl)) {
err = PTR_ERR(inode_bl); err = PTR_ERR(inode_bl);
......
...@@ -1425,9 +1425,8 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, unsi ...@@ -1425,9 +1425,8 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, unsi
return ERR_PTR(-EIO); return ERR_PTR(-EIO);
} }
if (unlikely(ino == dir->i_ino)) { if (unlikely(ino == dir->i_ino)) {
EXT4_ERROR_INODE(dir, "'%.*s' linked to parent dir", EXT4_ERROR_INODE(dir, "'%pd' linked to parent dir",
dentry->d_name.len, dentry);
dentry->d_name.name);
return ERR_PTR(-EIO); return ERR_PTR(-EIO);
} }
inode = ext4_iget(dir->i_sb, ino); inode = ext4_iget(dir->i_sb, ino);
......
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