Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 276666
b: refs/heads/master
c: cd5cfce
h: refs/heads/master
v: v3
  • Loading branch information
Alex Deucher authored and Dave Airlie committed Dec 14, 2011
1 parent 6b69cad commit e41185d
Show file tree
Hide file tree
Showing 16 changed files with 129 additions and 87 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2240a7bb479c38434bd636da9ce6afbd3f49447a
refs/heads/master: cd5cfce856684e13b9b57d46b78bb827e9c4da3c
2 changes: 1 addition & 1 deletion trunk/fs/configfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ int __init configfs_inode_init(void)
return bdi_init(&configfs_backing_dev_info);
}

void configfs_inode_exit(void)
void __exit configfs_inode_exit(void)
{
bdi_destroy(&configfs_backing_dev_info);
}
36 changes: 19 additions & 17 deletions trunk/fs/configfs/mount.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,26 +143,28 @@ static int __init configfs_init(void)
goto out;

config_kobj = kobject_create_and_add("config", kernel_kobj);
if (!config_kobj)
goto out2;

err = configfs_inode_init();
if (err)
goto out3;
if (!config_kobj) {
kmem_cache_destroy(configfs_dir_cachep);
configfs_dir_cachep = NULL;
goto out;
}

err = register_filesystem(&configfs_fs_type);
if (err)
goto out4;
if (err) {
printk(KERN_ERR "configfs: Unable to register filesystem!\n");
kobject_put(config_kobj);
kmem_cache_destroy(configfs_dir_cachep);
configfs_dir_cachep = NULL;
goto out;
}

return 0;
out4:
printk(KERN_ERR "configfs: Unable to register filesystem!\n");
configfs_inode_exit();
out3:
kobject_put(config_kobj);
out2:
kmem_cache_destroy(configfs_dir_cachep);
configfs_dir_cachep = NULL;
err = configfs_inode_init();
if (err) {
unregister_filesystem(&configfs_fs_type);
kobject_put(config_kobj);
kmem_cache_destroy(configfs_dir_cachep);
configfs_dir_cachep = NULL;
}
out:
return err;
}
Expand Down
3 changes: 2 additions & 1 deletion trunk/fs/ext4/extents.c
Original file line number Diff line number Diff line change
Expand Up @@ -1095,7 +1095,7 @@ static int ext4_ext_grow_indepth(handle_t *handle, struct inode *inode,
le32_to_cpu(EXT_FIRST_INDEX(neh)->ei_block),
ext4_idx_pblock(EXT_FIRST_INDEX(neh)));

neh->eh_depth = cpu_to_le16(le16_to_cpu(neh->eh_depth) + 1);
neh->eh_depth = cpu_to_le16(neh->eh_depth + 1);
ext4_mark_inode_dirty(handle, inode);
out:
brelse(bh);
Expand Down Expand Up @@ -2955,6 +2955,7 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,
/* Pre-conditions */
BUG_ON(!ext4_ext_is_uninitialized(ex));
BUG_ON(!in_range(map->m_lblk, ee_block, ee_len));
BUG_ON(map->m_lblk + map->m_len > ee_block + ee_len);

/*
* Attempt to transfer newly initialized blocks from the currently
Expand Down
54 changes: 44 additions & 10 deletions trunk/fs/ext4/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1339,11 +1339,8 @@ static int mpage_da_submit_io(struct mpage_da_data *mpd,
clear_buffer_unwritten(bh);
}

/*
* skip page if block allocation undone and
* block is dirty
*/
if (ext4_bh_delay_or_unwritten(NULL, bh))
/* skip page if block allocation undone */
if (buffer_delay(bh) || buffer_unwritten(bh))
skip_page = 1;
bh = bh->b_this_page;
block_start += bh->b_size;
Expand Down Expand Up @@ -2390,6 +2387,7 @@ static int ext4_da_write_begin(struct file *file, struct address_space *mapping,
pgoff_t index;
struct inode *inode = mapping->host;
handle_t *handle;
loff_t page_len;

index = pos >> PAGE_CACHE_SHIFT;

Expand Down Expand Up @@ -2436,6 +2434,13 @@ static int ext4_da_write_begin(struct file *file, struct address_space *mapping,
*/
if (pos + len > inode->i_size)
ext4_truncate_failed_write(inode);
} else {
page_len = pos & (PAGE_CACHE_SIZE - 1);
if (page_len > 0) {
ret = ext4_discard_partial_page_buffers_no_lock(handle,
inode, page, pos - page_len, page_len,
EXT4_DISCARD_PARTIAL_PG_ZERO_UNMAPPED);
}
}

if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))
Expand Down Expand Up @@ -2478,6 +2483,7 @@ static int ext4_da_write_end(struct file *file,
loff_t new_i_size;
unsigned long start, end;
int write_mode = (int)(unsigned long)fsdata;
loff_t page_len;

if (write_mode == FALL_BACK_TO_NONDELALLOC) {
if (ext4_should_order_data(inode)) {
Expand All @@ -2502,7 +2508,7 @@ static int ext4_da_write_end(struct file *file,
*/

new_i_size = pos + copied;
if (copied && new_i_size > EXT4_I(inode)->i_disksize) {
if (new_i_size > EXT4_I(inode)->i_disksize) {
if (ext4_da_should_update_i_disksize(page, end)) {
down_write(&EXT4_I(inode)->i_data_sem);
if (new_i_size > EXT4_I(inode)->i_disksize) {
Expand All @@ -2526,6 +2532,16 @@ static int ext4_da_write_end(struct file *file,
}
ret2 = generic_write_end(file, mapping, pos, len, copied,
page, fsdata);

page_len = PAGE_CACHE_SIZE -
((pos + copied - 1) & (PAGE_CACHE_SIZE - 1));

if (page_len > 0) {
ret = ext4_discard_partial_page_buffers_no_lock(handle,
inode, page, pos + copied - 1, page_len,
EXT4_DISCARD_PARTIAL_PG_ZERO_UNMAPPED);
}

copied = ret2;
if (ret2 < 0)
ret = ret2;
Expand Down Expand Up @@ -2765,11 +2781,10 @@ static void ext4_end_io_dio(struct kiocb *iocb, loff_t offset,
iocb->private, io_end->inode->i_ino, iocb, offset,
size);

iocb->private = NULL;

/* if not aio dio with unwritten extents, just free io and return */
if (!(io_end->flag & EXT4_IO_END_UNWRITTEN)) {
ext4_free_io_end(io_end);
iocb->private = NULL;
out:
if (is_async)
aio_complete(iocb, ret, 0);
Expand All @@ -2792,6 +2807,7 @@ static void ext4_end_io_dio(struct kiocb *iocb, loff_t offset,
spin_unlock_irqrestore(&ei->i_completed_io_lock, flags);

/* queue the work to convert unwritten extents to written */
iocb->private = NULL;
queue_work(wq, &io_end->work);

/* XXX: probably should move into the real I/O completion handler */
Expand Down Expand Up @@ -3187,8 +3203,26 @@ int ext4_discard_partial_page_buffers_no_lock(handle_t *handle,

iblock = index << (PAGE_CACHE_SHIFT - inode->i_sb->s_blocksize_bits);

if (!page_has_buffers(page))
create_empty_buffers(page, blocksize, 0);
if (!page_has_buffers(page)) {
/*
* If the range to be discarded covers a partial block
* we need to get the page buffers. This is because
* partial blocks cannot be released and the page needs
* to be updated with the contents of the block before
* we write the zeros on top of it.
*/
if ((from & (blocksize - 1)) ||
((from + length) & (blocksize - 1))) {
create_empty_buffers(page, blocksize, 0);
} else {
/*
* If there are no partial blocks,
* there is nothing to update,
* so we can return now
*/
return 0;
}
}

/* Find the buffer that contains "offset" */
bh = page_buffers(page);
Expand Down
12 changes: 0 additions & 12 deletions trunk/fs/ext4/page-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,18 +385,6 @@ int ext4_bio_write_page(struct ext4_io_submit *io,

block_end = block_start + blocksize;
if (block_start >= len) {
/*
* Comments copied from block_write_full_page_endio:
*
* The page straddles i_size. It must be zeroed out on
* each and every writepage invocation because it may
* be mmapped. "A file is mapped in multiples of the
* page size. For a file that is not a multiple of
* the page size, the remaining memory is zeroed when
* mapped, and writes to that region are not written
* out to the file."
*/
zero_user_segment(page, block_start, block_end);
clear_buffer_dirty(bh);
set_buffer_uptodate(bh);
continue;
Expand Down
17 changes: 9 additions & 8 deletions trunk/fs/ext4/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -1155,9 +1155,9 @@ static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs)
seq_puts(seq, ",block_validity");

if (!test_opt(sb, INIT_INODE_TABLE))
seq_puts(seq, ",noinit_itable");
seq_puts(seq, ",noinit_inode_table");
else if (sbi->s_li_wait_mult != EXT4_DEF_LI_WAIT_MULT)
seq_printf(seq, ",init_itable=%u",
seq_printf(seq, ",init_inode_table=%u",
(unsigned) sbi->s_li_wait_mult);

ext4_show_quota_options(seq, sb);
Expand Down Expand Up @@ -1333,7 +1333,8 @@ enum {
Opt_nomblk_io_submit, Opt_block_validity, Opt_noblock_validity,
Opt_inode_readahead_blks, Opt_journal_ioprio,
Opt_dioread_nolock, Opt_dioread_lock,
Opt_discard, Opt_nodiscard, Opt_init_itable, Opt_noinit_itable,
Opt_discard, Opt_nodiscard,
Opt_init_inode_table, Opt_noinit_inode_table,
};

static const match_table_t tokens = {
Expand Down Expand Up @@ -1406,9 +1407,9 @@ static const match_table_t tokens = {
{Opt_dioread_lock, "dioread_lock"},
{Opt_discard, "discard"},
{Opt_nodiscard, "nodiscard"},
{Opt_init_itable, "init_itable=%u"},
{Opt_init_itable, "init_itable"},
{Opt_noinit_itable, "noinit_itable"},
{Opt_init_inode_table, "init_itable=%u"},
{Opt_init_inode_table, "init_itable"},
{Opt_noinit_inode_table, "noinit_itable"},
{Opt_err, NULL},
};

Expand Down Expand Up @@ -1891,7 +1892,7 @@ static int parse_options(char *options, struct super_block *sb,
case Opt_dioread_lock:
clear_opt(sb, DIOREAD_NOLOCK);
break;
case Opt_init_itable:
case Opt_init_inode_table:
set_opt(sb, INIT_INODE_TABLE);
if (args[0].from) {
if (match_int(&args[0], &option))
Expand All @@ -1902,7 +1903,7 @@ static int parse_options(char *options, struct super_block *sb,
return 0;
sbi->s_li_wait_mult = option;
break;
case Opt_noinit_itable:
case Opt_noinit_inode_table:
clear_opt(sb, INIT_INODE_TABLE);
break;
default:
Expand Down
3 changes: 1 addition & 2 deletions trunk/fs/fuse/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1512,7 +1512,7 @@ static int fuse_retrieve(struct fuse_conn *fc, struct inode *inode,
else if (outarg->offset + num > file_size)
num = file_size - outarg->offset;

while (num && req->num_pages < FUSE_MAX_PAGES_PER_REQ) {
while (num) {
struct page *page;
unsigned int this_num;

Expand All @@ -1526,7 +1526,6 @@ static int fuse_retrieve(struct fuse_conn *fc, struct inode *inode,

num -= this_num;
total_len += this_num;
index++;
}
req->misc.retrieve_in.offset = outarg->offset;
req->misc.retrieve_in.size = total_len;
Expand Down
6 changes: 1 addition & 5 deletions trunk/fs/fuse/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1556,7 +1556,7 @@ static loff_t fuse_file_llseek(struct file *file, loff_t offset, int origin)
struct inode *inode = file->f_path.dentry->d_inode;

mutex_lock(&inode->i_mutex);
if (origin != SEEK_CUR && origin != SEEK_SET) {
if (origin != SEEK_CUR || origin != SEEK_SET) {
retval = fuse_update_attributes(inode, NULL, file, NULL);
if (retval)
goto exit;
Expand All @@ -1567,10 +1567,6 @@ static loff_t fuse_file_llseek(struct file *file, loff_t offset, int origin)
offset += i_size_read(inode);
break;
case SEEK_CUR:
if (offset == 0) {
retval = file->f_pos;
goto exit;
}
offset += file->f_pos;
break;
case SEEK_DATA:
Expand Down
24 changes: 12 additions & 12 deletions trunk/fs/fuse/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1138,28 +1138,28 @@ static int __init fuse_fs_init(void)
{
int err;

err = register_filesystem(&fuse_fs_type);
if (err)
goto out;

err = register_fuseblk();
if (err)
goto out_unreg;

fuse_inode_cachep = kmem_cache_create("fuse_inode",
sizeof(struct fuse_inode),
0, SLAB_HWCACHE_ALIGN,
fuse_inode_init_once);
err = -ENOMEM;
if (!fuse_inode_cachep)
goto out;

err = register_fuseblk();
if (err)
goto out2;

err = register_filesystem(&fuse_fs_type);
if (err)
goto out3;
goto out_unreg2;

return 0;

out3:
out_unreg2:
unregister_fuseblk();
out2:
kmem_cache_destroy(fuse_inode_cachep);
out_unreg:
unregister_filesystem(&fuse_fs_type);
out:
return err;
}
Expand Down
8 changes: 4 additions & 4 deletions trunk/fs/ncpfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)

error = bdi_setup_and_register(&server->bdi, "ncpfs", BDI_CAP_MAP_COPY);
if (error)
goto out_fput;
goto out_bdi;

server->ncp_filp = ncp_filp;
server->ncp_sock = sock;
Expand All @@ -559,7 +559,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
error = -EBADF;
server->info_filp = fget(data.info_fd);
if (!server->info_filp)
goto out_bdi;
goto out_fput;
error = -ENOTSOCK;
sock_inode = server->info_filp->f_path.dentry->d_inode;
if (!S_ISSOCK(sock_inode->i_mode))
Expand Down Expand Up @@ -746,9 +746,9 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
out_fput2:
if (server->info_filp)
fput(server->info_filp);
out_bdi:
bdi_destroy(&server->bdi);
out_fput:
bdi_destroy(&server->bdi);
out_bdi:
/* 23/12/1998 Marcin Dalecki <dalecki@cs.net.pl>:
*
* The previously used put_filp(ncp_filp); was bogus, since
Expand Down
Loading

0 comments on commit e41185d

Please sign in to comment.