2002-08-05 20:38:07

by Adam J. Richter

[permalink] [raw]
Subject: Patch: linux-2.5.30/fs/ntfs BUG_ON(cond1 || cond2) bugs(!) and clean ups

The following patch replaces all BUG_ON(condition1 || condition2)
statements in fs/ntfs with separate BUG_ON statements, usually like so:

BUG_ON(condition1);
BUG_ON(condition2);

This provides more information if the BUG_ON statement is every
tripped.

In addition, the fs/ntfs code had some
BUG_ON(...atomic_dec_and_test(...)) statements. BUG_ON conditions should
not have side effects, because you are supposed to be able to compile out
BUG_ON statements to have the code run faster (which is an important
guarantee for encouraging developers to write BUG_ON statements). I
have translated the offending cases to statements of the following form:

if(...atomic_dec_and_test(...))
BUG();

I have attached the patch below. I would like to get these
changes into Linus's 2.5 tree. Please let me know if you want to take
it from here, if you want me to submit this patch to Linus or if you
want me to do something else. Thanks for your time, and for maintaining
the NT file system on Linux.

--
Adam J. Richter __ ______________ 575 Oroville Road
[email protected] \ / Milpitas, California 95035
+1 408 309-6081 | g g d r a s i l United States of America
"Free Software For The Rest Of Us."


Attachments:
(No filename) (1.24 kB)
ntfs.diff (3.84 kB)
Download all attachments

2002-08-05 21:05:47

by Anton Altaparmakov

[permalink] [raw]
Subject: Re: [Linux-NTFS-Dev] Patch: linux-2.5.30/fs/ntfs BUG_ON(cond1 || cond2) bugs(!) and clean ups

At 21:41 05/08/02, Adam J. Richter wrote:
> The following patch replaces all BUG_ON(condition1 || condition2)
>statements in fs/ntfs with separate BUG_ON statements, usually like so:
[snip]
> I have attached the patch below. I would like to get these
>changes into Linus's 2.5 tree. Please let me know if you want to take
>it from here, if you want me to submit this patch to Linus or if you
>want me to do something else.

Thanks for the patch. Patch accepted and committed to my tree. It will be
submitted with the next ntfs point release. I don't feel like this is
enough for a release so I will wait to gather some more things before
submitting so it may be a week or two, hope you don't mind the delay... If
nothing comes up, I will just submit it on its own.

Note almost none of it applied because it was against 2.5.30 vanilla and
ntfs has evolved two point releases since then and in fact some of your
deltas were already there because mft_count has been eliminated. (-: But I
did the changes by hand so no worries...

>Thanks for your time, and for maintaining the NT file system on Linux.

You are welcome. Thanks for your contribution. (-:

Best regards,

Anton


--
"I've not lost my mind. It's backed up on tape somewhere." - Unknown
--
Anton Altaparmakov <aia21 at cantab.net> (replace at with @)
Linux NTFS Maintainer / IRC: #ntfs on irc.openprojects.net
WWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/