mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Erik McKee <camhanaich99@yahoo.com>
To: linux-kernel@vger.kernel.org
Cc: linux-fsdevel@vger.kernel.org
Subject: minixfs question
Date: Sat, 2 Aug 2003 02:48:54 -0700 (PDT)	[thread overview]
Message-ID: <20030802094854.19141.qmail@web14202.mail.yahoo.com> (raw)

Hello!

Let me apologize in advance for any ignorance I might exhibit here.  I am
curious about the following code, from minix_new_inode in fs/minix/bitmap.c. 
The if statement on line 232 checks !bh.  It seems that if bh was null at this
point, then sbi->s_imap_blocks == 0, in which case we fail the other half of
the if.  If bh == NULL in any other case, wouldn't the bh->b_data in the
minix_find_first_zero_bit call be deref. a NULL pointer, which would trigger a
kernel panic or some such terminal event?  Also, why does at least this
filesystem use minix specific version of these bitmap operations?  Isn't there
a generic set of these operations?  In other functions, it seems like these
tests have to be protected by the BKL?  Isn't the point of things like
test_and_set and test_and_clear that they are atomic?  If so, why the need for
the BKL (for example, minix_free_block)?  Also I noticed this these files seem
to have very sparse commenting, would a patch consisting of germane commenting
for this fs be welcome?  Also, would it be beneficial if this fs was converted
to use one or more minixfs specific locks instead of the BKL?

223         j = 8192;
224         bh = NULL;
225         *error = -ENOSPC;
226         lock_kernel();
227         for (i = 0; i < sbi->s_imap_blocks; i++) {
228                 bh = sbi->s_imap[i];
229                 if ((j = minix_find_first_zero_bit(bh->b_data, 8192)) <
8192)
230                         break;
231         }
232         if (!bh || j >= 8192) {
233                 unlock_kernel();
234                 iput(inode);
235                 return NULL;
236         }
237         if (minix_test_and_set_bit(j,bh->b_data)) {     /* shouldn't happen
*/
238                 printk("new_inode: bit already set");
239                 unlock_kernel();
240                 iput(inode);
241                 return NULL;
242         }
243         unlock_kernel();

TIA
Erik McKee
*Who is hoping this fs is a good place to start learning about fs in linux.*
Please cc me in replies, as I am not on list.

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

             reply	other threads:[~2003-08-02  9:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-02  9:48 Erik McKee [this message]
2003-08-02 12:17 ` Andries Brouwer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030802094854.19141.qmail@web14202.mail.yahoo.com \
    --to=camhanaich99@yahoo.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®