From: Andrew Morton <akpm@linux-foundation.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] Re: [PATCH 01/24] GFS2: Support for FIEMAP ioctl
Date: Thu, 18 Dec 2008 11:04:14 -0800 [thread overview]
Message-ID: <20081218110414.ac421e1b.akpm@linux-foundation.org> (raw)
In-Reply-To: <1229596144.3538.1.camel@localhost.localdomain>
On Thu, 18 Dec 2008 10:29:04 +0000
Steven Whitehouse <swhiteho@redhat.com> wrote:
> Hi,
>
> On Wed, 2008-12-17 at 17:22 -0800, Andrew Morton wrote:
> > On Wed, 17 Dec 2008 11:30:00 +0000
> > swhiteho at redhat.com wrote:
> >
> > > +static int gfs2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
> > > + u64 start, u64 len)
> > > +{
> > > + struct gfs2_inode *ip = GFS2_I(inode);
> > > + struct gfs2_holder gh;
> > > + int ret;
> > > +
> > > + ret = fiemap_check_flags(fieinfo, FIEMAP_FLAG_SYNC);
> > > + if (ret)
> > > + return ret;
> > > +
> > > + mutex_lock(&inode->i_mutex);
> > > +
> > > + ret = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, 0, &gh);
> > > + if (ret)
> > > + goto out;
> > > +
> > > + if (gfs2_is_stuffed(ip)) {
> > > + u64 phys = ip->i_no_addr << inode->i_blkbits;
> > > + u64 size = i_size_read(inode);
> >
> > It's actually safe to directly access i_size inside i_mutex. Although
> > not terribly maintainable.
> >
> >
> I did wonder about that at the time, but I'm not quite sure if you are
> suggesting that I should change this now, or leave it as it is?
No strong opinion, really. If it's a performance-sensitive path (it
isn't) then bypassing i_size_read() might be advantageous. Leaving the
i_size_read() there provides some future-safety and sets a good
example.
It would be an easier decision if the SMP, 32-bit version of
i_size_read() wasn't inlined, and tremendously huge :(
WARNING: multiple messages have this Message-ID (diff)
From: Andrew Morton <akpm@linux-foundation.org>
To: Steven Whitehouse <swhiteho@redhat.com>
Cc: linux-kernel@vger.kernel.org, cluster-devel@redhat.com,
tytso@mit.edu, sandeen@redhat.com
Subject: Re: [PATCH 01/24] GFS2: Support for FIEMAP ioctl
Date: Thu, 18 Dec 2008 11:04:14 -0800 [thread overview]
Message-ID: <20081218110414.ac421e1b.akpm@linux-foundation.org> (raw)
In-Reply-To: <1229596144.3538.1.camel@localhost.localdomain>
On Thu, 18 Dec 2008 10:29:04 +0000
Steven Whitehouse <swhiteho@redhat.com> wrote:
> Hi,
>
> On Wed, 2008-12-17 at 17:22 -0800, Andrew Morton wrote:
> > On Wed, 17 Dec 2008 11:30:00 +0000
> > swhiteho@redhat.com wrote:
> >
> > > +static int gfs2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
> > > + u64 start, u64 len)
> > > +{
> > > + struct gfs2_inode *ip = GFS2_I(inode);
> > > + struct gfs2_holder gh;
> > > + int ret;
> > > +
> > > + ret = fiemap_check_flags(fieinfo, FIEMAP_FLAG_SYNC);
> > > + if (ret)
> > > + return ret;
> > > +
> > > + mutex_lock(&inode->i_mutex);
> > > +
> > > + ret = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, 0, &gh);
> > > + if (ret)
> > > + goto out;
> > > +
> > > + if (gfs2_is_stuffed(ip)) {
> > > + u64 phys = ip->i_no_addr << inode->i_blkbits;
> > > + u64 size = i_size_read(inode);
> >
> > It's actually safe to directly access i_size inside i_mutex. Although
> > not terribly maintainable.
> >
> >
> I did wonder about that at the time, but I'm not quite sure if you are
> suggesting that I should change this now, or leave it as it is?
No strong opinion, really. If it's a performance-sensitive path (it
isn't) then bypassing i_size_read() might be advantageous. Leaving the
i_size_read() there provides some future-safety and sets a good
example.
It would be an easier decision if the SMP, 32-bit version of
i_size_read() wasn't inlined, and tremendously huge :(
next prev parent reply other threads:[~2008-12-18 19:04 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-17 11:29 [Cluster-devel] GFS2: Pre-pull patch posting swhiteho
2008-12-17 11:29 ` swhiteho
2008-12-17 11:30 ` [Cluster-devel] [PATCH 01/24] GFS2: Support for FIEMAP ioctl swhiteho
2008-12-17 11:30 ` swhiteho
2008-12-17 11:30 ` [Cluster-devel] [PATCH 02/24] GFS2: Rationalise header files swhiteho
2008-12-17 11:30 ` swhiteho
2008-12-17 11:30 ` [Cluster-devel] [PATCH 03/24] GFS2: Fix up jdata writepage/delete_inode swhiteho
2008-12-17 11:30 ` swhiteho
2008-12-17 11:30 ` [Cluster-devel] [PATCH 04/24] GFS2: sparse annotation of gl->gl_spin swhiteho
2008-12-17 11:30 ` swhiteho
2008-12-17 11:30 ` [Cluster-devel] [PATCH 05/24] GFS2: Move generation number into "proper" part of inode swhiteho
2008-12-17 11:30 ` swhiteho
2008-12-17 11:30 ` [Cluster-devel] [PATCH 06/24] GFS2: Move "entries" into "proper" inode swhiteho
2008-12-17 11:30 ` swhiteho
2008-12-17 11:30 ` [Cluster-devel] [PATCH 07/24] GFS2: Move di_eattr " swhiteho
2008-12-17 11:30 ` swhiteho
2008-12-17 11:30 ` [Cluster-devel] [PATCH 08/24] GFS2: Move i_size from gfs2_dinode_host and rename it to i_disksize swhiteho
2008-12-17 11:30 ` swhiteho
2008-12-17 11:30 ` [Cluster-devel] [PATCH 09/24] GFS2: Banish struct gfs2_dinode_host swhiteho
2008-12-17 11:30 ` swhiteho
2008-12-17 11:30 ` [Cluster-devel] [PATCH 10/24] GFS2: Move rg_igeneration into struct gfs2_rgrpd swhiteho
2008-12-17 11:30 ` swhiteho
2008-12-17 11:30 ` [Cluster-devel] [PATCH 11/24] GFS2: Move rg_free from gfs2_rgrpd_host to gfs2_rgrpd swhiteho
2008-12-17 11:30 ` swhiteho
2008-12-17 11:30 ` [Cluster-devel] [PATCH 12/24] GFS2: Banish struct gfs2_rgrpd_host swhiteho
2008-12-17 11:30 ` swhiteho
2008-12-17 11:30 ` [Cluster-devel] [PATCH 13/24] GFS2: Add more detail to debugfs glock dumps swhiteho
2008-12-17 11:30 ` swhiteho
2008-12-17 11:30 ` [Cluster-devel] [PATCH 14/24] GFS2: Clean up & move gfs2_quotad swhiteho
2008-12-17 11:30 ` swhiteho
2008-12-17 11:30 ` [Cluster-devel] [PATCH 15/24] GFS2: Fix "truncate in progress" hang swhiteho
2008-12-17 11:30 ` swhiteho
2008-12-17 11:30 ` [Cluster-devel] [PATCH 16/24] GFS2: Move gfs2_recoverd into recovery.c swhiteho
2008-12-17 11:30 ` swhiteho
2008-12-17 11:30 ` [Cluster-devel] [PATCH 17/24] GFS2: Kill two daemons with one patch swhiteho
2008-12-17 11:30 ` swhiteho
2008-12-17 11:30 ` [Cluster-devel] [PATCH 18/24] GFS2: Send some sensible sysfs stuff swhiteho
2008-12-17 11:30 ` swhiteho
2008-12-17 11:30 ` [Cluster-devel] [PATCH 19/24] GFS2: Fix bug in gfs2_lock_fs_check_clean() swhiteho
2008-12-17 11:30 ` swhiteho
2008-12-17 11:30 ` [Cluster-devel] [PATCH 20/24] GFS2: Move four functions from super.c swhiteho
2008-12-17 11:30 ` swhiteho
2008-12-17 11:30 ` [Cluster-devel] [PATCH 21/24] GFS2: Remove ancient, unused code swhiteho
2008-12-17 11:30 ` swhiteho
2008-12-17 11:30 ` [Cluster-devel] [PATCH 22/24] GFS2: Fix use-after-free bug on umount swhiteho
2008-12-17 11:30 ` swhiteho
2008-12-17 11:30 ` [Cluster-devel] [PATCH 23/24] GFS2: Send useful information with uevent messages swhiteho
2008-12-17 11:30 ` swhiteho
2008-12-17 11:30 ` [Cluster-devel] [PATCH 24/24] GFS2: Streamline alloc calculations for writes swhiteho
2008-12-17 11:30 ` swhiteho
2008-12-18 1:22 ` [Cluster-devel] Re: [PATCH 01/24] GFS2: Support for FIEMAP ioctl Andrew Morton
2008-12-18 1:22 ` Andrew Morton
2008-12-18 10:29 ` [Cluster-devel] " Steven Whitehouse
2008-12-18 10:29 ` Steven Whitehouse
2008-12-18 19:04 ` Andrew Morton [this message]
2008-12-18 19:04 ` Andrew Morton
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=20081218110414.ac421e1b.akpm@linux-foundation.org \
--to=akpm@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.