-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Description
Consider the example scenario:
A new filesystem that has only /mlfs
- Check the number of
nlinksfor/mlfs, it returns 1 - Create a directory
/mlfs/A - Check the number of
nlinksagain, it returns 2 (from DRAM) - First 3 steps run in the same process.
- In a new program check the number of
nlinksfor/mlfsit returns 1 (This should be 2)
If my understanding is correct we have not persisted it during log digestion.
I attempted a fix for this here: #21
Here's the sample program I used to test it:
create.c
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <assert.h>
#include <mlfs/mlfs_interface.h>
#define PARENT_DIR "/mlfs"
#define CHILD_DIR "/mlfs/A"
int main() {
init_fs();
int ret;
struct stat statbuf;
lstat(PARENT_DIR, &statbuf);
printf("nlinks before creating = %ld\n", statbuf.st_nlink);
ret = mkdir(CHILD_DIR, 0777);
assert(ret == 0);
lstat(PARENT_DIR, &statbuf);
printf("nlinks after creating = %ld\n", statbuf.st_nlink);
shutdown_fs();
}
check.c
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <assert.h>
#include <unistd.h>
#include <mlfs/mlfs_interface.h>
#define PARENT_DIR "/mlfs"
#define CHILD_DIR "/mlfs/A"
int main() {
init_fs();
int ret;
struct stat statbuf;
ret = access(CHILD_DIR, F_OK);
assert(ret == 0);
printf("%s exists!\n", CHILD_DIR);
assert(lstat(PARENT_DIR, &statbuf) == 0);
printf("nlinks = %ld\n", statbuf.st_nlink);
shutdown_fs();
}
Metadata
Metadata
Assignees
Labels
No labels