search for: btrfs_first_free_objectid

Displaying 20 results from an estimated 24 matches for "btrfs_first_free_objectid".

2010 Nov 17
0
[PATCH] Btrfs: handle NFS lookups properly
...leaf; + unsigned long name_ptr; + struct btrfs_key key; + int name_len; + int ret; + + if (!dir || !inode) + return -EINVAL; + + if (!S_ISDIR(dir->i_mode)) + return -EINVAL; + + path = btrfs_alloc_path(); + if (!path) + return -ENOMEM; + path->leave_spinning = 1; + + if (inode->i_ino == BTRFS_FIRST_FREE_OBJECTID) { + key.objectid = BTRFS_I(inode)->root->root_key.objectid; + key.type = BTRFS_ROOT_BACKREF_KEY; + key.offset = (u64)-1; + root = root->fs_info->tree_root; + } else { + key.objectid = inode->i_ino; + key.offset = dir->i_ino; + key.type = BTRFS_INODE_REF_KEY; + } + + ret =...
2011 Aug 23
0
[PATCH] Btrfs: fix an oops when deleting snapshots
...f81153d0d>] sys_unlinkat+0x2d/0x40 [<ffffffff8147896b>] system_call_fastpath+0x16/0x1b RIP [<ffffffffa054f7b9>] btrfs_orphan_add+0x179/0x1a0 [btrfs] When it comes to btrfs_lookup_dentry, we may set a snapshot''s inode->i_ino to BTRFS_EMPTY_SUBVOL_DIR_OBJECTID instead of BTRFS_FIRST_FREE_OBJECTID, while the snapshot''s location.objectid remains unchanged. However, btrfs_ino() does not take this into account, and returns a wrong ino, and causes the oops. Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com> --- fs/btrfs/btrfs_inode.h | 6 +++++- 1 files changed, 5 insertions(+...
2012 Sep 13
0
[PATCH] btrfs: return EPERM upon rmdir on a subvolume
...x a4167ef..a67dadd 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -3815,9 +3815,10 @@ static int btrfs_rmdir(struct inode *dir, struct dentry *dentry) struct btrfs_trans_handle *trans; unsigned long nr = 0; - if (inode->i_size > BTRFS_EMPTY_DIR_SIZE || - btrfs_ino(inode) == BTRFS_FIRST_FREE_OBJECTID) + if (inode->i_size > BTRFS_EMPTY_DIR_SIZE) return -ENOTEMPTY; + if (btrfs_ino(inode) == BTRFS_FIRST_FREE_OBJECTID) + return -EPERM; trans = __unlink_start_trans(dir, dentry); if (IS_ERR(trans)) -- 1.7.9 -- To unsubscribe from this list: send the line "unsubscribe linux-btrf...
2010 Apr 08
2
ENOTEMPTY on "rm -rf" for snapshot and subvolume
...tried deleting the same snapshot. But i am getting ENOTEMPTY for "rmdir". But when i see the actual files inside are deleted not the parent directory. From the code it looks like if (inode->i_size > BTRFS_EMPTY_DIR_SIZE || inode->i_ino == BTRFS_FIRST_FREE_OBJECTID) return -ENOTEMPTY; Why would "unlink" succeeds for the files inside the directory?, yet returning ENOTEMPTY This looks odd after this, i went ahead and tried deleting the the existing volume itself same result. So i was wondering if at all t...
2010 Oct 25
2
[PATCH] Btrfs: allow subvol deletion by unprivileged user with -o user_subvol_rm_allowed
...of the subvol, not a random directory contained + * within it. + */ + err = -EINVAL; + if (root == dest) + goto out_dput; + + /* check if subvolume may be deleted by a non-root user */ + err = btrfs_may_delete(dir, dentry, 1); + if (err) + goto out_dput; + } + if (inode->i_ino != BTRFS_FIRST_FREE_OBJECTID) { err = -EINVAL; goto out_dput; } - dest = BTRFS_I(inode)->root; - mutex_lock(&inode->i_mutex); err = d_invalidate(dentry); if (err) diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 4da2680..8ff5a3a 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -68,7 +68,7...
2013 Mar 15
0
[PATCH] Btrfs-progs: add skinny metadata support to progs V3
...BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA); key.objectid = bytenr; key.type = BTRFS_EXTENT_ITEM_KEY; @@ -1034,11 +1042,44 @@ static int lookup_inline_extent_backref(struct btrfs_trans_handle *trans, extra_size = btrfs_extent_inline_ref_size(want); else extra_size = -1; + + if (owner < BTRFS_FIRST_FREE_OBJECTID && skinny_metadata) { + skinny_metadata = 1; + key.type = BTRFS_METADATA_ITEM_KEY; + key.offset = owner; + } else if (skinny_metadata) { + skinny_metadata = 0; + } + +again: ret = btrfs_search_slot(trans, root, &key, path, extra_size, 1); if (ret < 0) { err = ret; goto...
2014 Apr 23
0
[PATCH 001/001] btrfs: Mechanism to modify the permission of a subvolume
...trfs_ioctl_vol_args_v2 *vol_args; + struct inode *inode = file_inode(file); + struct btrfs_root *root = BTRFS_I(inode)->root; + struct btrfs_trans_handle *trans; + u64 root_flags; + u64 flags; + int ret = 0; + + ret = mnt_want_write_file(file); + if (ret) + goto out; + + if (btrfs_ino(inode) != BTRFS_FIRST_FREE_OBJECTID) { + ret = -EINVAL; + goto out_drop_write; + } + vol_args = memdup_user(arg, sizeof(*vol_args)); + if (IS_ERR(vol_args)) + goto out_drop_write; + vol_args->name[BTRFS_SUBVOL_NAME_MAX] = '\0'; + flags = vol_args->flags; + if (!inode_owner_or_capable(inode)) { + ret = -EACCES; + go...
2009 May 12
0
[PATCH 1/2] btrfs-progs: mixed back ref support
...t btrfs_extent_ref); - btrfs_set_ref_root(leaf, ref, ref_root); - btrfs_set_ref_generation(leaf, ref, ref_generation); - btrfs_set_ref_objectid(leaf, ref, owner_objectid); - btrfs_set_ref_num_refs(leaf, ref, 1); - } else if (ret == -EEXIST) { - u64 existing_owner; - BUG_ON(owner_objectid < BTRFS_FIRST_FREE_OBJECTID); - leaf = path->nodes[0]; + ret = btrfs_insert_empty_item(trans, root, path, &key, size); + if (ret && ret != -EEXIST) + goto fail; + + leaf = path->nodes[0]; + if (parent) { + struct btrfs_shared_data_ref *ref; ref = btrfs_item_ptr(leaf, path->slots[0], - struct...
2013 Jan 10
0
[PATCH 03/11] Btrfs: use atomic for fs_info->last_trans_log_full_commit
...= kzalloc(sizeof(*cache), GFP_NOFS); if (!cache) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index aadb0db..fb70bcb 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -7396,7 +7396,8 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry, if (unlikely(old_ino == BTRFS_FIRST_FREE_OBJECTID)) { /* force full log commit if subvolume involved. */ - root->fs_info->last_trans_log_full_commit = trans->transid; + atomic64_set(&root->fs_info->last_trans_log_full_commit, + trans->transid); } else { ret = btrfs_insert_inode_ref(trans, dest, new...
2012 Aug 01
17
[PATCH] add crtime to the snapshot list
From: Anand <anand.jain@oracle.com> This patch adds creation-time to the snapshot list display, which would help user to better manage the snapshots when number of snapshots grow substantially. This patch is developed and on top of the send/receive btrfs and btrfs-progs repo at git://github.com/ablock84/linux-btrfs.git (send-v2) git://github.com/ablock84/btrfs-progs.git (send-v2)
2010 Mar 20
2
[PATCH 4/4] btrfs-convert: split into convert/.
...xtents as dirty */ - int (*cache_free_extents)(struct convert_fs *fs, - struct extent_io_tree *tree); - /* Copy everything over */ - int (*copy_inodes)(struct convert_fs *fs, struct btrfs_root *root, - int datacsum, int packing, int noxattr); - - void *privdata; -}; - -#define INO_OFFSET (BTRFS_FIRST_FREE_OBJECTID - EXT2_ROOT_INO) #define STRIPE_LEN (64 * 1024) #define ORIG_IMAGE_SUBVOL_OBJECTID BTRFS_FIRST_FREE_OBJECTID -/* - * Open Ext2fs in readonly mode, read block allocation bitmap and - * inode bitmap into memory. - */ -static int open_ext2fs(const char *name, ext2_filsys *ret_fs) -{ - errcode_t re...
2012 Jun 29
12
[PATCH 1/3] Btrfs-progs: add support to set subvolume/snapshot readonly
Setting subvolume/snapshot readonly has been missing for a long time. With this patch, we can set a subvolume/snapshot readonly via: o btrfs subvolume set-ro <path> Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com> --- cmds-subvolume.c | 40 ++++++++++++++++++++++++++++++++++++++++ ioctl.h | 7 +++++++ 2 files changed, 47 insertions(+), 0 deletions(-) diff --git
2013 Feb 23
4
Changing node & leaf size on live partition.
Hi, Question is pretty simple: "How to change node size and leaf size on previously created partition?" Now, I know what most people will say: "you should''ve be smarter while typing mkfs.btrfs". Well, I''m intending to convert in place ext4 partition but there seems to be no option for leaf and node size in this tool. If it''s not possible I guess
2013 Apr 09
19
[PATCH 00/17] Btrfs-progs: some receive related patches
Most fixes are trivial. The one from Alex is fixing a real bug that several users have reported. Alex sent the patch half a year ago and it was not yet integrated. The patch "Use /proc/mounts instead of /etc/mtab" is a repost. The patch "btrfs-receive optionally honors the end-cmd" is a preparation step to allow backup tools to multiplex a single communication stream (e.g. a
2013 Oct 16
0
[PATCH] Btrfs: add tests for btrfs_get_extent V2
...i; + struct extent_buffer *leaf = root->node; + struct btrfs_key key; + u32 value_len = sizeof(struct btrfs_file_extent_item); + + if (type == BTRFS_FILE_EXTENT_INLINE) + value_len += len; + memset(&path, 0, sizeof(path)); + + path.nodes[0] = leaf; + path.slots[0] = slot; + + key.objectid = BTRFS_FIRST_FREE_OBJECTID; + key.type = BTRFS_EXTENT_DATA_KEY; + key.offset = start; + + setup_items_for_insert(root, &path, &key, &value_len, value_len, + value_len + sizeof(struct btrfs_item), 1); + fi = btrfs_item_ptr(leaf, slot, struct btrfs_file_extent_item); + btrfs_set_file_extent_generation(leaf...
2008 Oct 27
0
[PATCH 3/4] update nodatacow code
...we reach here through the oldest root, therefore - * all other reference from same snapshot should have - * a larger generation. - */ - if ((root_objectid != btrfs_ref_root(leaf, ref_item)) || - (parent_gen > 0 && parent_gen > ref_generation) || - (ref_objectid >= BTRFS_FIRST_FREE_OBJECTID && - ref_objectid != btrfs_ref_objectid(leaf, ref_item))) { - *ref_count = 2; - break; - } - - *ref_count = 1; - if (*min_generation > ref_generation) - *min_generation = ref_generation; - - path->slots[0]++; - } - ret = 0; -out: - btrfs_free_path(path); - return ret;...
2011 Oct 04
68
[patch 00/65] Error handling patchset v3
Hi all - Here''s my current error handling patchset, against 3.1-rc8. Almost all of this patchset is preparing for actual error handling. Before we start in on that work, I''m trying to reduce the surface we need to worry about. It turns out that there is a ton of code that returns an error code but never actually reports an error. The patchset has grown to 65 patches. 46 of them
2011 Nov 01
7
corrupted btrfs after suspend2ram uncorrectable with scrub
Hello, I''m using kernel 3.1.0 and I have both / and /home as btrfs. I used suspend to ram quite often and never had a problem, but yesterday I''ve suspended to get into a plane and when I resumed my /home was all about input/output errors. Reboot did not help either. My root (/) did not suffer any problems. Today I''ve upgraded btrfs-progs to latest GIT and tried scrub
2011 Aug 15
9
[patch v2 0/9] btrfs: More error handling patches
Hi all - The following 9 patches add more error handling to the btrfs code: - Add btrfs_panic - Catch locking failures in {set,clear}_extent_bit - Push up set_extent_bit errors to callers - Push up lock_extent errors to callers - Push up clear_extent_bit errors to callers - Push up unlock_extent errors to callers - Make pin_down_extent return void - Push up btrfs_pin_extent errors to
2010 Sep 03
0
[PATCH 1/2] btrfs: document where we use BUG_ON instead of error handling
...} /* @@ -7368,17 +7368,17 @@ static noinline int relocate_one_path(struct btrfs_trans_handle *trans, * the reloc tree. */ ret = btrfs_merge_path(trans, root, keys, nodes, lowest_level); - BUG_ON(ret < 0); + btrfs_fixable_bug_on(ret < 0); if (ref_path->owner_objectid >= BTRFS_FIRST_FREE_OBJECTID) { ret = btrfs_search_slot(trans, reloc_root, first_key, path, 0, 0); - BUG_ON(ret); + btrfs_fixable_bug_on(ret); extent_buffer_get(path->nodes[0]); eb = path->nodes[0]; btrfs_release_path(reloc_root, path); ret = invalidate_extent_cache(reloc_root, eb, group, root); -...