Re: fs/btrfs/ioctl.c:2204:29: sparse: incorrect type in argument 4 (different address spaces)

2014-11-06 Thread Gerhard Heift
return ret; 2212 } --- 0-DAY kernel test infrastructureOpen Source Technology Center http://lists.01.org/mailman/listinfo/kbuild Intel Corporation From 620ff16527bd711e7b6677ba7d5ecfb4467c231a Mon Sep 17 00:00:00 2001 From: Gerhard Heift gerh...@heift.name

Re: [PATCH RFCv3 5/6] btrfs: search_ioctl: direct copy to userspace

2014-01-30 Thread Gerhard Heift
2014-01-30 Gerhard Heift gerh...@heift.name: By copying each found item seperatly to userspace, we do not need extra memory in the kernel. This allows to run a large search inside of a single call. Signed-off-by: Gerhard Heift gerh...@heift.name --- fs/btrfs/ioctl.c | 52

[PATCH RFCv4] new ioctl TREE_SEARCH_V2

2014-01-30 Thread Gerhard Heift
This patch series first rewrites tree_search to copy found items directly to userspace and then adds a new ioctl TREE_SEARCH_V2 with which we could store them in a varying buffer. Now even items larger than 3992 bytes or a large amount of items can be returned. This is the case for some

[PATCH RFCv4 2/7] btrfs: tree_search, search_ioctl: accept varying buffer

2014-01-30 Thread Gerhard Heift
rewrite search_ioctl to accept a buffer with varying size Signed-off-by: Gerhard Heift gerh...@heift.name --- fs/btrfs/ioctl.c | 18 +++--- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index b1c5b4f..9b66eac 100644 --- a/fs/btrfs

[PATCH RFCv4 7/7] btrfs: new ioctl TREE_SEARCH_V2

2014-01-30 Thread Gerhard Heift
this buffer are for example some of the type EXTENT_CSUM. Signed-off-by: Gerhard Heift gerh...@heift.name --- fs/btrfs/ioctl.c | 40 include/uapi/linux/btrfs.h | 10 ++ 2 files changed, 50 insertions(+) diff --git a/fs/btrfs/ioctl.c b/fs

[PATCH RFCv4 6/7] btrfs: tree_search, search_ioctl: direct copy to userspace

2014-01-30 Thread Gerhard Heift
By copying each found item seperatly to userspace, we do not need extra buffer in the kernel. Signed-off-by: Gerhard Heift gerh...@heift.name --- fs/btrfs/ioctl.c | 48 +--- 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/fs/btrfs

[PATCH RFCv4 1/7] btrfs: tree_search: eliminate redundant nr_items check

2014-01-30 Thread Gerhard Heift
If the amount of items reached the given limit of nr_items, we can leave copy_to_sk without updating the key. Also by returning 1 we leave the loop in search_ioctl without rechecking if we reached the given limit. Signed-off-by: Gerhard Heift gerh...@heift.name --- fs/btrfs/ioctl.c | 12

[PATCH RFCv4 4/7] btrfs: tree_search, copy_to_sk: return needed size on EOVERFLOW

2014-01-30 Thread Gerhard Heift
If an item in tree_search is too large to be stored in the given buffer, return the needed size (including the header). Signed-off-by: Gerhard Heift gerh...@heift.name --- fs/btrfs/ioctl.c | 24 +++- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/fs/btrfs

[PATCH RFCv4 3/7] btrfs: tree_search, copy_to_sk: return EOVERFLOW for too small buffer

2014-01-30 Thread Gerhard Heift
. tree_search changes -EOVERFLOW back to 0 to behave similiar to the way it behaved before this patch. Signed-off-by: Gerhard Heift gerh...@heift.name --- fs/btrfs/ioctl.c | 28 ++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c

[PATCH RFCv3 2/6] btrfs: copy_to_sk returns EOVERFLOW for too small buffer

2014-01-29 Thread Gerhard Heift
. tree_search changes -EOVERFLOW back to 0 to behave similiar to the way it behaved before this patch. Signed-off-by: Gerhard Heift gerh...@heift.name --- fs/btrfs/ioctl.c | 28 ++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c

[PATCH RFCv3 3/6] btrfs: tree_search returns needed size on EOVERFLOW

2014-01-29 Thread Gerhard Heift
If an item in tree_search is too large to be stored in the given buffer, return the needed size (including the header). Signed-off-by: Gerhard Heift gerh...@heift.name --- fs/btrfs/ioctl.c | 24 +++- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/fs/btrfs

[PATCH RFCv3] new ioctl TREE_SEARCH_V2

2014-01-29 Thread Gerhard Heift
This patch series adds a new ioctl TREE_SEARCH_V2 with which we could store the results in a varying buffer. With that even items larger than 3992 bytes or a large amount of items can be returned. This is the case e.g. for some EXTENT_CSUM items, which could have a size up to 16k. I had a few

[PATCH RFCv3 6/6] btrfs: new ioctl TREE_SEARCH_V2

2014-01-29 Thread Gerhard Heift
this buffer are for example some of the type EXTENT_CSUM. Signed-off-by: Gerhard Heift gerh...@heift.name --- fs/btrfs/ioctl.c | 40 include/uapi/linux/btrfs.h | 10 ++ 2 files changed, 50 insertions(+) diff --git a/fs/btrfs/ioctl.c b/fs

[PATCH RFCv3 1/6] btrfs: search_ioctl accepts varying buffer

2014-01-29 Thread Gerhard Heift
rewrite search_ioctl to accept a buffer with varying size Signed-off-by: Gerhard Heift gerh...@heift.name --- fs/btrfs/ioctl.c | 18 +++--- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 34772cb..6aa79e0 100644 --- a/fs/btrfs

[PATCH RFCv3 4/6] btrfs: new function read_extent_buffer_to_user

2014-01-29 Thread Gerhard Heift
This new function reads the content of an extent directly to user memory. Signed-off-by: Gerhard Heift gerh...@heift.name --- fs/btrfs/extent_io.c | 37 + fs/btrfs/extent_io.h | 3 +++ 2 files changed, 40 insertions(+) diff --git a/fs/btrfs/extent_io.c b/fs

[PATCH RFCv3 5/6] btrfs: search_ioctl: direct copy to userspace

2014-01-29 Thread Gerhard Heift
By copying each found item seperatly to userspace, we do not need extra memory in the kernel. This allows to run a large search inside of a single call. Signed-off-by: Gerhard Heift gerh...@heift.name --- fs/btrfs/ioctl.c | 52 1 file changed

Re: [PATCH RFCv2] new ioctl TREE_SEARCH_V2

2014-01-28 Thread Gerhard Heift
(as suggested in [2]) will eliminate the double-copy of data and needs less memory in the kernel. [1] http://article.gmane.org/gmane.comp.file-systems.btrfs/31765 [2] http://article.gmane.org/gmane.comp.file-systems.btrfs/32064 Thanks, Anand On 01/27/2014 09:28 PM, Gerhard Heift wrote

[PATCH RFCv2] new ioctl TREE_SEARCH_V2

2014-01-27 Thread Gerhard Heift
This patch series adds a new ioctl TREE_SEARCH_V2 with which we could store the results in a varying buffer. Now even items larger than 3992 bytes or a large amount of items can be returned. I have a few questions: Which value should I assign to TREE_SEARCH_V2? Should we limit the buffer

[PATCH RFCv2 1/6] btrfs: search_ioctl accepts varying buffer

2014-01-27 Thread Gerhard Heift
rewrite search_ioctl to accept a buffer with varying size Signed-off-by: Gerhard Heift gerh...@heift.name --- fs/btrfs/ioctl.c | 19 --- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 3970f32..be4c780 100644 --- a/fs/btrfs

[PATCH RFCv2 2/6] btrfs: search_ioctl rejects unused setted values

2014-01-27 Thread Gerhard Heift
To prevent unexpectet values in the unused fields of the search key fail early. Otherwise future extensions would break the behavior of the search if current implementations in userspace set them to values other than zero. Signed-off-by: Gerhard Heift gerh...@heift.name --- fs/btrfs/ioctl.c | 3

[PATCH RFCv2 6/6] btrfs: in tree_search extent buffer lifetime

2014-01-27 Thread Gerhard Heift
Instead of allocting and releasing a buffer for each leaf, which will be visited during a search, allocate (and expand) a buffer for the whole search. This saves a few allocations and deallocations during larger searchs, which visits more leafs. Signed-off-by: Gerhard Heift gerh...@heift.name

[PATCH RFCv2 5/6] btrfs: search_ioctl: direct copy to userspace

2014-01-27 Thread Gerhard Heift
By copying each found item seperatly to userspace, we only need a small buffer in the kernel. This allows to run a large search inside of a single call. Signed-off-by: Gerhard Heift gerh...@heift.name --- fs/btrfs/ioctl.c | 107 --- 1 file

[PATCH RFCv2 3/6] btrfs: copy_to_sk returns EOVERFLOW for too small buffer

2014-01-27 Thread Gerhard Heift
. tree_search changes -EOVERFLOW back to 0 to behave similiar to the way it behaved before this patch. Signed-off-by: Gerhard Heift gerh...@heift.name --- fs/btrfs/ioctl.c | 17 +++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 919d928

[PATCH RFCv2 4/6] btrfs: new ioctl TREE_SEARCH_V2

2014-01-27 Thread Gerhard Heift
is limited to 32 pages. Signed-off-by: Gerhard Heift gerh...@heift.name --- fs/btrfs/ioctl.c | 48 ++ include/uapi/linux/btrfs.h | 8 2 files changed, 56 insertions(+) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 9fa222d

Re: [PATCH RFCv2 2/6] btrfs: search_ioctl rejects unused setted values

2014-01-27 Thread Gerhard Heift
2014-01-27 David Sterba dste...@suse.cz: On Mon, Jan 27, 2014 at 02:28:28PM +0100, Gerhard Heift wrote: To prevent unexpectet values in the unused fields of the search key fail early. Otherwise future extensions would break the behavior of the search if current implementations in userspace

Re: [PATCH RFCv2 4/6] btrfs: new ioctl TREE_SEARCH_V2

2014-01-27 Thread Gerhard Heift
2014-01-27 David Sterba dste...@suse.cz: On Mon, Jan 27, 2014 at 02:28:30PM +0100, Gerhard Heift wrote: --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -2032,6 +2032,52 @@ static noinline int btrfs_ioctl_tree_search(struct file *file, return ret; } +static noinline int

Re: [PATCH RFCv2 5/6] btrfs: search_ioctl: direct copy to userspace

2014-01-27 Thread Gerhard Heift
2014-01-27 David Sterba dste...@suse.cz: On Mon, Jan 27, 2014 at 02:28:31PM +0100, Gerhard Heift wrote: By copying each found item seperatly to userspace, we only need a small buffer in the kernel. This allows to run a large search inside of a single call. Signed-off-by: Gerhard Heift gerh

[PATCH RFC] new ioctl TREE_SEARCH_V2

2014-01-17 Thread Gerhard Heift
This patch series adds a new ioctl TREE_SEARCH_V2 with which we could store the results in a varying buffer. Now even items larger than 3992 bytes or a large amount of items can be returned. I have a few questions: Which value should I assign to TREE_SEARCH_V2? Should we limit the buffer

[PATCH RFC 1/5] btrfs: search_ioctl accepts varying buffer

2014-01-17 Thread Gerhard Heift
rewrite search_ioctl to accept a buffer with varying size Signed-off-by: Gerhard Heift gerh...@heift.name --- fs/btrfs/ioctl.c | 19 --- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 3970f32..be4c780 100644 --- a/fs/btrfs

[PATCH RFC 5/5] btrfs: search_ioctl: direct copy to userspace

2014-01-17 Thread Gerhard Heift
By copying each found item seperatly to userspace, we only need a small amount of memory in the kernel. This allows to run a large search inside of a single call. Signed-off-by: Gerhard Heift gerh...@heift.name --- fs/btrfs/ioctl.c | 105 +-- 1

[PATCH RFC 2/5] btrfs: search_ioctl rejects unused setted values

2014-01-17 Thread Gerhard Heift
To prevent unexpectet values in the unused fields of the search key fail early. Otherwise future extensions would break the behavior of the search if current implementations in userspace set them to values other than zero. Signed-off-by: Gerhard Heift gerh...@heift.name --- fs/btrfs/ioctl.c | 3

[PATCH RFC 4/5] btrfs: new ioctl TREE_SEARCH_V2

2014-01-17 Thread Gerhard Heift
is limited to 32 pages. Signed-off-by: Gerhard Heift gerh...@heift.name --- fs/btrfs/ioctl.c | 48 ++ include/uapi/linux/btrfs.h | 8 2 files changed, 56 insertions(+) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 9fa222d

[PATCH RFC 3/5] btrfs: copy_to_sk returns EOVERFLOW for too small buffer

2014-01-17 Thread Gerhard Heift
. tree_search changes -EOVERFLOW back to 0 to behave similiar to the way it behaved before this patch. Signed-off-by: Gerhard Heift gerh...@heift.name --- fs/btrfs/ioctl.c | 17 +++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 919d928

Re: BTRFS_SEARCH_ARGS_BUFSIZE too small

2014-01-15 Thread Gerhard Heift
; __u64 buf_len char __user *buf; }; And against which commit should I rebase them? 2014/1/15 David Sterba dste...@suse.cz: On Fri, Jan 10, 2014 at 12:44:17AM +0100, Gerhard Heift wrote: I'm playing around with the BTRFS_IOC_SEARCH_TREE to extract the csums of the physical blocks. During

Re: [PATCH] btrfs: call permission checks earlier in ioctls and return EPERM

2014-01-15 Thread Gerhard Heift
2014/1/15 David Sterba dste...@suse.cz: The owner and capability checks in IOC_SUBVOL_SETFLAGS and SET_RECEIVED_SUBVOL should be called before any other checks are done. Also unify the error code to EPERM. Signed-off-by: David Sterba dste...@suse.cz --- fs/btrfs/ioctl.c | 22

Re: FILE_EXTENT_SAME changes mtime and ctime

2014-01-09 Thread Gerhard Heift
2014/1/6 David Sterba dste...@suse.cz: On Mon, Jan 06, 2014 at 12:02:51AM +0100, Gerhard Heift wrote: I am currently playing with snapshots and manual deduplication of files. During these tests I noticed the change of ctime and mtime in the snapshot after the deduplication

BTRFS_SEARCH_ARGS_BUFSIZE too small

2014-01-09 Thread Gerhard Heift
Hello, I'm playing around with the BTRFS_IOC_SEARCH_TREE to extract the csums of the physical blocks. During the tests some item_header had len = 0, which indicates the buffer was to small to hold the item. I added a printk into the kernel to get the original size of the item and it was around

FILE_EXTENT_SAME changes mtime and ctime

2014-01-05 Thread Gerhard Heift
Hello, I am currently playing with snapshots and manual deduplication of files. During these tests I noticed the change of ctime and mtime in the snapshot after the deduplication with FILE_EXTENT_SAME. Does this happens on purpose? Otherwise I would like to have ctime and mtime left unmodified,