From: "Dilger, Andreas" <andreas.dilger@intel.com>
To: Theodore Ts'o <tytso@mit.edu>
Cc: "linux-ext4@vger.kernel.org" <linux-ext4@vger.kernel.org>
Subject: problem in ext2fs_get_next_inode_full() ?
Date: Thu, 18 Feb 2016 22:05:44 +0000 [thread overview]
Message-ID: <D2EB8E48.12F559%andreas.dilger@intel.com> (raw)
I was just looking at ext2fs_get_next_inode_full() to trace where we
are using large inodes and whether we could change the APIs to just
pass large inodes around instead of typecasting them. It has the
following hunk of code:
if (extra_bytes) {
memcpy(scan->temp_buffer+extra_bytes, scan->ptr,
scan->inode_size - extra_bytes);
scan->ptr += scan->inode_size - extra_bytes;
scan->bytes_left -= scan->inode_size - extra_bytes;
#ifdef WORDS_BIGENDIAN
memset(inode, 0, bufsize);
ext2fs_swap_inode_full(scan->fs,
(struct ext2_inode_large *) inode,
(struct ext2_inode_large *) scan->temp_buffer,
0, bufsize);
#else
*inode = *((struct ext2_inode *) scan->temp_buffer);
#endif
So if the inode is being swabbed then it handles the full inode size, but
if it is not being swabbed (the common case) it appears that it is only
copying the small inode into "*inode" using a struct assignment. This
appears like it would be dropping the large inode data, but I'm not sure
if or when this "extra_bytes" case is hit. The "else" clause appears to
copy the requested (full) inode size properly via "memcpy(..., bufsize)".
Should the struct assignment be changed similarly to use memcpy()?
Cheers, Andreas
--
Andreas Dilger
Lustre Principal Architect
Intel High Performance Data Division
next reply other threads:[~2016-02-18 22:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-18 22:05 Dilger, Andreas [this message]
2016-02-18 22:30 ` problem in ext2fs_get_next_inode_full() ? Andreas Dilger
2016-02-19 14:24 ` Theodore Ts'o
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=D2EB8E48.12F559%andreas.dilger@intel.com \
--to=andreas.dilger@intel.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.