public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: Mark Tinguely <tinguely@sgi.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH v2] xfsprogs/io: add readdir command
Date: Thu, 08 Aug 2013 13:38:12 -0400	[thread overview]
Message-ID: <5203D784.7070900@redhat.com> (raw)
In-Reply-To: <5203A5B7.4020102@sgi.com>

On 08/08/2013 10:05 AM, Mark Tinguely wrote:
> On 07/24/13 07:44, Brian Foster wrote:
>> readdir reads the directory entries from an open directory from
>> the provided offset (or 0 if not specified). On completion,
>> readdir prints summary information regarding the number of
>> operations and bytes transferred. Options are available to specify
>> the starting offset, length and verbose mode to dump directory
>> entry information.
>>
>> Signed-off-by: Brian Foster<bfoster@redhat.com>
>> ---
>>
>> v2:
>> - Convert from getdents to readdir.
>> - Use configure mechanism for libc readdir() availability (zab).
>> - Add extra dirent fields to verbose output (zab).
>>
> 
> Just started to look at this.
> 

Hi Mark,

Thanks for looking at this...

> Shouldn't there be a "closedir(dir);" to close the directory stream and
> release the directory structure?
> 

According to the man page, closedir() would also close the fd. I gave it
a quick test to be sure and I end up with behavior like this:

xfs_io> open /export/test
xfs_io> readdir
[00000000 [00000004 [00000006 [00000009 [00000200 read 104 bytes from
offset 0
104.000000 bytes, 4 ops, 0.0000 sec (5.220 MiB/sec and 210526.3158 ops/sec)
xfs_io> close
close: Bad file descriptor

That said, I'm not sure what the ramifications of repeated readdir
commands might be (i.e., repeated fdopendir() calls on the same fd).
Perhaps the right thing to do here is dup() file->fd prior to
fdopendir() and then add the closedir().

> Could we get a little info for the xfs_io man page?
> 

Ok.

Brian

> Looks like a nice feature.
> 
> Thanks.
> 
> --Mark.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2013-08-08 17:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-24 12:44 [PATCH v2] xfsprogs/io: add readdir command Brian Foster
2013-08-08 14:05 ` Mark Tinguely
2013-08-08 17:38   ` Brian Foster [this message]
2013-08-08 18:36     ` Mark Tinguely
2013-08-08 20:39   ` Eric Sandeen

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=5203D784.7070900@redhat.com \
    --to=bfoster@redhat.com \
    --cc=tinguely@sgi.com \
    --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