Index: xfs_fsr.c =================================================================== RCS file: /cvs/xfs-cmds/xfsdump/fsr/xfs_fsr.c,v retrieving revision 1.28 diff -u -r1.28 xfs_fsr.c --- xfs_fsr.c 24 May 2007 03:59:42 -0000 1.28 +++ xfs_fsr.c 11 Jun 2007 06:42:29 -0000 @@ -655,10 +655,12 @@ int ret; __s32 buflenout; xfs_bstat_t buf[GRABSZ]; - char fname[64]; + char fname[PATH_MAX+1]; char *tname; + char cmd[64]; jdm_fshandle_t *fshandlep; xfs_ino_t lastino = startino; + FILE *pfname; fsrprintf(_("%s start inode=%llu\n"), mntdir, (unsigned long long)startino); @@ -714,11 +716,20 @@ continue; } - /* Don't know the pathname, so make up something */ - sprintf(fname, "ino=%lld", (long long)p->bs_ino); - - /* Get a tmp file name */ - tname = tmp_next(mntdir); + /* Find (one) filename that this inode belongs to. */ + snprintf(cmd, sizeof(cmd), "find %s -xdev -inum %lld -print0", mntdir, (long long)p->bs_ino); + pfname = popen(cmd, "r"); + fgets(fname, sizeof(fname), pfname); + pclose(pfname); + + if (strlen(fname)) { + tname = gettmpname(fname); + } else { + /* Don't know the pathname, so make up something */ + snprintf(fname, sizeof(fname), "ino=%lld", (long long)p->bs_ino); + /* Get a tmp file name */ + tname = tmp_next(mntdir); + } ret = fsrfile_common(fname, tname, mntdir, fd, p); @@ -1297,6 +1308,8 @@ strcat(buf, sbuf); + fsrprintf(_("gettmpname: fname=%s, buf=%s\n"), fname, buf); + return(buf); }