PERFORCE change 101594 for review
John Birrell
jb at FreeBSD.org
Fri Jul 14 20:14:17 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=101594
Change 101594 by jb at jb_freebsd2 on 2006/07/14 20:14:13
Merge kmacy's debugging printfs.
Affected files ...
.. //depot/projects/dtrace/src/lib/libstand/ufs.c#4 edit
Differences ...
==== //depot/projects/dtrace/src/lib/libstand/ufs.c#4 (text+ko) ====
@@ -279,7 +279,7 @@
* i_number.
*/
-#if defined(__sparc64__) && defined(T1_SIMULATOR)
+#ifdef DEBUG
static void hdump(uint8_t *bp, int size)
{
int i;
@@ -334,6 +334,13 @@
if (fs == NULL)
panic("fs == NULL");
+#ifdef DEBUG
+ printf("read_inode : inumber=0x%llx fsba=0x%llx dba=0x%llx\n",
+ (uint64_t)inumber,
+ (uint64_t)ino_to_fsba(fs, inumber),
+ (uint64_t)fsbtodb(fs, ino_to_fsba(fs, inumber)) );
+#endif
+
/*
* Read inode and save it.
*/
@@ -579,6 +586,14 @@
file_block = lblkno(fs, fp->f_seekp);
file_size = DIP(fp, di_size);
block_size = sblksize(fs, file_size, file_block);
+#ifdef DEBUG
+ printf("buf_read_file: fs->f_seekp=0x%llx : off=0x%lx : file_block=0x%lx : block_size=0x%llx\n",
+ (uint64_t)fp->f_seekp, off, file_block, (uint64_t)block_size);
+ printf("\tfile_size=0x%llx : fs_bsize=0x%llx\n", (uint64_t)file_size, (uint64_t)fs->fs_bsize);
+ printf("fragroundup[blkoff[%lld]=%lld]=%lld\n", file_size, blkoff(fs, file_size),
+ fragroundup(fs, blkoff(fs, file_size)));
+ printf("fs->fs_qbmask=%llx fs->fs_qfmask=%llx fs->fs_fmask=%lx\n", fs->fs_qbmask, fs->fs_qfmask, fs->fs_fmask);
+#endif
#if defined(__sparc64__) && defined(T1_SIMULATOR)
if (block_size > 8192) {
@@ -586,6 +601,9 @@
printf("FORCE ROUND block_size\n");
}
#endif
+#ifdef DEBUG
+ printf("\tfp->f_buf_blkno = 0x%lx\n", fp->f_buf_blkno);
+#endif
if (file_block != fp->f_buf_blkno) {
if (fp->f_buf == (char *)0)
fp->f_buf = malloc(fs->fs_bsize);
@@ -593,16 +611,27 @@
rc = block_map(f, file_block, &disk_block);
if (rc)
return (rc);
+#ifdef DEBUG
+ printf("\tblock_map : disk_block = 0x%lx\n", disk_block);
+#endif
if (disk_block == 0) {
bzero(fp->f_buf, block_size);
fp->f_buf_size = block_size;
} else {
twiddle();
+#ifdef DEBUG
+ printf("\tcalling dev_strategy for block read fsbtodb[0x%lx]=0x%lx\n",
+ disk_block, fsbtodb(fs, disk_block));
+#endif
rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ,
fsbtodb(fs, disk_block),
block_size, fp->f_buf, &fp->f_buf_size);
if (rc)
return (rc);
+#ifdef DEBUG
+ printf("\treturned from block read with 0x%lx bytes\n", fp->f_buf_size);
+ hdump(fp->f_buf, fp->f_buf_size);
+#endif
}
fp->f_buf_blkno = file_block;
@@ -646,6 +675,11 @@
if (rc || read_size != 512)
printf("strategy failed\n");
+#ifdef DEBUG
+ printf("%04d\n", i);
+ hdump(buf, 512);
+#endif
+
}
}
@@ -664,17 +698,34 @@
size_t buf_size;
int namlen, length;
int rc;
+#if defined(__sparc64__) && defined(T1_SIMULATOR)
+ test_disk(f);
+#endif
length = strlen(name);
+#ifdef DEBUG
+ printf("search_directory: name=%s\n", name);
+#endif
fp->f_seekp = 0;
while (fp->f_seekp < DIP(fp, di_size)) {
int i;
rc = buf_read_file(f, &buf, &buf_size);
if (rc)
return (rc);
+#ifdef DEBUG
+ printf("scan directory entries: @ 0x%llx (size=0x%llx)\n",
+ (uint64_t)buf, (uint64_t)buf_size);
+#endif
dp = (struct direct *)buf;
edp = (struct direct *)(buf + buf_size);
i = 0;
+#ifdef DEBUG
+ hdump(buf, buf_size);
+#endif
while (dp < edp) {
+#ifdef DEBUG
+ printf("\tdirent# %d (dp=0x%llx edp=0x%llx\n", i,
+ (uint64_t)dp, (uint64_t)edp);
+#endif
if (dp->d_ino == (ino_t)0)
goto next;
#if BYTE_ORDER == LITTLE_ENDIAN
@@ -683,6 +734,9 @@
else
#endif
namlen = dp->d_namlen;
+#ifdef DEBUG
+ printf("namlen: %d dp->d_name: %s\n", namlen, dp->d_name);
+#endif
if (namlen == length &&
!strcmp(name, dp->d_name)) {
/* found entry */
@@ -699,19 +753,33 @@
}
static int sblock_try[] = SBLOCKSEARCH;
-
#if defined(__sparc64__) && defined(T1_SIMULATOR)
#define SOLARIS_SBLOCK_CONVERT 1
void map_sblock(struct fs *fsp)
{
struct solaris_fs sfs = *(struct solaris_fs *)fsp;
+#ifdef DEBUG
+ printf("fbsd fs_qfmask offset %lx solaris fs_qfmask offset %lx\n",
+ offsetof(struct fs, fs_qfmask), offsetof(struct solaris_fs, fs_qfmask));
+ printf("fbsd fs_qbmask offset %lx solaris fs_qbmask offset %lx\n",
+ offsetof(struct fs, fs_qbmask), offsetof(struct solaris_fs, fs_qbmask));
+
+ printf(" fsp->fs_qbmask: %llx = sfs.fs_qbmask %08lx%08lx;\n",
+ fsp->fs_qbmask, sfs.fs_qbmask.val[0], sfs.fs_qbmask.val[1]);
+ printf(" fsp->fs_qfmask: %llx = sfs.fs_qfmask %08lx%08lx;\n",
+ fsp->fs_qfmask, sfs.fs_qfmask.val[0], sfs.fs_qfmask.val[1]);
+#endif
fsp->fs_qbmask = ((uint64_t)sfs.fs_qbmask.val[0]) << 32 | sfs.fs_qbmask.val[1];
fsp->fs_qfmask = ((uint64_t)sfs.fs_qfmask.val[0]) << 32 | sfs.fs_qfmask.val[1];
}
#endif
+
+
+
+
/*
* Open a file.
*/
@@ -751,6 +819,15 @@
if (rc)
goto out;
+
+
+
+#ifdef DEBUG
+ printf("fs->fs_magic: %x fs->fs_bsize: %x fs->fs_sblockloc: %lx\n",
+ fs->fs_magic, fs->fs_bsize, fs->fs_sblockloc);
+ printf("sblock_try[i]: %x buf_size %lx\n",
+ sblock_try[i], buf_size);
+#endif
if ((fs->fs_magic == FS_UFS1_MAGIC ||
(fs->fs_magic == FS_UFS2_MAGIC &&
fs->fs_sblockloc == sblock_try[i])) &&
@@ -786,6 +863,9 @@
goto out;
}
+#ifdef DEBUG
+ printf("read root inode \n");
+#endif
cp = path = strdup(upath);
if (path == NULL) {
rc = ENOMEM;
@@ -832,6 +912,10 @@
* symbolic link.
*/
parent_inumber = inumber;
+#ifdef DEBUG
+ printf("-- searching %s @ inode = 0x%x - found @ 0x%x\n",
+ ncp, parent_inumber, inumber);
+#endif
rc = search_directory(ncp, f, &inumber);
*cp = c;
if (rc)
More information about the p4-projects
mailing list