From: Jeff Liu <jeff.liu@oracle.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: "xfs@oss.sgi.com" <xfs@oss.sgi.com>
Subject: Re: [PATCH v2 03/10] xfs: consolidate xfs_inumbers
Date: Sun, 04 May 2014 20:32:45 +0800 [thread overview]
Message-ID: <5366336D.5000401@oracle.com> (raw)
In-Reply-To: <20140423153639.GB3326@infradead.org>
Hi Christoph,
Sorry for my too late response! I missed your response somehow.
On 04/23 2014 23:36 PM, Christoph Hellwig wrote:
> On Fri, Apr 18, 2014 at 08:58:26AM +0800, Jeff Liu wrote:
>> From: Jie Liu <jeff.liu@oracle.com>
>>
>> To fetch the file system number tables, we currently just ignore the
>> errors and proceed to loop over the next AG or bump agino to the next
>> chunk in case of btree operations failed, that is not properly because
>> those errors might hint us potential file system problems.
>>
>> This patch rework xfs_inumbers() to handle the btree operation errors
>> as well as the loop conditions. Also, add pre-checkups for the given
>> inode, we can save alloc/free the format buffer once against an invalid
>> inode number.
>
> The patch looks mostly good to me, but I really think it should be
> split into two patches: one to do the formatting changes and code
> consolidation, and then one that does the actual logic changes for
> better error handling. It's not easy to understand and verify with
> these two different changes combined.
>
>> xfs_inumbers_fmt(
>> void __user *ubuffer, /* buffer to write to */
>> - const xfs_inogrp_t *buffer, /* buffer to read from */
>> + const struct xfs_inogrp *buffer, /* buffer to read from */
>> long count, /* # of elements to read */
>> long *written) /* # of bytes written */
>> {
>> if (copy_to_user(ubuffer, buffer, count * sizeof(*buffer)))
>> - return -EFAULT;
>> + return XFS_ERROR(EFAULT);
>
> xfs_inumbers_fmt_compat will need the same treatment.
Yup.
>
>> *count = 0;
>> + if (agno >= mp->m_sb.sb_agcount ||
>> + *lastino != XFS_AGINO_TO_INO(mp, agno, agino))
>> + return 0;
>
> Where is the lastino check coming from?
Originally, I copied this check up from xfs_bulkstat(), it seems that it
is a redundant check as agno >= mp->m_sb.sb_agcount can handle an invalid
lastino input? At least, I can not think out a case to make it happen for
now.
>
>> buffer = kmem_alloc(bcount * sizeof(*buffer), KM_SLEEP);
>> + bufidx = error = 0;
>
> Why not initialize bufidx and error at declaration time?
So they should be initialized there.
>
>> + error = xfs_inobt_get_rec(cur, &r, &stat);
>> + if (error || !stat)
>> + break;
>
> The old code moved on to the next AG here, why has this changed?
Ah, it should be the old way.
Thanks,
-Jeff
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
prev parent reply other threads:[~2014-05-04 12:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-18 0:58 [PATCH v2 03/10] xfs: consolidate xfs_inumbers Jeff Liu
2014-04-23 15:36 ` Christoph Hellwig
2014-05-04 12:32 ` Jeff Liu [this message]
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=5366336D.5000401@oracle.com \
--to=jeff.liu@oracle.com \
--cc=hch@infradead.org \
--cc=xfs@oss.sgi.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;
as well as URLs for NNTP newsgroup(s).