2004-01-24 07:32:09

by Bryan Whitehead

[permalink] [raw]
Subject: [PATCH 2.6.2-rc1-mm2] fs/xfs/xfs_log_recover.c


This fixes a warning on compile of the xfs fs module.

--- fs/xfs/xfs_log_recover.c.orig 2004-01-23 23:17:35.402907768 -0800
+++ fs/xfs/xfs_log_recover.c 2004-01-23 23:19:09.368622808 -0800
@@ -1542,21 +1542,14 @@
case XFS_LI_BUF:
flags = buf_f->blf_flags;
break;
case XFS_LI_6_1_BUF:
case XFS_LI_5_3_BUF:
obuf_f = (xfs_buf_log_format_v1_t*)buf_f;
flags = obuf_f->blf_flags;
- break;
- }
-
- switch (ITEM_TYPE(itemq)) {
- case XFS_LI_BUF:
- case XFS_LI_6_1_BUF:
- case XFS_LI_5_3_BUF:
if (!(flags & XFS_BLI_CANCEL)) {
xlog_recover_insert_item_frontq(&trans->r_itemq,
itemq);
break;
}
case XFS_LI_INODE:
case XFS_LI_6_1_INODE:


--
Bryan Whitehead
[email protected]


2004-01-24 08:26:09

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH 2.6.2-rc1-mm2] fs/xfs/xfs_log_recover.c

On Fri, Jan 23, 2004 at 11:31:11PM -0800, Bryan Whitehead wrote:
>
> This fixes a warning on compile of the xfs fs module.

This patch looks very strange. What error do you get without it?

2004-01-25 00:39:17

by Bryan Whitehead

[permalink] [raw]
Subject: Re: [PATCH 2.6.2-rc1-mm2] fs/xfs/xfs_log_recover.c

I should have been more clear in the frist email. Sorry.

The variable "flags" is used in an if statement without having a value
assigned.

There is 2 switch statements that do this: (ITEM_TYPE(itemq) They execute
one right after the other with no returns. So it is redundant.

I think the patch fixes a cut/paste accident...

Here is a more complete diff so you can see what is going on:
--- fs/xfs/xfs_log_recover.c.orig 2004-01-23 23:17:35.402907768
-0800
+++ fs/xfs/xfs_log_recover.c 2004-01-23 23:19:09.368622808 -0800
@@ -1539,27 +1539,20 @@
itemq_next = itemq->ri_next;
buf_f = (xfs_buf_log_format_t *)itemq->ri_buf[0].i_addr;
switch (ITEM_TYPE(itemq)) {
case XFS_LI_BUF:
flags = buf_f->blf_flags;
break;
case XFS_LI_6_1_BUF:
case XFS_LI_5_3_BUF:
obuf_f = (xfs_buf_log_format_v1_t*)buf_f;
flags = obuf_f->blf_flags;
- break;
- }
-
- switch (ITEM_TYPE(itemq)) {
- case XFS_LI_BUF:
- case XFS_LI_6_1_BUF:
- case XFS_LI_5_3_BUF:
if (!(flags & XFS_BLI_CANCEL)) {

xlog_recover_insert_item_frontq(&trans->r_itemq,
itemq);
break;
}
case XFS_LI_INODE:
case XFS_LI_6_1_INODE:
case XFS_LI_5_3_INODE:
case XFS_LI_DQUOT:
case XFS_LI_QUOTAOFF:



On Sat, 24 Jan 2004, Christoph Hellwig wrote:

> On Fri, Jan 23, 2004 at 11:31:11PM -0800, Bryan Whitehead wrote:
> >
> > This fixes a warning on compile of the xfs fs module.
>
> This patch looks very strange. What error do you get without it?
>

--
Bryan Whitehead
Email:[email protected]
WorkE:[email protected]

2004-01-25 00:58:41

by Bryan Whitehead

[permalink] [raw]
Subject: Re: [PATCH 2.6.2-rc1-mm2] fs/xfs/xfs_log_recover.c

Oh, one more thing. After removed the superflurous switch statement flags
will have a value which fixes the warning.

If you look at the flow of code it is impossible for flags to not have a
value when it gets to the if statement as the previous switch statement
would give it a value. But since that switch statement only catches that
one case anyway, it's better to merge the 2 switch statemnets.

On Sat, 24 Jan 2004, Christoph Hellwig wrote:

> On Fri, Jan 23, 2004 at 11:31:11PM -0800, Bryan Whitehead wrote:
> >
> > This fixes a warning on compile of the xfs fs module.
>
> This patch looks very strange. What error do you get without it?
>

--
Bryan Whitehead
Email:[email protected]
WorkE:[email protected]

2004-01-25 01:15:46

by Bryan Whitehead

[permalink] [raw]
Subject: Re: [PATCH 2.6.2-rc1-mm2] fs/xfs/xfs_log_recover.c

If I'm off base on this then sorry for the trouble. Just thought I'd
take a hit at getting rid of some compiler warnings..

Bryan Whitehead wrote:
> Oh, one more thing. After removed the superflurous switch statement flags
> will have a value which fixes the warning.
>
> If you look at the flow of code it is impossible for flags to not have a
> value when it gets to the if statement as the previous switch statement
> would give it a value. But since that switch statement only catches that
> one case anyway, it's better to merge the 2 switch statemnets.
>
> On Sat, 24 Jan 2004, Christoph Hellwig wrote:
>
>
>>On Fri, Jan 23, 2004 at 11:31:11PM -0800, Bryan Whitehead wrote:
>>
>>>This fixes a warning on compile of the xfs fs module.
>>
>>This patch looks very strange. What error do you get without it?
>>
>
>


--
Bryan Whitehead
Email:[email protected]
WorkE:[email protected]