public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <jens.axboe@oracle.com>
To: Chris Mason <chris.mason@oracle.com>
Cc: Sven Wegener <sven.wegener@stealer.net>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] Add compability for kernels >=2.6.27-rc1
Date: Wed, 30 Jul 2008 22:13:33 +0200	[thread overview]
Message-ID: <20080730201333.GR20055@kernel.dk> (raw)
In-Reply-To: <1217448700.20239.30.camel@think.oraclecorp.com>

On Wed, Jul 30 2008, Chris Mason wrote:
> On Wed, 2008-07-30 at 21:56 +0200, Jens Axboe wrote:
> > On Wed, Jul 30 2008, Sven Wegener wrote:
> > > Add a couple of #if's to follow API changes.
> > > 
> > > Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
> > > ---
> > >  extent_io.c |   16 ++++++++++++++++
> > >  file.c      |    4 ++++
> > >  inode.c     |   12 ++++++++++--
> > >  3 files changed, 30 insertions(+), 2 deletions(-)
> > > 
> > > Having passed the rc1 mark the API changes should be finished.
> > > 
> > > Other #if in the source use >version instead of >=version+1, so I use them 
> > > too.
> > > 
> > > Patch is against the current unstable repository, but can applied with a 
> > > slight modification (extent_io.c) to the stable repository too.
> > > 
> > > diff -r 59ec68fb1540 extent_io.c
> > > --- a/extent_io.c	Wed Jul 30 10:29:12 2008 -0400
> > > +++ b/extent_io.c	Wed Jul 30 19:00:28 2008 +0000
> > > @@ -2649,9 +2649,17 @@
> > >  	mapping = eb->first_page->mapping;
> > >  	if (!mapping)
> > >  		return NULL;
> > > +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,26)
> > > +	spin_lock_irq(&mapping->tree_lock);
> > > +#else
> > >  	read_lock_irq(&mapping->tree_lock);
> > > +#endif
> > >  	p = radix_tree_lookup(&mapping->page_tree, i);
> > > +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,26)
> > > +	spin_unlock_irq(&mapping->tree_lock);
> > > +#else
> > >  	read_unlock_irq(&mapping->tree_lock);
> > > +#endif
> > >  	return p;
> > >  }
> > 
> > For btrfs's usage, it should be safe with a simple rcu_read_lock(), if
> > the return is referenced safely.
> > 
> 
> This btrfs code is basically a find_get_page without the get.  It should
> only be called when I know I already have a reference on the page.

Then it's definitely safe ;-)

-- 
Jens Axboe


  reply	other threads:[~2008-07-30 20:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-30 19:11 [PATCH] Add compability for kernels >=2.6.27-rc1 Sven Wegener
2008-07-30 19:56 ` Jens Axboe
2008-07-30 20:11   ` Chris Mason
2008-07-30 20:13     ` Jens Axboe [this message]
2008-07-30 20:43       ` Chris Mason
2008-07-31 19:27         ` David Woodhouse
2008-07-31 19:37           ` Chris Mason
2008-07-31 19:52             ` David Woodhouse
2008-08-19 14:51             ` David Woodhouse
2008-08-19 16:30               ` Chris Mason

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=20080730201333.GR20055@kernel.dk \
    --to=jens.axboe@oracle.com \
    --cc=chris.mason@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=sven.wegener@stealer.net \
    /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