Loading lfs/src/fuse_ops/directory.cpp +33 −0 Original line number Diff line number Diff line Loading @@ -165,6 +165,39 @@ void adafs_ll_readdir(fuse_req_t req, fuse_ino_t ino, size_t size, off_t off, st // Read all filenames in dir entry folder for inode of md // auto dentries = make_shared<vector<string>>(); /** * Alright, so what I need to do here is the following: * Every entry that is retrieved out of the dentries in the directory needs the * inode number and the mode (not sure which yet). This means that this information * has to be somewhere where the dentries are located. However, ls is not a focus on the file system * and is allowed to take longer. If applictions really need ls a lot (which we will see in the application * anaylsis) than it can still be changed. * In a NoSQL database a range query on the dentry table can be done on the dir inode. This should then return the inode numbers, * the modes, gid, uid, and the names of all the files that are in the directory. I am not sure what the tiny struct is * actually used for. XXX Investigate what readdir actually needs. * * For now, we use the file system as the database. The structure here is slightly different. The metadata * of the files is still based on the inode. In the dentry folder the inode of the dir is containing all the * files in the directory. Each file is represented as a file. The name of the file is the file name. * Extended attributes could be used for inode number, mode, gid, and uid. Or we just write it in there. first line inode * second line modes, etc... * * Lookup could be configured to actually get the rest of the metadata or leave most of it empty and just use * the information from readdir, IF we can get this information there because it is a separate call... * * First time readdir is called, all information is fetched once and put into a cache. Then the cache is * iterated with a counter how many files are already iterated. This is because readdir can only add a size_t * number of files before readdir has to be called again. Then it needs to be remembered. In the first * implementation we just call the file system multiple times and use the offset as a counter which will be * slow but whatever. * * Summary: * readdir: fetch dentries by dir inode number. get names, mode, and inode numbers of files and add it to fuse_add_direntry * getdirattr: call do_lookup(inode) * lookup: read dentry with parent inode and filename. Hopefully, this information is still in cache. If required * call do_lookup(file inode). */ // # first testentry auto st = make_unique<struct stat>(); st->st_ino = 2; Loading stackfs_lowlevel/main.c +23 −23 Original line number Diff line number Diff line Loading @@ -547,8 +547,8 @@ static void stackfs_ll_lookup(fuse_req_t req, fuse_ino_t parent, char *fullPath = NULL; double attr_val; // StackFS_trace("Lookup called on name : %s, parent ino : %llu", // name, parent); StackFS_trace("Lookup called on name : %s, parent ino : %llu", name, parent); fullPath = (char *)malloc(PATH_MAX); construct_full_path(req, parent, fullPath, name); Loading Loading @@ -593,8 +593,8 @@ static void stackfs_ll_getattr(fuse_req_t req, fuse_ino_t ino, (void) fi; double attr_val; //StackFS_trace("Getattr called on name : %s and inode : %llu", // lo_name(req, ino), lo_inode(req, ino)->ino); StackFS_trace("Getattr called on name : %s and inode : %llu", lo_name(req, ino), lo_inode(req, ino)->ino); attr_val = lo_attr_valid_time(req); //generate_start_time(req); res = stat(lo_name(req, ino), &buf); Loading @@ -614,8 +614,8 @@ static void stackfs_ll_setattr(fuse_req_t req, fuse_ino_t ino, struct stat buf; double attr_val; //StackFS_trace("Setattr called on name : %s and inode : %llu", // lo_name(req, ino), lo_inode(req, ino)->ino); StackFS_trace("Setattr called on name : %s and inode : %llu", lo_name(req, ino), lo_inode(req, ino)->ino); attr_val = lo_attr_valid_time(req); //generate_start_time(req); if (to_set & FUSE_SET_ATTR_SIZE) { Loading Loading @@ -660,8 +660,8 @@ static void stackfs_ll_create(fuse_req_t req, fuse_ino_t parent, char *fullPath = NULL; double attr_val; //StackFS_trace("Create called on %s and parent ino : %llu", // name, lo_inode(req, parent)->ino); StackFS_trace("Create called on %s and parent ino : %llu", name, lo_inode(req, parent)->ino); fullPath = (char *)malloc(PATH_MAX); construct_full_path(req, parent, fullPath, name); Loading Loading @@ -742,8 +742,8 @@ static void stackfs_ll_mkdir(fuse_req_t req, fuse_ino_t parent, char *fullPath = NULL; double attr_val; //StackFS_trace("Mkdir called with name : %s, parent ino : %llu", // name, lo_inode(req, parent)->ino); StackFS_trace("Mkdir called with name : %s, parent ino : %llu", name, lo_inode(req, parent)->ino); fullPath = (char *)malloc(PATH_MAX); construct_full_path(req, parent, fullPath, name); Loading Loading @@ -828,7 +828,7 @@ static void stackfs_ll_open(fuse_req_t req, fuse_ino_t ino, // StackFS_trace("Open called on name : %s and fuse inode : %llu kernel inode : %llu fd : %d", // lo_name(req, ino), get_higher_fuse_inode_no(req, ino), get_lower_fuse_inode_no(req, ino), fd); //StackFS_trace("Open name : %s and inode : %llu", lo_name(req, ino), get_lower_fuse_inode_no(req, ino)); StackFS_trace("Open name : %s and inode : %llu", lo_name(req, ino), get_lower_fuse_inode_no(req, ino)); if (fd == -1) return (void) fuse_reply_err(req, errno); Loading @@ -844,8 +844,8 @@ static void stackfs_ll_opendir(fuse_req_t req, fuse_ino_t ino, DIR *dp; struct lo_dirptr *d; //StackFS_trace("Opendir called on name : %s and inode : %llu", // lo_name(req, ino), lo_inode(req, ino)->ino); StackFS_trace("Opendir called on name : %s and inode : %llu", lo_name(req, ino), lo_inode(req, ino)->ino); //generate_start_time(req); dp = opendir(lo_name(req, ino)); Loading Loading @@ -923,8 +923,8 @@ static void stackfs_ll_readdir(fuse_req_t req, fuse_ino_t ino, size_t size, int err; (void) ino; //StackFS_trace("Readdir called on name : %s and inode : %llu", // lo_name(req, ino), lo_inode(req, ino)->ino); StackFS_trace("Readdir called on name : %s and inode : %llu", lo_name(req, ino), lo_inode(req, ino)->ino); d = lo_dirptr(fi); buf = malloc(size*sizeof(char)); if (!buf) Loading Loading @@ -996,8 +996,8 @@ static void stackfs_ll_release(fuse_req_t req, fuse_ino_t ino, { (void) ino; //StackFS_trace("Release called on name : %s and inode : %llu fd : %d ", // lo_name(req, ino), lo_inode(req, ino)->ino, fi->fh); StackFS_trace("Release called on name : %s and inode : %llu fd : %d ", lo_name(req, ino), lo_inode(req, ino)->ino, fi->fh); //generate_start_time(req); close(fi->fh); //generate_end_time(req); Loading @@ -1012,8 +1012,8 @@ static void stackfs_ll_releasedir(fuse_req_t req, fuse_ino_t ino, struct lo_dirptr *d; (void) ino; //StackFS_trace("Releasedir called on name : %s and inode : %llu", // lo_name(req, ino), lo_inode(req, ino)->ino); StackFS_trace("Releasedir called on name : %s and inode : %llu", lo_name(req, ino), lo_inode(req, ino)->ino); d = lo_dirptr(fi); //generate_start_time(req); closedir(d->dp); Loading Loading @@ -1097,8 +1097,8 @@ static void stackfs_ll_rmdir(fuse_req_t req, fuse_ino_t parent, int res; char *fullPath = NULL; //StackFS_trace("rmdir called with name : %s, parent inode : %llu", // name, lo_inode(req, parent)->ino); StackFS_trace("rmdir called with name : %s, parent inode : %llu", name, lo_inode(req, parent)->ino); fullPath = (char *)malloc(PATH_MAX); construct_full_path(req, parent, fullPath, name); //generate_start_time(req); Loading Loading
lfs/src/fuse_ops/directory.cpp +33 −0 Original line number Diff line number Diff line Loading @@ -165,6 +165,39 @@ void adafs_ll_readdir(fuse_req_t req, fuse_ino_t ino, size_t size, off_t off, st // Read all filenames in dir entry folder for inode of md // auto dentries = make_shared<vector<string>>(); /** * Alright, so what I need to do here is the following: * Every entry that is retrieved out of the dentries in the directory needs the * inode number and the mode (not sure which yet). This means that this information * has to be somewhere where the dentries are located. However, ls is not a focus on the file system * and is allowed to take longer. If applictions really need ls a lot (which we will see in the application * anaylsis) than it can still be changed. * In a NoSQL database a range query on the dentry table can be done on the dir inode. This should then return the inode numbers, * the modes, gid, uid, and the names of all the files that are in the directory. I am not sure what the tiny struct is * actually used for. XXX Investigate what readdir actually needs. * * For now, we use the file system as the database. The structure here is slightly different. The metadata * of the files is still based on the inode. In the dentry folder the inode of the dir is containing all the * files in the directory. Each file is represented as a file. The name of the file is the file name. * Extended attributes could be used for inode number, mode, gid, and uid. Or we just write it in there. first line inode * second line modes, etc... * * Lookup could be configured to actually get the rest of the metadata or leave most of it empty and just use * the information from readdir, IF we can get this information there because it is a separate call... * * First time readdir is called, all information is fetched once and put into a cache. Then the cache is * iterated with a counter how many files are already iterated. This is because readdir can only add a size_t * number of files before readdir has to be called again. Then it needs to be remembered. In the first * implementation we just call the file system multiple times and use the offset as a counter which will be * slow but whatever. * * Summary: * readdir: fetch dentries by dir inode number. get names, mode, and inode numbers of files and add it to fuse_add_direntry * getdirattr: call do_lookup(inode) * lookup: read dentry with parent inode and filename. Hopefully, this information is still in cache. If required * call do_lookup(file inode). */ // # first testentry auto st = make_unique<struct stat>(); st->st_ino = 2; Loading
stackfs_lowlevel/main.c +23 −23 Original line number Diff line number Diff line Loading @@ -547,8 +547,8 @@ static void stackfs_ll_lookup(fuse_req_t req, fuse_ino_t parent, char *fullPath = NULL; double attr_val; // StackFS_trace("Lookup called on name : %s, parent ino : %llu", // name, parent); StackFS_trace("Lookup called on name : %s, parent ino : %llu", name, parent); fullPath = (char *)malloc(PATH_MAX); construct_full_path(req, parent, fullPath, name); Loading Loading @@ -593,8 +593,8 @@ static void stackfs_ll_getattr(fuse_req_t req, fuse_ino_t ino, (void) fi; double attr_val; //StackFS_trace("Getattr called on name : %s and inode : %llu", // lo_name(req, ino), lo_inode(req, ino)->ino); StackFS_trace("Getattr called on name : %s and inode : %llu", lo_name(req, ino), lo_inode(req, ino)->ino); attr_val = lo_attr_valid_time(req); //generate_start_time(req); res = stat(lo_name(req, ino), &buf); Loading @@ -614,8 +614,8 @@ static void stackfs_ll_setattr(fuse_req_t req, fuse_ino_t ino, struct stat buf; double attr_val; //StackFS_trace("Setattr called on name : %s and inode : %llu", // lo_name(req, ino), lo_inode(req, ino)->ino); StackFS_trace("Setattr called on name : %s and inode : %llu", lo_name(req, ino), lo_inode(req, ino)->ino); attr_val = lo_attr_valid_time(req); //generate_start_time(req); if (to_set & FUSE_SET_ATTR_SIZE) { Loading Loading @@ -660,8 +660,8 @@ static void stackfs_ll_create(fuse_req_t req, fuse_ino_t parent, char *fullPath = NULL; double attr_val; //StackFS_trace("Create called on %s and parent ino : %llu", // name, lo_inode(req, parent)->ino); StackFS_trace("Create called on %s and parent ino : %llu", name, lo_inode(req, parent)->ino); fullPath = (char *)malloc(PATH_MAX); construct_full_path(req, parent, fullPath, name); Loading Loading @@ -742,8 +742,8 @@ static void stackfs_ll_mkdir(fuse_req_t req, fuse_ino_t parent, char *fullPath = NULL; double attr_val; //StackFS_trace("Mkdir called with name : %s, parent ino : %llu", // name, lo_inode(req, parent)->ino); StackFS_trace("Mkdir called with name : %s, parent ino : %llu", name, lo_inode(req, parent)->ino); fullPath = (char *)malloc(PATH_MAX); construct_full_path(req, parent, fullPath, name); Loading Loading @@ -828,7 +828,7 @@ static void stackfs_ll_open(fuse_req_t req, fuse_ino_t ino, // StackFS_trace("Open called on name : %s and fuse inode : %llu kernel inode : %llu fd : %d", // lo_name(req, ino), get_higher_fuse_inode_no(req, ino), get_lower_fuse_inode_no(req, ino), fd); //StackFS_trace("Open name : %s and inode : %llu", lo_name(req, ino), get_lower_fuse_inode_no(req, ino)); StackFS_trace("Open name : %s and inode : %llu", lo_name(req, ino), get_lower_fuse_inode_no(req, ino)); if (fd == -1) return (void) fuse_reply_err(req, errno); Loading @@ -844,8 +844,8 @@ static void stackfs_ll_opendir(fuse_req_t req, fuse_ino_t ino, DIR *dp; struct lo_dirptr *d; //StackFS_trace("Opendir called on name : %s and inode : %llu", // lo_name(req, ino), lo_inode(req, ino)->ino); StackFS_trace("Opendir called on name : %s and inode : %llu", lo_name(req, ino), lo_inode(req, ino)->ino); //generate_start_time(req); dp = opendir(lo_name(req, ino)); Loading Loading @@ -923,8 +923,8 @@ static void stackfs_ll_readdir(fuse_req_t req, fuse_ino_t ino, size_t size, int err; (void) ino; //StackFS_trace("Readdir called on name : %s and inode : %llu", // lo_name(req, ino), lo_inode(req, ino)->ino); StackFS_trace("Readdir called on name : %s and inode : %llu", lo_name(req, ino), lo_inode(req, ino)->ino); d = lo_dirptr(fi); buf = malloc(size*sizeof(char)); if (!buf) Loading Loading @@ -996,8 +996,8 @@ static void stackfs_ll_release(fuse_req_t req, fuse_ino_t ino, { (void) ino; //StackFS_trace("Release called on name : %s and inode : %llu fd : %d ", // lo_name(req, ino), lo_inode(req, ino)->ino, fi->fh); StackFS_trace("Release called on name : %s and inode : %llu fd : %d ", lo_name(req, ino), lo_inode(req, ino)->ino, fi->fh); //generate_start_time(req); close(fi->fh); //generate_end_time(req); Loading @@ -1012,8 +1012,8 @@ static void stackfs_ll_releasedir(fuse_req_t req, fuse_ino_t ino, struct lo_dirptr *d; (void) ino; //StackFS_trace("Releasedir called on name : %s and inode : %llu", // lo_name(req, ino), lo_inode(req, ino)->ino); StackFS_trace("Releasedir called on name : %s and inode : %llu", lo_name(req, ino), lo_inode(req, ino)->ino); d = lo_dirptr(fi); //generate_start_time(req); closedir(d->dp); Loading Loading @@ -1097,8 +1097,8 @@ static void stackfs_ll_rmdir(fuse_req_t req, fuse_ino_t parent, int res; char *fullPath = NULL; //StackFS_trace("rmdir called with name : %s, parent inode : %llu", // name, lo_inode(req, parent)->ino); StackFS_trace("rmdir called with name : %s, parent inode : %llu", name, lo_inode(req, parent)->ino); fullPath = (char *)malloc(PATH_MAX); construct_full_path(req, parent, fullPath, name); //generate_start_time(req); Loading