All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: remove use of do_div with 32-bit dividend in quota debug code
@ 2017-04-15 14:46 Eric Sandeen
  2017-04-17 18:27 ` Bill O'Donnell
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Eric Sandeen @ 2017-04-15 14:46 UTC (permalink / raw)
  To: linux-xfs

The kbuild test robot caught this; in debug code we have another
caller of do_div with a 32-bit dividend (j) which is caught now
that we are using the kernel-supplied do_div.

None of the values used here are 64-bit; just use simple division.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
index b669b12..dedeb7f 100644
--- a/fs/xfs/xfs_qm.c
+++ b/fs/xfs/xfs_qm.c
@@ -851,8 +851,7 @@ struct xfs_qm_isolate {
 	 * started afresh by xfs_qm_quotacheck.
 	 */
 #ifdef DEBUG
-	j = XFS_FSB_TO_B(mp, XFS_DQUOT_CLUSTER_SIZE_FSB);
-	do_div(j, sizeof(xfs_dqblk_t));
+	j = XFS_FSB_TO_B(mp, XFS_DQUOT_CLUSTER_SIZE_FSB) / sizeof(xfs_dqblk_t);
 	ASSERT(mp->m_quotainfo->qi_dqperchunk == j);
 #endif
 	dqb = bp->b_addr;


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

* Re: [PATCH] xfs: remove use of do_div with 32-bit dividend in quota debug code
  2017-04-15 14:46 [PATCH] xfs: remove use of do_div with 32-bit dividend in quota debug code Eric Sandeen
@ 2017-04-17 18:27 ` Bill O'Donnell
  2017-04-17 18:59 ` Darrick J. Wong
  2017-04-19 19:41 ` [PATCH V2] " Eric Sandeen
  2 siblings, 0 replies; 8+ messages in thread
From: Bill O'Donnell @ 2017-04-17 18:27 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: linux-xfs

On Sat, Apr 15, 2017 at 09:46:09AM -0500, Eric Sandeen wrote:
> The kbuild test robot caught this; in debug code we have another
> caller of do_div with a 32-bit dividend (j) which is caught now
> that we are using the kernel-supplied do_div.
> 
> None of the values used here are 64-bit; just use simple division.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Looks good.

Reviewed-by: Bill O'Donnell <billodo@redhat.com>

> ---
> 
> diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
> index b669b12..dedeb7f 100644
> --- a/fs/xfs/xfs_qm.c
> +++ b/fs/xfs/xfs_qm.c
> @@ -851,8 +851,7 @@ struct xfs_qm_isolate {
>  	 * started afresh by xfs_qm_quotacheck.
>  	 */
>  #ifdef DEBUG
> -	j = XFS_FSB_TO_B(mp, XFS_DQUOT_CLUSTER_SIZE_FSB);
> -	do_div(j, sizeof(xfs_dqblk_t));
> +	j = XFS_FSB_TO_B(mp, XFS_DQUOT_CLUSTER_SIZE_FSB) / sizeof(xfs_dqblk_t);
>  	ASSERT(mp->m_quotainfo->qi_dqperchunk == j);
>  #endif
>  	dqb = bp->b_addr;
> 
> --
> 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] 8+ messages in thread

* Re: [PATCH] xfs: remove use of do_div with 32-bit dividend in quota debug code
  2017-04-15 14:46 [PATCH] xfs: remove use of do_div with 32-bit dividend in quota debug code Eric Sandeen
  2017-04-17 18:27 ` Bill O'Donnell
@ 2017-04-17 18:59 ` Darrick J. Wong
  2017-04-19 19:29   ` Eric Sandeen
  2017-04-19 19:41 ` [PATCH V2] " Eric Sandeen
  2 siblings, 1 reply; 8+ messages in thread
From: Darrick J. Wong @ 2017-04-17 18:59 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: linux-xfs

On Sat, Apr 15, 2017 at 09:46:09AM -0500, Eric Sandeen wrote:
> The kbuild test robot caught this; in debug code we have another
> caller of do_div with a 32-bit dividend (j) which is caught now
> that we are using the kernel-supplied do_div.
> 
> None of the values used here are 64-bit; just use simple division.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
> 
> diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
> index b669b12..dedeb7f 100644
> --- a/fs/xfs/xfs_qm.c
> +++ b/fs/xfs/xfs_qm.c
> @@ -851,8 +851,7 @@ struct xfs_qm_isolate {
>  	 * started afresh by xfs_qm_quotacheck.
>  	 */
>  #ifdef DEBUG
> -	j = XFS_FSB_TO_B(mp, XFS_DQUOT_CLUSTER_SIZE_FSB);
> -	do_div(j, sizeof(xfs_dqblk_t));
> +	j = XFS_FSB_TO_B(mp, XFS_DQUOT_CLUSTER_SIZE_FSB) / sizeof(xfs_dqblk_t);

Uh...

#define XFS_FSB_TO_B(mp,fsbno)   ((xfs_fsize_t)(fsbno) << (mp)->m_sb.sb_blocklog)
typedef    __int64_t       xfs_fsize_t;    /* bytes in a file */

So the macro resolves to a 64-bit value, which is then fed directly into
an integer division, which breaks the i386 build with the usual __divdi3
complaint.

--D

>  	ASSERT(mp->m_quotainfo->qi_dqperchunk == j);
>  #endif
>  	dqb = bp->b_addr;
> 
> --
> 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] 8+ messages in thread

* Re: [PATCH] xfs: remove use of do_div with 32-bit dividend in quota debug code
  2017-04-17 18:59 ` Darrick J. Wong
@ 2017-04-19 19:29   ` Eric Sandeen
  0 siblings, 0 replies; 8+ messages in thread
From: Eric Sandeen @ 2017-04-19 19:29 UTC (permalink / raw)
  To: Darrick J. Wong, Eric Sandeen; +Cc: linux-xfs

On 4/17/17 1:59 PM, Darrick J. Wong wrote:
> On Sat, Apr 15, 2017 at 09:46:09AM -0500, Eric Sandeen wrote:
>> The kbuild test robot caught this; in debug code we have another
>> caller of do_div with a 32-bit dividend (j) which is caught now
>> that we are using the kernel-supplied do_div.
>>
>> None of the values used here are 64-bit; just use simple division.
>>
>> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
>> ---
>>
>> diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
>> index b669b12..dedeb7f 100644
>> --- a/fs/xfs/xfs_qm.c
>> +++ b/fs/xfs/xfs_qm.c
>> @@ -851,8 +851,7 @@ struct xfs_qm_isolate {
>>  	 * started afresh by xfs_qm_quotacheck.
>>  	 */
>>  #ifdef DEBUG
>> -	j = XFS_FSB_TO_B(mp, XFS_DQUOT_CLUSTER_SIZE_FSB);
>> -	do_div(j, sizeof(xfs_dqblk_t));
>> +	j = XFS_FSB_TO_B(mp, XFS_DQUOT_CLUSTER_SIZE_FSB) / sizeof(xfs_dqblk_t);
> 
> Uh...
> 
> #define XFS_FSB_TO_B(mp,fsbno)   ((xfs_fsize_t)(fsbno) << (mp)->m_sb.sb_blocklog)
> typedef    __int64_t       xfs_fsize_t;    /* bytes in a file */

Assigned to "int j", riiiiight.  hohum.
 
> So the macro resolves to a 64-bit value, which is then fed directly into
> an integer division, which breaks the i386 build with the usual __divdi3
> complaint.

sandeen--

> --D
> 
>>  	ASSERT(mp->m_quotainfo->qi_dqperchunk == j);
>>  #endif
>>  	dqb = bp->b_addr;
>>
>> --
>> 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
> --
> 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] 8+ messages in thread

* [PATCH V2] xfs: remove use of do_div with 32-bit dividend in quota debug code
  2017-04-15 14:46 [PATCH] xfs: remove use of do_div with 32-bit dividend in quota debug code Eric Sandeen
  2017-04-17 18:27 ` Bill O'Donnell
  2017-04-17 18:59 ` Darrick J. Wong
@ 2017-04-19 19:41 ` Eric Sandeen
  2017-04-19 20:01   ` Darrick J. Wong
                     ` (2 more replies)
  2 siblings, 3 replies; 8+ messages in thread
From: Eric Sandeen @ 2017-04-19 19:41 UTC (permalink / raw)
  To: Eric Sandeen, linux-xfs

The kbuild test robot caught this; in debug code we have another
caller of do_div with a 32-bit dividend (j) which is caught now
that we are using the kernel-supplied do_div.

None of the values used here are 64-bit; just use simple division.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

V2: now with less actual 64-bit division!

diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
index b669b12..6b42db4 100644
--- a/fs/xfs/xfs_qm.c
+++ b/fs/xfs/xfs_qm.c
@@ -851,8 +851,8 @@ struct xfs_qm_isolate {
 	 * started afresh by xfs_qm_quotacheck.
 	 */
 #ifdef DEBUG
-	j = XFS_FSB_TO_B(mp, XFS_DQUOT_CLUSTER_SIZE_FSB);
-	do_div(j, sizeof(xfs_dqblk_t));
+	j = (int)XFS_FSB_TO_B(mp, XFS_DQUOT_CLUSTER_SIZE_FSB) /
+		sizeof(xfs_dqblk_t);
 	ASSERT(mp->m_quotainfo->qi_dqperchunk == j);
 #endif
 	dqb = bp->b_addr;



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

* Re: [PATCH V2] xfs: remove use of do_div with 32-bit dividend in quota debug code
  2017-04-19 19:41 ` [PATCH V2] " Eric Sandeen
@ 2017-04-19 20:01   ` Darrick J. Wong
  2017-04-19 20:21   ` Bill O'Donnell
  2017-04-19 20:23   ` Bill O'Donnell
  2 siblings, 0 replies; 8+ messages in thread
From: Darrick J. Wong @ 2017-04-19 20:01 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: Eric Sandeen, linux-xfs

On Wed, Apr 19, 2017 at 02:41:07PM -0500, Eric Sandeen wrote:
> The kbuild test robot caught this; in debug code we have another
> caller of do_div with a 32-bit dividend (j) which is caught now
> that we are using the kernel-supplied do_div.
> 
> None of the values used here are 64-bit; just use simple division.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Looks ok, will throw it on the testing pile...
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

(Seems to build ok on i386 too.)

--D

> ---
> 
> V2: now with less actual 64-bit division!
> 
> diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
> index b669b12..6b42db4 100644
> --- a/fs/xfs/xfs_qm.c
> +++ b/fs/xfs/xfs_qm.c
> @@ -851,8 +851,8 @@ struct xfs_qm_isolate {
>  	 * started afresh by xfs_qm_quotacheck.
>  	 */
>  #ifdef DEBUG
> -	j = XFS_FSB_TO_B(mp, XFS_DQUOT_CLUSTER_SIZE_FSB);
> -	do_div(j, sizeof(xfs_dqblk_t));
> +	j = (int)XFS_FSB_TO_B(mp, XFS_DQUOT_CLUSTER_SIZE_FSB) /
> +		sizeof(xfs_dqblk_t);
>  	ASSERT(mp->m_quotainfo->qi_dqperchunk == j);
>  #endif
>  	dqb = bp->b_addr;
> 
> 
> --
> 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] 8+ messages in thread

* Re: [PATCH V2] xfs: remove use of do_div with 32-bit dividend in quota debug code
  2017-04-19 19:41 ` [PATCH V2] " Eric Sandeen
  2017-04-19 20:01   ` Darrick J. Wong
@ 2017-04-19 20:21   ` Bill O'Donnell
  2017-04-19 20:23   ` Bill O'Donnell
  2 siblings, 0 replies; 8+ messages in thread
From: Bill O'Donnell @ 2017-04-19 20:21 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: Eric Sandeen, linux-xfs

On Wed, Apr 19, 2017 at 02:41:07PM -0500, Eric Sandeen wrote:
> The kbuild test robot caught this; in debug code we have another
> caller of do_div with a 32-bit dividend (j) which is caught now
> that we are using the kernel-supplied do_div.
> 
> None of the values used here are 64-bit; just use simple division.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

looks even better now ;)

Reviewed-by: Bill O'Donnell

> ---
> 
> V2: now with less actual 64-bit division!
> 
> diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
> index b669b12..6b42db4 100644
> --- a/fs/xfs/xfs_qm.c
> +++ b/fs/xfs/xfs_qm.c
> @@ -851,8 +851,8 @@ struct xfs_qm_isolate {
>  	 * started afresh by xfs_qm_quotacheck.
>  	 */
>  #ifdef DEBUG
> -	j = XFS_FSB_TO_B(mp, XFS_DQUOT_CLUSTER_SIZE_FSB);
> -	do_div(j, sizeof(xfs_dqblk_t));
> +	j = (int)XFS_FSB_TO_B(mp, XFS_DQUOT_CLUSTER_SIZE_FSB) /
> +		sizeof(xfs_dqblk_t);
>  	ASSERT(mp->m_quotainfo->qi_dqperchunk == j);
>  #endif
>  	dqb = bp->b_addr;
> 
> 
> --
> 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] 8+ messages in thread

* Re: [PATCH V2] xfs: remove use of do_div with 32-bit dividend in quota debug code
  2017-04-19 19:41 ` [PATCH V2] " Eric Sandeen
  2017-04-19 20:01   ` Darrick J. Wong
  2017-04-19 20:21   ` Bill O'Donnell
@ 2017-04-19 20:23   ` Bill O'Donnell
  2 siblings, 0 replies; 8+ messages in thread
From: Bill O'Donnell @ 2017-04-19 20:23 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: Eric Sandeen, linux-xfs

On Wed, Apr 19, 2017 at 02:41:07PM -0500, Eric Sandeen wrote:
> The kbuild test robot caught this; in debug code we have another
> caller of do_div with a 32-bit dividend (j) which is caught now
> that we are using the kernel-supplied do_div.
> 
> None of the values used here are 64-bit; just use simple division.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

reviewed again, this time with proper email sig. ;)

Reviewed-by: Bill O'Donnell <billodo@redhat.com>

> ---
> 
> V2: now with less actual 64-bit division!
> 
> diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
> index b669b12..6b42db4 100644
> --- a/fs/xfs/xfs_qm.c
> +++ b/fs/xfs/xfs_qm.c
> @@ -851,8 +851,8 @@ struct xfs_qm_isolate {
>  	 * started afresh by xfs_qm_quotacheck.
>  	 */
>  #ifdef DEBUG
> -	j = XFS_FSB_TO_B(mp, XFS_DQUOT_CLUSTER_SIZE_FSB);
> -	do_div(j, sizeof(xfs_dqblk_t));
> +	j = (int)XFS_FSB_TO_B(mp, XFS_DQUOT_CLUSTER_SIZE_FSB) /
> +		sizeof(xfs_dqblk_t);
>  	ASSERT(mp->m_quotainfo->qi_dqperchunk == j);
>  #endif
>  	dqb = bp->b_addr;
> 
> 
> --
> 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] 8+ messages in thread

end of thread, other threads:[~2017-04-19 20:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-15 14:46 [PATCH] xfs: remove use of do_div with 32-bit dividend in quota debug code Eric Sandeen
2017-04-17 18:27 ` Bill O'Donnell
2017-04-17 18:59 ` Darrick J. Wong
2017-04-19 19:29   ` Eric Sandeen
2017-04-19 19:41 ` [PATCH V2] " Eric Sandeen
2017-04-19 20:01   ` Darrick J. Wong
2017-04-19 20:21   ` Bill O'Donnell
2017-04-19 20:23   ` Bill O'Donnell

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.