mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Anton Altaparmakov <aia21@cantab.net>
To: Andrew Morton <akpm@zip.com.au>
Cc: Linus Torvalds <torvalds@transmeta.com>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: [patch 13/13] lseek speedup
Date: Wed, 17 Jul 2002 19:07:24 +0100	[thread overview]
Message-ID: <5.1.0.14.2.20020717185356.00ae4ec0@pop.cus.cam.ac.uk> (raw)
In-Reply-To: <3D35A024.1635E12E@zip.com.au>

At 17:49 17/07/02, Andrew Morton wrote:
>Anton Altaparmakov wrote:
> >
> > >  Now, why are we taking i_sem for lseek/readdir
> > >exclusion and not a per-file lock?
> >
> > Because it also excludes against directory modifications, etc. Just imagine
> > what "rm somefile" or "mv somefile otherfile" or "touch newfile" would do
> > to the directory contents and what a concurrent readdir() would do... A
> > very loud *BANG* is the only thing that springs to mind...
>
>That's different.  i_size, contents of things, yes - i_sem for
>those.
>
>But protection of struct file should not be via any per-inode thing.

Oh, I see. But that would mean adding yet another lock to an existing 
locking scheme? So both i_sem and the "per file lock" would nead to be held 
over readdir(). That's doable but it would have to be a semaphore based 
lock due to readdir()...

Perhaps the f_lock from your patch, changed to a semaphore, and acquiring 
it in generic_file_llseek&friends, vfs_readdir() (and any other place where 
f_pos needs protecting) would be able to do the trick. Would that solve the 
lock contention problems you were seing? It would at least off-load i_sem a 
bit... but it would only replace one semaphore for another...

> > btw. the directory modification locking rules are written up in
> > Documentation/filesystems/directory-locking by our very own VFS maintainer
> > Al Viro himself... (-;
>
>Doesn't cover lseek...

Hm, true. I hadn't read it for quite a while...

         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/


  reply	other threads:[~2002-07-17 18:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-17  5:31 Andrew Morton
2002-07-17  9:45 ` Anton Altaparmakov
2002-07-17 16:18   ` Andrew Morton
2002-07-17 16:20     ` Anton Altaparmakov
2002-07-17 16:49       ` Andrew Morton
2002-07-17 18:07         ` Anton Altaparmakov [this message]
2002-07-22  7:16           ` Andrew Morton
2002-07-22  7:43             ` Anton Altaparmakov
2002-07-17 18:27         ` Benjamin LaHaise
2002-07-17 10:54 ` Anton Altaparmakov

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=5.1.0.14.2.20020717185356.00ae4ec0@pop.cus.cam.ac.uk \
    --to=aia21@cantab.net \
    --cc=akpm@zip.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /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®