[Ocfs2-tools-devel] Patch for debugfs.ocfs2 icheck command
GONG Jie
jie.gong at oracle.com
Thu Sep 21 02:10:35 PDT 2006
On Thursday 21 September 2006 16:37, tao.ma wrote:
> Hi jie,
> 1 . I have a file in /tmp/a and two link file /c /d link to /tmp/a.
> When I use icheck <block#>, only /tmp/a and /c shows. /d don't shows up.
I think this is not a real problem. The main function of ``icheck'' is fin=
d=20
out the inode number. To find out all the filenames, use ``locate'' or=20
``ncheck'' is much faster, since it only scan the inode, not traversal all=
=20
the extent list of the file.
> 2. In function find_blkno, there seems to be a memory leak.
It is a problem. I will re-investigate it.
>
> >+static int find_blkno(ocfs2_filesys *fs, struct ocfs2_extent_list *el,
> >+ uint64_t blkno)
> >+{
> >+ struct ocfs2_extent_block *eb;
> >+ struct ocfs2_extent_rec *rec;
> >+ errcode_t ret =3D 0;
> >+ char *buf =3D NULL;
> >+ int i;
> >+ int status =3D 0;
> >+
> >+ for (i =3D 0; i < el->l_next_free_rec; ++i) {
> >+ rec =3D &(el->l_recs[i]);
> >+ if (el->l_tree_depth) {
> >+ ret =3D ocfs2_malloc_block(gbls.fs->fs_io, &buf);
> >+ if (ret)
> >+ goto bail;
> >+
> >+ ret =3D ocfs2_read_extent_block(fs, rec->e_blkno,
> >+ buf);
> >+ if (ret)
> >+ goto bail;
> >+
> >+ eb =3D (struct ocfs2_extent_block *)buf;
> >+
> >+ if (find_blkno(fs, &(eb->h_list), blkno)) {
> >+ status =3D 1;
> >+ goto bail;
> >+ }
>
> Here if we don't find blkno, the buf should be released because in next
> loop it will be allocated again.
>
> >+ } else {
> >+ if (rec->e_blkno <=3D blkno && blkno < rec->e_blkno +
> >+ ocfs2_clusters_to_blocks(fs, rec->e_clusters)) {
> >+ status =3D 1;
> >+ goto bail;
> >+ }
> >+ }
> >+ }
> >+bail:
> >+ if (buf)
> >+ ocfs2_free(&buf);
> >+ return status;
> >+}
> >+
> >+
=2D-=20
Regards,
GONG Jie (=B9=A8=F2=A1)
Linux Engineering, Emerging Technology & Solution Development
Oracle Software Research and Development Center
Tel: +86-10-82786289
Mobile: +86-13011102030
Email: jie.gong at oracle.com
More information about the Ocfs2-tools-devel
mailing list