ntfs readdir的速度太慢
来源:互联网 发布:域名备案之后怎么用 编辑:程序博客网 时间:2024/04/30 06:29
也是移植到ucos平台上的问题.
跟踪后发现是ntfs_filldir太花时间,其中主要是ntfs_attr_name_get/ntfs_attr_name_free花的时间比较多(malloc/free).
static int ntfs_filldir(ntfs_inode *dir_ni, s64 *pos, u8 ivcn_bits,const INDEX_TYPE index_type, void *iu, INDEX_ENTRY *ie,void *dirent, struct file_info* info){FILE_NAME_ATTR *fn = &ie->key.file_name;unsigned dt_type;MFT_REF mref;//tchar_t* filename;ntfs_log_enter("Entering %s\n", __FUNCTION__);//ntfs_log_trace("file name is %s\n", fn->file_name);//<strong>filename = ntfs_attr_name_get(fn->file_name, fn->file_name_length);</strong>//dump_fname(filename, fn->file_name_length * sizeof(tchar_t));//ntfs_log_trace("%c%c%c%c%c %lld %s\n",(fn->file_attributes & FILE_ATTR_I30_INDEX_PRESENT) ? 'D' : '-',(fn->file_attributes & FILE_ATTR_READONLY) ? 'R' : '-',(fn->file_attributes & FILE_ATTR_HIDDEN) ? 'H' : '-',(fn->file_attributes & FILE_ATTR_SYSTEM) ? 'S' : '-',(fn->file_attributes & FILE_ATTR_ARCHIVE) ? 'A' : '-',fn->data_size, fn->file_name);info->flag = (fn->file_attributes & FILE_ATTR_I30_INDEX_PRESENT) ? FILE_DIR : FILE_REGULAR; // 0 means regular file, 1 means dirinfo->is_system_file = (fn->file_attributes & FILE_ATTR_SYSTEM) ? 1 : 0;info->is_hidden_file = (fn->file_attributes & FILE_ATTR_HIDDEN) ? 1 : 0;info->fattr = fn->file_attributes;info->fsize = fn->data_size;/* Advance the position even if going to skip the entry. */if (index_type == INDEX_TYPE_ALLOCATION)*pos = (u8*)ie - (u8*)iu + (sle64_to_cpu(((INDEX_ALLOCATION *)iu)->index_block_vcn) << ivcn_bits) +dir_ni->vol->mft_record_size;else /* if (index_type == INDEX_TYPE_ROOT) */*pos = (u8*)ie - (u8*)iu;/* Skip root directory self reference entry. */if (MREF_LE(ie->indexed_file) == FILE_root){//<strong>ntfs_attr_name_free(&filename);</strong>return 0;}if (ie->key.file_name.file_attributes & FILE_ATTR_I30_INDEX_PRESENT)dt_type = NTFS_DT_DIR;else if (fn->file_attributes & FILE_ATTR_SYSTEM)dt_type = NTFS_DT_UNKNOWN;elsedt_type = NTFS_DT_REG;<strong>memcpy(dirent, fn->file_name, fn->file_name_length * sizeof(tchar_t));</strong>*(((tchar_t*)dirent) + fn->file_name_length) = '\0';//do not forget the ending \0info->name_len = fn->file_name_length;/* return metadata files and hidden files if requested */mref = le64_to_cpu(ie->indexed_file);//<strong>ntfs_attr_name_free(&filename);</strong>return 0;}
实际上,不要重新去malloc/free,直接用fn->file_name copy 到dirent里面就可以的.
0 0
- ntfs readdir的速度太慢
- 速度太慢
- conda下载速度太慢
- ubuntu 下载速度太慢
- 优化MyEclipse,遇到的myEclipse速度太慢的question
- 关于Myeclipse启动速度太慢的问题
- github 克隆和上传代码速度太慢的解决方法
- Maven构建项目速度太慢的解决办法
- 计算mover distance的问题,速度太慢了
- Maven构建项目速度太慢的解决办法
- 解决国内访问github速度太慢的问题
- ubuntu ssh登入速度太慢的解决办法
- 关于selenium调用IE执行速度太慢的解决办法
- 解决eclipse编译 js文件速度太慢的问题
- MYSQL分页limit速度太慢的优化方法
- Android的模拟器,在ADT中调试运行AVD时,速度太慢,极其的慢
- Android的模拟器,在ADT中调试运行AVD时,速度太慢,极其的慢
- Android的模拟器,在ADT中调试运行AVD时,速度太慢,极其的慢
- 浅谈andorid的四种数据存储方式(也是为了方便自己以后查阅,会及时更新)
- Html的基础
- boost.smart_ptr-智能指针scoped_ptr
- xxs简单了解
- Android 自定义CircleProgressBarView
- ntfs readdir的速度太慢
- String 过滤字符串
- java线程扫盲笔记
- Apache Shiro 使用手册(三)Shiro 授权
- 01背包的变形
- 闭包,this指向,作用域,绑定对象
- String.format 的大用场
- 感受
- 关于Linux C++代码在Windows平台上的调试运行