* [PATCH] xfs: remove unneeded ASSERT from xfs_itruncate_extents
@ 2013-01-28 14:04 Carlos Maiolino
2013-01-28 14:14 ` Mark Tinguely
2013-01-29 3:31 ` Dave Chinner
0 siblings, 2 replies; 4+ messages in thread
From: Carlos Maiolino @ 2013-01-28 14:04 UTC (permalink / raw)
To: xfs
There is no reason to ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); twice, so,
remove one of these ASSERT calls
Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
---
fs/xfs/xfs_inode.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 66282dc..25226ea 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -1396,8 +1396,7 @@ xfs_itruncate_extents(
int done = 0;
ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
- ASSERT(!atomic_read(&VFS_I(ip)->i_count) ||
- xfs_isilocked(ip, XFS_IOLOCK_EXCL));
+ ASSERT(!atomic_read(&VFS_I(ip)->i_count));
ASSERT(new_size <= XFS_ISIZE(ip));
ASSERT(tp->t_flags & XFS_TRANS_PERM_LOG_RES);
ASSERT(ip->i_itemp != NULL);
--
1.8.1
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] xfs: remove unneeded ASSERT from xfs_itruncate_extents
2013-01-28 14:04 [PATCH] xfs: remove unneeded ASSERT from xfs_itruncate_extents Carlos Maiolino
@ 2013-01-28 14:14 ` Mark Tinguely
2013-01-28 16:26 ` Carlos Maiolino
2013-01-29 3:31 ` Dave Chinner
1 sibling, 1 reply; 4+ messages in thread
From: Mark Tinguely @ 2013-01-28 14:14 UTC (permalink / raw)
To: Carlos Maiolino; +Cc: xfs
On 01/28/13 08:04, Carlos Maiolino wrote:
> There is no reason to ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); twice, so,
> remove one of these ASSERT calls
>
> Signed-off-by: Carlos Maiolino<cmaiolino@redhat.com>
> ---
> fs/xfs/xfs_inode.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
> index 66282dc..25226ea 100644
> --- a/fs/xfs/xfs_inode.c
> +++ b/fs/xfs/xfs_inode.c
> @@ -1396,8 +1396,7 @@ xfs_itruncate_extents(
> int done = 0;
>
> ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
> - ASSERT(!atomic_read(&VFS_I(ip)->i_count) ||
> - xfs_isilocked(ip, XFS_IOLOCK_EXCL));
> + ASSERT(!atomic_read(&VFS_I(ip)->i_count));
> ASSERT(new_size<= XFS_ISIZE(ip));
> ASSERT(tp->t_flags& XFS_TRANS_PERM_LOG_RES);
> ASSERT(ip->i_itemp != NULL);
You removed an XFS_IOLOCK_EXCL assert not a duplicate
XFS_ILOCK_EXCL assert. It maybe more obvious if the
first assert read:
ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL) ||
xfs_isilocked(ip, XFS_IOLOCK_EXCL));
ASSERT(!atomic_read(&VFS_I(ip)->i_count));
...
--Mark Tinguely.
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] xfs: remove unneeded ASSERT from xfs_itruncate_extents
2013-01-28 14:14 ` Mark Tinguely
@ 2013-01-28 16:26 ` Carlos Maiolino
0 siblings, 0 replies; 4+ messages in thread
From: Carlos Maiolino @ 2013-01-28 16:26 UTC (permalink / raw)
To: Mark Tinguely; +Cc: xfs
Meh, you're right, cheated by my eyes.
but the suggestion looks nice to avoid another ones to fall in the same mistake,
will send a change to it, thanks Mark
On Mon, Jan 28, 2013 at 08:14:12AM -0600, Mark Tinguely wrote:
> On 01/28/13 08:04, Carlos Maiolino wrote:
> >There is no reason to ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); twice, so,
> >remove one of these ASSERT calls
> >
> >Signed-off-by: Carlos Maiolino<cmaiolino@redhat.com>
> >---
> > fs/xfs/xfs_inode.c | 3 +--
> > 1 file changed, 1 insertion(+), 2 deletions(-)
> >
> >diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
> >index 66282dc..25226ea 100644
> >--- a/fs/xfs/xfs_inode.c
> >+++ b/fs/xfs/xfs_inode.c
> >@@ -1396,8 +1396,7 @@ xfs_itruncate_extents(
> > int done = 0;
> >
> > ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
> >- ASSERT(!atomic_read(&VFS_I(ip)->i_count) ||
> >- xfs_isilocked(ip, XFS_IOLOCK_EXCL));
> >+ ASSERT(!atomic_read(&VFS_I(ip)->i_count));
> > ASSERT(new_size<= XFS_ISIZE(ip));
> > ASSERT(tp->t_flags& XFS_TRANS_PERM_LOG_RES);
> > ASSERT(ip->i_itemp != NULL);
>
> You removed an XFS_IOLOCK_EXCL assert not a duplicate
> XFS_ILOCK_EXCL assert. It maybe more obvious if the
> first assert read:
>
> ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL) ||
> xfs_isilocked(ip, XFS_IOLOCK_EXCL));
> ASSERT(!atomic_read(&VFS_I(ip)->i_count));
> ...
>
> --Mark Tinguely.
--
Carlos
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] xfs: remove unneeded ASSERT from xfs_itruncate_extents
2013-01-28 14:04 [PATCH] xfs: remove unneeded ASSERT from xfs_itruncate_extents Carlos Maiolino
2013-01-28 14:14 ` Mark Tinguely
@ 2013-01-29 3:31 ` Dave Chinner
1 sibling, 0 replies; 4+ messages in thread
From: Dave Chinner @ 2013-01-29 3:31 UTC (permalink / raw)
To: Carlos Maiolino; +Cc: xfs
On Mon, Jan 28, 2013 at 09:04:30AM -0500, Carlos Maiolino wrote:
> There is no reason to ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); twice, so,
> remove one of these ASSERT calls
Second assert is for the IOLOCK, not the ILOCK....
> Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
> ---
> fs/xfs/xfs_inode.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
> index 66282dc..25226ea 100644
> --- a/fs/xfs/xfs_inode.c
> +++ b/fs/xfs/xfs_inode.c
> @@ -1396,8 +1396,7 @@ xfs_itruncate_extents(
> int done = 0;
>
> ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
> - ASSERT(!atomic_read(&VFS_I(ip)->i_count) ||
> - xfs_isilocked(ip, XFS_IOLOCK_EXCL));
> + ASSERT(!atomic_read(&VFS_I(ip)->i_count));
The code is correct. The ASSERT is testing the locking constraints on
the XFS_IOLOCK_EXCL. That is, if xfs_itruncate_extents() is called
in the VFS inode reclaim path (i.e. via xfs_inactive()), the IO lock
is not used (throws lockdep warnings). Hence the ASSERT is checking
that if we hold an inode reference, we are also holding the IO lock.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-01-29 3:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-28 14:04 [PATCH] xfs: remove unneeded ASSERT from xfs_itruncate_extents Carlos Maiolino
2013-01-28 14:14 ` Mark Tinguely
2013-01-28 16:26 ` Carlos Maiolino
2013-01-29 3:31 ` Dave Chinner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox