* [PATCH] libxfs: don't return cnt as failure from XFS_BUF_SET_PTR
@ 2018-02-22 21:33 Eric Sandeen
2018-02-22 21:46 ` Darrick J. Wong
0 siblings, 1 reply; 5+ messages in thread
From: Eric Sandeen @ 2018-02-22 21:33 UTC (permalink / raw)
To: linux-xfs
We must not get here very often, because any test of an error
from XFS_BUF_SET_PTR will fail because it returns whatever
is sent in as cnt. Fix the macro to return 0 so that
"error = XFS_BUF_SET_PTR()" works as expected.
Should probably make this xfs_buf_associate_memory() to be
more like kernelspace, but for now just fix up the bug.
Found this via xfs_logprint failing for no good reason.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
diff --git a/libxfs/libxfs_io.h b/libxfs/libxfs_io.h
index 81d2804..0ae7a28 100644
--- a/libxfs/libxfs_io.h
+++ b/libxfs/libxfs_io.h
@@ -105,6 +105,7 @@ enum xfs_buf_flags_t { /* b_flags bits */
#define XFS_BUF_SET_PTR(bp,p,cnt) ({ \
(bp)->b_addr = (char *)(p); \
XFS_BUF_SET_COUNT(bp,cnt); \
+ 0; \
})
#define XFS_BUF_SET_ADDR(bp,blk) ((bp)->b_bn = (blk))
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] libxfs: don't return cnt as failure from XFS_BUF_SET_PTR
2018-02-22 21:33 [PATCH] libxfs: don't return cnt as failure from XFS_BUF_SET_PTR Eric Sandeen
@ 2018-02-22 21:46 ` Darrick J. Wong
2018-02-22 22:41 ` Eric Sandeen
0 siblings, 1 reply; 5+ messages in thread
From: Darrick J. Wong @ 2018-02-22 21:46 UTC (permalink / raw)
To: Eric Sandeen; +Cc: linux-xfs
On Thu, Feb 22, 2018 at 03:33:04PM -0600, Eric Sandeen wrote:
> We must not get here very often, because any test of an error
> from XFS_BUF_SET_PTR will fail because it returns whatever
> is sent in as cnt. Fix the macro to return 0 so that
> "error = XFS_BUF_SET_PTR()" works as expected.
>
> Should probably make this xfs_buf_associate_memory() to be
> more like kernelspace, but for now just fix up the bug.
>
> Found this via xfs_logprint failing for no good reason.
>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
>
> diff --git a/libxfs/libxfs_io.h b/libxfs/libxfs_io.h
> index 81d2804..0ae7a28 100644
> --- a/libxfs/libxfs_io.h
> +++ b/libxfs/libxfs_io.h
> @@ -105,6 +105,7 @@ enum xfs_buf_flags_t { /* b_flags bits */
> #define XFS_BUF_SET_PTR(bp,p,cnt) ({ \
> (bp)->b_addr = (char *)(p); \
> XFS_BUF_SET_COUNT(bp,cnt); \
> + 0; \
There are only two callers of this macro and it's not exported to
xfslibs headers, so why not just fix them not to care about the return
value?
--D
> })
>
> #define XFS_BUF_SET_ADDR(bp,blk) ((bp)->b_bn = (blk))
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] libxfs: don't return cnt as failure from XFS_BUF_SET_PTR
2018-02-22 21:46 ` Darrick J. Wong
@ 2018-02-22 22:41 ` Eric Sandeen
2018-02-22 23:02 ` Darrick J. Wong
0 siblings, 1 reply; 5+ messages in thread
From: Eric Sandeen @ 2018-02-22 22:41 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: linux-xfs
On 2/22/18 3:46 PM, Darrick J. Wong wrote:
> On Thu, Feb 22, 2018 at 03:33:04PM -0600, Eric Sandeen wrote:
>> We must not get here very often, because any test of an error
>> from XFS_BUF_SET_PTR will fail because it returns whatever
>> is sent in as cnt. Fix the macro to return 0 so that
>> "error = XFS_BUF_SET_PTR()" works as expected.
>>
>> Should probably make this xfs_buf_associate_memory() to be
>> more like kernelspace, but for now just fix up the bug.
>>
>> Found this via xfs_logprint failing for no good reason.
>>
>> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
>> ---
>>
>> diff --git a/libxfs/libxfs_io.h b/libxfs/libxfs_io.h
>> index 81d2804..0ae7a28 100644
>> --- a/libxfs/libxfs_io.h
>> +++ b/libxfs/libxfs_io.h
>> @@ -105,6 +105,7 @@ enum xfs_buf_flags_t { /* b_flags bits */
>> #define XFS_BUF_SET_PTR(bp,p,cnt) ({ \
>> (bp)->b_addr = (char *)(p); \
>> XFS_BUF_SET_COUNT(bp,cnt); \
>> + 0; \
>
> There are only two callers of this macro and it's not exported to
> xfslibs headers, so why not just fix them not to care about the return
> value?
because it marginally matches kernel code ... *shrug* I'd rather
have libxlog diverge less from kernel, not more, overall.
-Eric
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] libxfs: don't return cnt as failure from XFS_BUF_SET_PTR
2018-02-22 22:41 ` Eric Sandeen
@ 2018-02-22 23:02 ` Darrick J. Wong
2018-02-22 23:10 ` Eric Sandeen
0 siblings, 1 reply; 5+ messages in thread
From: Darrick J. Wong @ 2018-02-22 23:02 UTC (permalink / raw)
To: Eric Sandeen; +Cc: linux-xfs
On Thu, Feb 22, 2018 at 04:41:17PM -0600, Eric Sandeen wrote:
> On 2/22/18 3:46 PM, Darrick J. Wong wrote:
> > On Thu, Feb 22, 2018 at 03:33:04PM -0600, Eric Sandeen wrote:
> >> We must not get here very often, because any test of an error
> >> from XFS_BUF_SET_PTR will fail because it returns whatever
> >> is sent in as cnt. Fix the macro to return 0 so that
> >> "error = XFS_BUF_SET_PTR()" works as expected.
> >>
> >> Should probably make this xfs_buf_associate_memory() to be
> >> more like kernelspace, but for now just fix up the bug.
> >>
> >> Found this via xfs_logprint failing for no good reason.
> >>
> >> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> >> ---
> >>
> >> diff --git a/libxfs/libxfs_io.h b/libxfs/libxfs_io.h
> >> index 81d2804..0ae7a28 100644
> >> --- a/libxfs/libxfs_io.h
> >> +++ b/libxfs/libxfs_io.h
> >> @@ -105,6 +105,7 @@ enum xfs_buf_flags_t { /* b_flags bits */
> >> #define XFS_BUF_SET_PTR(bp,p,cnt) ({ \
> >> (bp)->b_addr = (char *)(p); \
> >> XFS_BUF_SET_COUNT(bp,cnt); \
> >> + 0; \
> >
> > There are only two callers of this macro and it's not exported to
> > xfslibs headers, so why not just fix them not to care about the return
> > value?
>
> because it marginally matches kernel code ... *shrug* I'd rather
> have libxlog diverge less from kernel, not more, overall.
Uhh... well in that case, I think you should rename XFS_BUF_SET_PTR
with xfs_buf_associate_memory (the helper function that
xlog_bread_offset uses in the kernel).
--D
>
> -Eric
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] libxfs: don't return cnt as failure from XFS_BUF_SET_PTR
2018-02-22 23:02 ` Darrick J. Wong
@ 2018-02-22 23:10 ` Eric Sandeen
0 siblings, 0 replies; 5+ messages in thread
From: Eric Sandeen @ 2018-02-22 23:10 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: linux-xfs
On 2/22/18 5:02 PM, Darrick J. Wong wrote:
> On Thu, Feb 22, 2018 at 04:41:17PM -0600, Eric Sandeen wrote:
>> On 2/22/18 3:46 PM, Darrick J. Wong wrote:
>>> On Thu, Feb 22, 2018 at 03:33:04PM -0600, Eric Sandeen wrote:
>>>> We must not get here very often, because any test of an error
>>>> from XFS_BUF_SET_PTR will fail because it returns whatever
>>>> is sent in as cnt. Fix the macro to return 0 so that
>>>> "error = XFS_BUF_SET_PTR()" works as expected.
>>>>
>>>> Should probably make this xfs_buf_associate_memory() to be
>>>> more like kernelspace, but for now just fix up the bug.
>>>>
>>>> Found this via xfs_logprint failing for no good reason.
>>>>
>>>> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
>>>> ---
>>>>
>>>> diff --git a/libxfs/libxfs_io.h b/libxfs/libxfs_io.h
>>>> index 81d2804..0ae7a28 100644
>>>> --- a/libxfs/libxfs_io.h
>>>> +++ b/libxfs/libxfs_io.h
>>>> @@ -105,6 +105,7 @@ enum xfs_buf_flags_t { /* b_flags bits */
>>>> #define XFS_BUF_SET_PTR(bp,p,cnt) ({ \
>>>> (bp)->b_addr = (char *)(p); \
>>>> XFS_BUF_SET_COUNT(bp,cnt); \
>>>> + 0; \
>>>
>>> There are only two callers of this macro and it's not exported to
>>> xfslibs headers, so why not just fix them not to care about the return
>>> value?
>>
>> because it marginally matches kernel code ... *shrug* I'd rather
>> have libxlog diverge less from kernel, not more, overall.
>
> Uhh... well in that case, I think you should rename XFS_BUF_SET_PTR
> with xfs_buf_associate_memory (the helper function that
> xlog_bread_offset uses in the kernel).
"Should probably make this xfs_buf_associate_memory() to be
more like kernelspace, but for now just fix up the bug."
But sure, I can send a 2nd patch to do that.
-Eric
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-02-22 23:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-22 21:33 [PATCH] libxfs: don't return cnt as failure from XFS_BUF_SET_PTR Eric Sandeen
2018-02-22 21:46 ` Darrick J. Wong
2018-02-22 22:41 ` Eric Sandeen
2018-02-22 23:02 ` Darrick J. Wong
2018-02-22 23:10 ` Eric Sandeen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.