aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/ctree.h3
-rw-r--r--fs/btrfs/xattr.c51
2 files changed, 1 insertions, 53 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index beb05b1de54c..53d315bdd16d 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -1689,8 +1689,7 @@ void btrfs_sysfs_del_super(struct btrfs_fs_info *root);
1689 1689
1690/* xattr.c */ 1690/* xattr.c */
1691ssize_t btrfs_listxattr(struct dentry *dentry, char *buffer, size_t size); 1691ssize_t btrfs_listxattr(struct dentry *dentry, char *buffer, size_t size);
1692int btrfs_delete_xattrs(struct btrfs_trans_handle *trans, 1692
1693 struct btrfs_root *root, struct inode *inode);
1694/* super.c */ 1693/* super.c */
1695u64 btrfs_parse_size(char *str); 1694u64 btrfs_parse_size(char *str);
1696int btrfs_parse_options(struct btrfs_root *root, char *options); 1695int btrfs_parse_options(struct btrfs_root *root, char *options);
diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c
index 3e9eb91c3c89..6730b5958844 100644
--- a/fs/btrfs/xattr.c
+++ b/fs/btrfs/xattr.c
@@ -379,57 +379,6 @@ err:
379} 379}
380 380
381/* 381/*
382 * delete all the xattrs associated with the inode.
383 */
384int btrfs_delete_xattrs(struct btrfs_trans_handle *trans,
385 struct btrfs_root *root, struct inode *inode)
386{
387 struct btrfs_path *path;
388 struct btrfs_key key, found_key;
389 struct btrfs_item *item;
390 struct extent_buffer *leaf;
391 int ret;
392
393 path = btrfs_alloc_path();
394 if (!path)
395 return -ENOMEM;
396 path->reada = -1;
397 key.objectid = inode->i_ino;
398 btrfs_set_key_type(&key, BTRFS_XATTR_ITEM_KEY);
399 key.offset = (u64)-1;
400
401 while(1) {
402 /* look for our next xattr */
403 ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
404 if (ret < 0)
405 goto out;
406 BUG_ON(ret == 0);
407
408 if (path->slots[0] == 0)
409 break;
410
411 path->slots[0]--;
412 leaf = path->nodes[0];
413 item = btrfs_item_nr(leaf, path->slots[0]);
414 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]);
415
416 if (found_key.objectid != key.objectid)
417 break;
418 if (btrfs_key_type(&found_key) != BTRFS_XATTR_ITEM_KEY)
419 break;
420
421 ret = btrfs_del_item(trans, root, path);
422 BUG_ON(ret);
423 btrfs_release_path(root, path);
424 }
425 ret = 0;
426out:
427 btrfs_free_path(path);
428
429 return ret;
430}
431
432/*
433 * Handler functions 382 * Handler functions
434 */ 383 */
435#define BTRFS_XATTR_SETGET_FUNCS(name, index) \ 384#define BTRFS_XATTR_SETGET_FUNCS(name, index) \