On Wed, Dec 01, 2010 at 02:54:33PM -0500, Josef Bacik wrote:
> Oh well crud, I was hoping that I could leave the inode numbers as 256 for
> everything, but I forgot about readdir. So the inode item in the parent would
> have to have a unique inode number that would get spit out in readdir, but then
> if we stat'ed the directory we'd get 256 for the inode number. Oh well,
> incompat flag it is then.
I think you're already fine:
# mkdir TMP
# dd if=/dev/zero of=TMP-image bs=1M count=512
# mkfs.btrfs TMP-image
# mount -oloop TMP-image TMP/
# btrfs subvolume create sub-a
# btrfs subvolume create sub-b
../readdir-inos .
. 256 256
.. 256 4130609
sub-a 256 256
sub-b 257 256
Where readdir-inos is my silly test program below, and the first number is from
readdir, the second from stat.
?
--b.
#include <stdio.h>
#include <err.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <dirent.h>
/* demonstrate that for mountpoints, readdir ino of mounted-on
* directory, stat returns ino of mounted directory. */
int main(int argc, char *argv[])
{
struct dirent *de;
int ret;
DIR *d;
if (argc != 2)
errx(1, "usage: %s <directory>", argv[0]);
ret = chdir(argv[1]);
if (ret)
errx(1, "chdir /");
d = opendir(".");
if (!d)
errx(1, "opendir .");
while (de = readdir(d)) {
struct stat st;
ret = stat(de->d_name, &st);
if (ret)
errx(1, "stat %s", de->d_name);
printf("%s %d %d\n", de->d_name, de->d_ino, st.st_ino);
}
}
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html