search for: btrfs_start_transaction

Displaying 20 results from an estimated 48 matches for "btrfs_start_transaction".

2011 Jun 09
2
[PATCH] Btrfs: turn to readonly if btrfs_start_transaction() fails
When btrfs_start_transaction() fails, we should call btrfs_std_error() properly for filesystem to readonly. (in this patch, forced readonly framework is used) Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com> --- fs/btrfs/file.c | 1 + fs/btrfs/inode.c | 34 +++++++++++++++++++++++++++------- fs/btr...
2009 Aug 24
0
[PATCH] Btrfs: proper metadata -ENOSPC handling
This patch finally gives us full proper -ENOSPC handling for btrfs. Now whenever you do a btrfs_start_transaction, you must specify the number of items you are planning to add/delete/modify. The worst case number of blocks that could be modified by changing that number of items will be calculated and checked against the amount of free space in the space_info where the root you are modifying would allocate out...
2013 Aug 27
7
[PATCH] Btrfs: fix deadlock in uuid scan kthread
...a.33+0xbf/0x120 [btrfs] [36700.671623] [<ffffffff81066760>] ? add_wait_queue+0x60/0x60 [36700.671629] [<ffffffffa05a5b06>] start_transaction+0x3d6/0x530 [btrfs] [36700.671636] [<ffffffffa05bb1f4>] ? btrfs_get_token_32+0x64/0xf0 [btrfs] [36700.671642] [<ffffffffa05a5fbb>] btrfs_start_transaction+0x1b/0x20 [btrfs] [36700.671649] [<ffffffffa05c8a81>] btrfs_uuid_scan_kthread+0x211/0x3d0 [btrfs] [36700.671655] [<ffffffffa05c8870>] ? __btrfs_open_devices+0x2a0/0x2a0 [btrfs] [36700.671657] [<ffffffff81065fa0>] kthread+0xc0/0xd0 [36700.671659] [<ffffffff81065ee0>] ? fl...
2012 Jan 05
4
[RFC][PATCH 3/3] Btrfs: improve truncation of btrfs
...perately as well. */ - rsv = btrfs_alloc_block_rsv(root); - if (!rsv) - return -ENOMEM; - rsv->size = min_size; /* * 1 for the truncate slack space - * 1 for the orphan item we''re going to add - * 1 for the orphan item deletion * 1 for updating the inode. */ - trans = btrfs_start_transaction(root, 4); - if (IS_ERR(trans)) { - err = PTR_ERR(trans); - goto out; - } - - /* Migrate the slack space for the truncate to our reserve */ - ret = btrfs_block_rsv_migrate(&root->fs_info->trans_block_rsv, rsv, - min_size); - BUG_ON(ret); - - ret = btrfs_orphan_add(trans, inode);...
2011 Jun 08
1
[PATCH] Btrfs: use join_transaction in btrfs_evict_inode()
The WARN_ON() in start_transaction() was triggered while balancing. The cause is btrfs_relocate_chunk() started a transaction and then called iput() on the inode that stores free space cache, and iput() called btrfs_start_transaction() again. Reported-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> --- fs/btrfs/inode.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 02ff4a1..4e9aa28 100644 --- a/fs/btrfs/inod...
2011 Sep 21
3
[PATCH] Btrfs: fix orphan cleanup regression
...in - * removing the inode, but not the orphan record, which means - * we need to manually delete the orphan since iput will just - * do a destroy_inode + * Inode is already gone but the orphan item is still there, + * kill the orphan item. */ - if (is_bad_inode(inode)) { - trans = btrfs_start_transaction(root, 0); + if (ret == -ESTALE) { + trans = btrfs_start_transaction(root, 1); if (IS_ERR(trans)) { ret = PTR_ERR(trans); goto out; } - btrfs_orphan_del(trans, inode); + ret = btrfs_del_orphan_item(trans, root, + found_key.objectid); + BUG_ON(ret); btrfs_end_t...
2012 Aug 01
7
[PATCH] Btrfs: barrier before waitqueue_active
We need an smb_mb() before waitqueue_active to avoid missing wakeups. Before Mitch was hitting a deadlock between the ordered flushers and the transaction commit because the ordered flushers were waiting for more refs and were never woken up, so those smp_mb()''s are the most important. Everything else I added for correctness sake and to avoid getting bitten by this again somewhere else.
2013 Nov 12
0
[PATCH] Btrfs: incompatible format change to remove hole extents V4
...offset, len); @@ -2157,9 +2161,10 @@ static int btrfs_punch_hole(struct inode *inode, loff_t offset, loff_t len) /* * 1 - update the inode * 1 - removing the extents in the range - * 1 - adding the hole extent + * 1 - adding the hole extent if no_holes isn''t set */ - trans = btrfs_start_transaction(root, 3); + rsv_count = no_holes ? 2 : 3; + trans = btrfs_start_transaction(root, rsv_count); if (IS_ERR(trans)) { err = PTR_ERR(trans); goto out_free; @@ -2196,7 +2201,7 @@ static int btrfs_punch_hole(struct inode *inode, loff_t offset, loff_t len) btrfs_end_transaction(trans, root);...
2009 Nov 02
0
[PATCH 7/8] Make fallocate(2) more ENOSPC friendly
...root->sectorsize, 0, alloc_hint, (u64)-1, &ins, 1); if (ret) { WARN_ON(1); - goto out; + break; + } + + ret = btrfs_reserve_metadata_space(root, 3); + if (ret) { + btrfs_free_reserved_extent(root, ins.objectid, + ins.offset); + break; } + + trans = btrfs_start_transaction(root, 1); + ret = insert_reserved_file_extent(trans, inode, cur_offset, ins.objectid, ins.offset, ins.offset, @@ -5611,22 +5672,25 @@ static int prealloc_file_range(struct bt BUG_ON(ret); btrfs_drop_extent_cache(inode, cur_offset, cur_offset + ins.offset -1, 0); +...
2012 Jul 31
2
Btrfs Intermittent ENOSPC Issues
...far. (1) My test case won''t generate ENOSPC issues with lzo compression or no compression. (2) I''ve inserted some trace_printk debugging statements to trace back the call stack, and the ENOSPC errors only seem to occur on a new transaction: vfs_create -> btrfs_create -> btrfs_start_transaction -> start_transaction -> btrfs_block_rsv_add -> reserve_metadata_bytes. (3) The ENOSPC condition will usually clear in a few seconds, allowing writes to proceed. (4) I''ve added a loop to the reserve_metadata_bytes() function to loop back with ''flush_state = FLUSH_DELAL...
2013 Apr 25
10
[PATCH v4 0/3] Btrfs: quota rescan for 3.10
The kernel side for rescan, which is needed if you want to enable qgroup tracking on a non-empty volume. The first patch splits btrfs_qgroup_account_ref into readable ans reusable units. The second patch adds the rescan implementation (refer to its commit message for a description of the algorithm). The third patch starts an automatic rescan when qgroups are enabled. It is only separated to
2011 Mar 23
0
[PATCH] Btrfs: cleanup some BUG_ON()
...000 +0900 +++ linux-2.6.38.new/fs/btrfs/ioctl.c 2011-03-23 11:28:09.000000000 +0900 @@ -2348,12 +2348,15 @@ static noinline long btrfs_ioctl_start_s struct btrfs_root *root = BTRFS_I(file->f_dentry->d_inode)->root; struct btrfs_trans_handle *trans; u64 transid; + int ret; trans = btrfs_start_transaction(root, 0); if (IS_ERR(trans)) return PTR_ERR(trans); transid = trans->transid; - btrfs_commit_transaction_async(trans, root, 0); + ret = btrfs_commit_transaction_async(trans, root, 0); + if (ret) + return ret; if (argp) if (copy_to_user(argp, &transid, sizeof(transid))) diff -u...
2010 Apr 19
0
[PATCH 08/12] Btrfs: Introduce global metadata reservation
...trfs_defrag_root(struct btrfs_root *root, int cacheonly) { struct btrfs_fs_info *info = root->fs_info; - int ret; struct btrfs_trans_handle *trans; + int ret; unsigned long nr; - smp_mb(); - if (root->defrag_running) + if (xchg(&root->defrag_running, 1)) return 0; - trans = btrfs_start_transaction(root, 1); + while (1) { - root->defrag_running = 1; + trans = btrfs_start_transaction(root, 0); + if (IS_ERR(trans)) + return PTR_ERR(trans); + ret = btrfs_defrag_leaves(trans, root, cacheonly); + nr = trans->blocks_used; btrfs_end_transaction(trans, root); btrfs_btree_bala...
2007 Jun 29
2
Mknod: Operation not permitted
When trying to move my root to a btrfs filesystem, I found a missing feature (or a bug). It's not possible to create device files. To reproduce, run this on a btrfs filesystem: mknod test c 1 1 result: mknod: `test': Operation not permitted Frank
2010 Mar 15
1
[PATCH 1/2] Btrfs: remove bad fsync transaction check
...c_file(struct file *file, struct dentry *dentry, int datasync) } mutex_unlock(&root->fs_info->trans_mutex); - /* - * ok we haven''t committed the transaction yet, lets do a commit - */ - if (file && file->private_data) - btrfs_ioctl_trans_end(file); - trans = btrfs_start_transaction(root, 1); if (!trans) { ret = -ENOMEM; -- 1.7.0 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
2011 Aug 08
0
[PATCH] Btrfs: fix how we reserve space for deleting inodes
...BUG_ON(IS_ERR(trans)); - trans->block_rsv = root->orphan_block_rsv; - - ret = btrfs_block_rsv_check(trans, root, - root->orphan_block_rsv, 0, 5); - if (ret) { - BUG_ON(ret != -EAGAIN); - ret = btrfs_commit_transaction(trans, root); - BUG_ON(ret); - continue; + trans = btrfs_start_transaction(root, 2); + if (IS_ERR(trans)) { + printk(KERN_WARNING "Could not get space for a " + "delete, will truncate on mount\n"); + btrfs_orphan_del(NULL, inode); + goto no_delete; } ret = btrfs_truncate_inode_items(trans, root, inode, 0, 0); @@ -3574,14 +3580,1...
2014 Apr 23
0
[PATCH 001/001] btrfs: Mechanism to modify the permission of a subvolume
...| BTRFS_ROOT_SUBVOL_RDONLY); + printk(KERN_INFO "Setting %s to ro\n", vol_args->name); + } else { + btrfs_set_root_flags(&root->root_item, + root_flags & ~BTRFS_ROOT_SUBVOL_RDONLY); + printk(KERN_INFO "Setting %s to rw\n", vol_args->name); + } + + trans = btrfs_start_transaction(root, 1); + if (IS_ERR(trans)) { + ret = PTR_ERR(trans); + goto out_reset; + } + + ret = btrfs_update_root(trans, root->fs_info->tree_root, + &root->root_key, &root->root_item); + btrfs_commit_transaction(trans, root); + +out_reset: + if (ret) + btrfs_set_root_flags(&...
2012 Aug 24
4
[PATCH] Btrfs: pass lockdep rwsem metadata to async commit transaction
The freeze rwsem is taken by sb_start_intwrite() and dropped during the commit_ or end_transaction(). In the async case, that happens in a worker thread. Tell lockdep the calling thread is releasing ownership of the rwsem and the async thread is picking it up. Josef and I worked out a more complicated solution that made the async commit thread join and potentially get a later transaction, but
2008 Jan 07
1
[PATCH]Add rollback support for the converter
...1); btrfs_set_stack_inode_nblocks(&btrfs_inode, 0); - btrfs_set_stack_inode_mode(&btrfs_inode, S_IFREG | 0444); + btrfs_set_stack_inode_mode(&btrfs_inode, S_IFREG | 0400); + btrfs_set_stack_inode_flags(&btrfs_inode, BTRFS_INODE_NODATASUM); btrfs_init_path(&path); trans = btrfs_start_transaction(root, 1); @@ -862,7 +879,7 @@ static int create_ext2_image(struct btrf goto fail; ret = record_file_extent(trans, root, objectid, &btrfs_inode, last_byte, - new_block, sectorsize, 1); + new_block, sectorsize, 0); if (ret) goto fail; } @@ -902,6 +919,11 @@ again:...
2007 Aug 09
1
[RFC] All my fsync changes
...o->trans_mutex); + goto out; + } else if (last_trans->commit_done) { + mutex_unlock(&root->fs_info->trans_mutex); + goto out; + } + mutex_unlock(&root->fs_info->trans_mutex); + + /* + * ok we haven't committed the transaction yet, lets do a commit + */ trans = btrfs_start_transaction(root, 1); if (!trans) { ret = -ENOMEM; goto out; } ret = btrfs_commit_transaction(trans, root); +out: mutex_unlock(&root->fs_info->fs_mutex); -out: return ret > 0 ? EIO : ret; } diff -r f6da57af2473 inode.c --- a/inode.c Wed Aug 08 20:17:12 2007 -0400 +++ b/inode.c T...