linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3.15-rc2] btrfs: replace error code from btrfs_drop_extents
@ 2014-04-15 16:50 David Sterba
  2014-04-15 19:23 ` Mitch Harder
  2014-04-16 15:02 ` [PATCH v2] " David Sterba
  0 siblings, 2 replies; 3+ messages in thread
From: David Sterba @ 2014-04-15 16:50 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

There's a case which clone does not handle and used to BUG_ON instead,
(testcase xfstests/btrfs/035), now returns EINVAL. This error code is
confusing to the ioctl caller, as it normally signifies errorneous
arguments.

Change it to ENOPNOTSUPP which allows a fall back to copy instead of
clone. This does not affect the common reflink operation.

Signed-off-by: David Sterba <dsterba@suse.cz>
---
 fs/btrfs/file.c  |    6 +++---
 fs/btrfs/ioctl.c |    4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index eb742c07e7a4..bdd0b17150dd 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -800,7 +800,7 @@ next_slot:
 		if (start > key.offset && end < extent_end) {
 			BUG_ON(del_nr > 0);
 			if (extent_type == BTRFS_FILE_EXTENT_INLINE) {
-				ret = -EINVAL;
+				ret = -EOPNOTSUPP;
 				break;
 			}
 
@@ -846,7 +846,7 @@ next_slot:
 		 */
 		if (start <= key.offset && end < extent_end) {
 			if (extent_type == BTRFS_FILE_EXTENT_INLINE) {
-				ret = -EINVAL;
+				ret = -EOPNOTSUPP;
 				break;
 			}
 
@@ -872,7 +872,7 @@ next_slot:
 		if (start > key.offset && end >= extent_end) {
 			BUG_ON(del_nr > 0);
 			if (extent_type == BTRFS_FILE_EXTENT_INLINE) {
-				ret = -EINVAL;
+				ret = -EOPNOTSUPP;
 				break;
 			}
 
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index e79ff6b90cb7..2ad7de94efef 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -3066,7 +3066,7 @@ process_slot:
 							 new_key.offset + datal,
 							 1);
 				if (ret) {
-					if (ret != -EINVAL)
+					if (ret != -EOPNOTSUPP)
 						btrfs_abort_transaction(trans,
 								root, ret);
 					btrfs_end_transaction(trans, root);
@@ -3141,7 +3141,7 @@ process_slot:
 							 new_key.offset + datal,
 							 1);
 				if (ret) {
-					if (ret != -EINVAL)
+					if (ret != -EOPNOTSUPP)
 						btrfs_abort_transaction(trans,
 							root, ret);
 					btrfs_end_transaction(trans, root);
-- 
1.7.9


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 3.15-rc2] btrfs: replace error code from btrfs_drop_extents
  2014-04-15 16:50 [PATCH 3.15-rc2] btrfs: replace error code from btrfs_drop_extents David Sterba
@ 2014-04-15 19:23 ` Mitch Harder
  2014-04-16 15:02 ` [PATCH v2] " David Sterba
  1 sibling, 0 replies; 3+ messages in thread
From: Mitch Harder @ 2014-04-15 19:23 UTC (permalink / raw)
  To: David Sterba; +Cc: linux-btrfs

On Tue, Apr 15, 2014 at 11:50 AM, David Sterba <dsterba@suse.cz> wrote:
> There's a case which clone does not handle and used to BUG_ON instead,
> (testcase xfstests/btrfs/035), now returns EINVAL. This error code is
> confusing to the ioctl caller, as it normally signifies errorneous
> arguments.
>
> Change it to ENOPNOTSUPP which allows a fall back to copy instead of
> clone. This does not affect the common reflink operation.
>

Minor spelling error in the commit message, you clearly mean
EOPNOTSUPP, not ENOPNOTSUPP.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2] btrfs: replace error code from btrfs_drop_extents
  2014-04-15 16:50 [PATCH 3.15-rc2] btrfs: replace error code from btrfs_drop_extents David Sterba
  2014-04-15 19:23 ` Mitch Harder
@ 2014-04-16 15:02 ` David Sterba
  1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2014-04-16 15:02 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

There's a case which clone does not handle and used to BUG_ON instead,
(testcase xfstests/btrfs/035), now returns EINVAL. This error code is
confusing to the ioctl caller, as it normally signifies errorneous
arguments.

Change it to EOPNOTSUPP which allows a fall back to copy instead of
clone. This does not affect the common reflink operation.

Signed-off-by: David Sterba <dsterba@suse.cz>
---
v2: fix error code typo in changelog, pointed out by Mitch

 fs/btrfs/file.c  |    6 +++---
 fs/btrfs/ioctl.c |    4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index eb742c07e7a4..bdd0b17150dd 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -800,7 +800,7 @@ next_slot:
 		if (start > key.offset && end < extent_end) {
 			BUG_ON(del_nr > 0);
 			if (extent_type == BTRFS_FILE_EXTENT_INLINE) {
-				ret = -EINVAL;
+				ret = -EOPNOTSUPP;
 				break;
 			}
 
@@ -846,7 +846,7 @@ next_slot:
 		 */
 		if (start <= key.offset && end < extent_end) {
 			if (extent_type == BTRFS_FILE_EXTENT_INLINE) {
-				ret = -EINVAL;
+				ret = -EOPNOTSUPP;
 				break;
 			}
 
@@ -872,7 +872,7 @@ next_slot:
 		if (start > key.offset && end >= extent_end) {
 			BUG_ON(del_nr > 0);
 			if (extent_type == BTRFS_FILE_EXTENT_INLINE) {
-				ret = -EINVAL;
+				ret = -EOPNOTSUPP;
 				break;
 			}
 
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index e79ff6b90cb7..2ad7de94efef 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -3066,7 +3066,7 @@ process_slot:
 							 new_key.offset + datal,
 							 1);
 				if (ret) {
-					if (ret != -EINVAL)
+					if (ret != -EOPNOTSUPP)
 						btrfs_abort_transaction(trans,
 								root, ret);
 					btrfs_end_transaction(trans, root);
@@ -3141,7 +3141,7 @@ process_slot:
 							 new_key.offset + datal,
 							 1);
 				if (ret) {
-					if (ret != -EINVAL)
+					if (ret != -EOPNOTSUPP)
 						btrfs_abort_transaction(trans,
 							root, ret);
 					btrfs_end_transaction(trans, root);
-- 
1.7.9


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-04-16 15:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-15 16:50 [PATCH 3.15-rc2] btrfs: replace error code from btrfs_drop_extents David Sterba
2014-04-15 19:23 ` Mitch Harder
2014-04-16 15:02 ` [PATCH v2] " David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).