From: Andrei Borzenkov <arvidjaar@gmail.com>
To: Jan Kara <jack@suse.cz>
Cc: grub-devel@gnu.org
Subject: Re: [PATCH 3/4] xfs: Convert inode numbers to cpu endianity immediately after reading
Date: Tue, 12 May 2015 08:22:47 +0300 [thread overview]
Message-ID: <20150512082247.63841ed9@opensuse.site> (raw)
In-Reply-To: <1405351291-24767-4-git-send-email-jack@suse.cz>
В Mon, 14 Jul 2014 17:21:30 +0200
Jan Kara <jack@suse.cz> пишет:
> Currently XFS driver converted inode numbers to native endianity only
> when using them to compute inode position. Although this works, it is
> somewhat confusing. So convert inode numbers when reading them from disk
> structures as every other field.
>
Not sure whether it is better, but committed to avoid risk breaking
followup patch.
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
> grub-core/fs/xfs.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c
> index ef3bc787e968..7e247a32df5c 100644
> --- a/grub-core/fs/xfs.c
> +++ b/grub-core/fs/xfs.c
> @@ -180,14 +180,14 @@ static inline grub_uint64_t
> GRUB_XFS_INO_INOINAG (struct grub_xfs_data *data,
> grub_uint64_t ino)
> {
> - return (grub_be_to_cpu64 (ino) & ((1LL << GRUB_XFS_INO_AGBITS (data)) - 1));
> + return (ino & ((1LL << GRUB_XFS_INO_AGBITS (data)) - 1));
> }
>
> static inline grub_uint64_t
> GRUB_XFS_INO_AG (struct grub_xfs_data *data,
> grub_uint64_t ino)
> {
> - return (grub_be_to_cpu64 (ino) >> GRUB_XFS_INO_AGBITS (data));
> + return (ino >> GRUB_XFS_INO_AGBITS (data));
> }
>
> static inline grub_disk_addr_t
> @@ -511,13 +511,12 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
> if (smallino)
> {
> parent = grub_be_to_cpu32 (diro->inode.data.dir.dirhead.parent.i4);
> - parent = grub_cpu_to_be64 (parent);
> /* The header is a bit smaller than usual. */
> de = (struct grub_xfs_dir_entry *) ((char *) de - 4);
> }
> else
> {
> - parent = diro->inode.data.dir.dirhead.parent.i8;
> + parent = grub_be_to_cpu64(diro->inode.data.dir.dirhead.parent.i8);
> }
>
> /* Synthesize the direntries for `.' and `..'. */
> @@ -550,7 +549,6 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
> | (((grub_uint64_t) inopos[5]) << 16)
> | (((grub_uint64_t) inopos[6]) << 8)
> | (((grub_uint64_t) inopos[7]) << 0);
> - ino = grub_cpu_to_be64 (ino);
>
> c = de->name[de->len];
> de->name[de->len] = '\0';
> @@ -632,7 +630,8 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
> is not used by GRUB. So it can be overwritten. */
> filename[direntry->len] = '\0';
>
> - if (iterate_dir_call_hook (direntry->inode, filename, &ctx))
> + if (iterate_dir_call_hook (grub_be_to_cpu64(direntry->inode),
> + filename, &ctx))
> {
> grub_free (dirblock);
> return 1;
> @@ -694,7 +693,7 @@ grub_xfs_mount (grub_disk_t disk)
> goto fail;
>
> data->diropen.data = data;
> - data->diropen.ino = data->sblock.rootino;
> + data->diropen.ino = grub_be_to_cpu64(data->sblock.rootino);
> data->diropen.inode_read = 1;
> data->bsize = grub_be_to_cpu32 (data->sblock.bsize);
> data->agsize = grub_be_to_cpu32 (data->sblock.agsize);
next prev parent reply other threads:[~2015-05-12 5:22 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-14 15:21 [PATCH 0/4] Support for XFS v5 superblock Jan Kara
2014-07-14 15:21 ` [PATCH 1/4] xfs: Add helper for inode size Jan Kara
2015-05-11 11:53 ` Andrei Borzenkov
2015-05-11 12:15 ` Jan Kara
2015-05-12 5:26 ` Andrei Borzenkov
2015-05-12 8:07 ` Jan Kara
2014-07-14 15:21 ` [PATCH 2/4] xfs: Fix termination loop for directory iteration Jan Kara
2015-05-11 11:49 ` Andrei Borzenkov
2014-07-14 15:21 ` [PATCH 3/4] xfs: Convert inode numbers to cpu endianity immediately after reading Jan Kara
2015-05-12 5:22 ` Andrei Borzenkov [this message]
2014-07-14 15:21 ` [PATCH 4/4] xfs: V5 filesystem format support Jan Kara
2015-05-12 5:23 ` Andrei Borzenkov
2015-05-12 13:47 ` Jan Kara
2015-05-13 4:50 ` Andrei Borzenkov
2015-05-13 7:12 ` Jan Kara
2014-07-21 17:31 ` [PATCH 0/4] Support for XFS v5 superblock Jan Kara
2014-07-21 21:42 ` Vladimir 'φ-coder/phcoder' Serbinenko
2014-09-23 7:39 ` Jan Kara
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=20150512082247.63841ed9@opensuse.site \
--to=arvidjaar@gmail.com \
--cc=grub-devel@gnu.org \
--cc=jack@suse.cz \
/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).