From: Karel Zak <kzak@redhat.com>
To: Eric Sandeen <sandeen@redhat.com>
Cc: ext4 development <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH, RFC] mke2fs: get device topology values from blkid
Date: Sat, 19 Sep 2009 01:59:52 +0200 [thread overview]
Message-ID: <20090918235952.GE29406@nb.net.home> (raw)
In-Reply-To: <4AB2B6B9.7010506@redhat.com>
On Thu, Sep 17, 2009 at 05:22:49PM -0500, Eric Sandeen wrote:
> +static errcode_t ext2fs_get_device_geometry(const char *file,
> + struct ext2_super_block *fs_param)
> +{
> + int fd;
> + int rc = 1;
> + int blocksize;
> + blkid_probe pr;
> + blkid_topology tp;
> + unsigned long min_io;
> + unsigned long opt_io;
> +
> +#ifdef HAVE_OPEN64
> + fd = open64(file, O_RDONLY);
> +#else
> + fd = open(file, O_RDONLY);
> +#endif
> + if (fd < 0)
> + return errno;
> +
> + pr = blkid_new_probe();
> + if (!pr)
> + goto out;
> +
> + rc = blkid_probe_set_device(pr, fd, 0, 0);
> + if (rc)
> + goto out;
> +
> + tp = blkid_probe_get_topology(pr);
> + if (!tp)
> + goto out;
> +
> + min_io = blkid_topology_get_minimum_io_size(tp);
> + opt_io = blkid_topology_get_optimal_io_size(tp);
> + blocksize = EXT2_BLOCK_SIZE(fs_param);
> +
> + fs_param->s_raid_stride = min_io / blocksize;
> + fs_param->s_raid_stripe_width = opt_io / blocksize;
> + rc = 0;
> +out:
blkid_free_probe(pr);
just in case you want to keep valgrind mem-leak checkers silent :-)
> + close(fd);
> + return rc;
> +}
Karel
--
Karel Zak <kzak@redhat.com>
next prev parent reply other threads:[~2009-09-18 23:59 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-17 22:22 [PATCH, RFC] mke2fs: get device topology values from blkid Eric Sandeen
2009-09-18 5:55 ` Andreas Dilger
2009-09-18 14:04 ` Eric Sandeen
2009-09-18 14:20 ` Andreas Dilger
2009-09-18 14:30 ` Eric Sandeen
2009-09-18 16:43 ` Theodore Tso
2009-09-18 16:57 ` Eric Sandeen
2009-09-18 6:13 ` Martin K. Petersen
2009-09-18 14:18 ` Andreas Dilger
2009-09-18 14:23 ` Eric Sandeen
2009-09-18 19:40 ` Martin K. Petersen
2009-09-18 20:28 ` Andreas Dilger
2009-09-20 20:46 ` Martin K. Petersen
2009-09-22 14:30 ` Ric Wheeler
2009-09-18 23:59 ` Karel Zak [this message]
2009-09-19 3:03 ` Eric Sandeen
2009-09-21 17:06 ` [PATCH V2] " Eric Sandeen
2009-10-02 16:32 ` [PATCH V3] " Eric Sandeen
2009-10-04 19:16 ` Theodore Tso
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=20090918235952.GE29406@nb.net.home \
--to=kzak@redhat.com \
--cc=linux-ext4@vger.kernel.org \
--cc=sandeen@redhat.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).