Pvfs2.7.1 basic operations

Source: Internet
Author: User

enum PVFS_server_op{    PVFS_SERV_INVALID = 0,    PVFS_SERV_CREATE = 1,    PVFS_SERV_REMOVE = 2,    PVFS_SERV_IO = 3,    PVFS_SERV_GETATTR = 4,    PVFS_SERV_SETATTR = 5,    PVFS_SERV_LOOKUP_PATH = 6,    PVFS_SERV_CRDIRENT = 7,    PVFS_SERV_RMDIRENT = 8,    PVFS_SERV_CHDIRENT = 9,    PVFS_SERV_TRUNCATE = 10,    PVFS_SERV_MKDIR = 11,    PVFS_SERV_READDIR = 12,    PVFS_SERV_GETCONFIG = 13,    PVFS_SERV_WRITE_COMPLETION = 14,    PVFS_SERV_FLUSH = 15,    PVFS_SERV_MGMT_SETPARAM = 16,    PVFS_SERV_MGMT_NOOP = 17,    PVFS_SERV_STATFS = 18,    PVFS_SERV_PERF_UPDATE = 19,  /* not a real protocol request */    PVFS_SERV_MGMT_PERF_MON = 20,    PVFS_SERV_MGMT_ITERATE_HANDLES = 21,    PVFS_SERV_MGMT_DSPACE_INFO_LIST = 22,    PVFS_SERV_MGMT_EVENT_MON = 23,    PVFS_SERV_MGMT_REMOVE_OBJECT = 24,    PVFS_SERV_MGMT_REMOVE_DIRENT = 25,    PVFS_SERV_MGMT_GET_DIRDATA_HANDLE = 26,    PVFS_SERV_JOB_TIMER = 27,    /* not a real protocol request */    PVFS_SERV_PROTO_ERROR = 28,    PVFS_SERV_GETEATTR = 29,    PVFS_SERV_SETEATTR = 30,    PVFS_SERV_DELEATTR = 31,    PVFS_SERV_LISTEATTR = 32,    PVFS_SERV_SMALL_IO = 33,    PVFS_SERV_LISTATTR = 34,    /* leave this entry last */    PVFS_SERV_NUM_OPS};

Note that the following assumption is that there is only one metadata and data server, and both are on one server and configured on a single machine.

Create a file

Execute pvfs2-touch/mnt/pvfs2/file2 on the client

The Operation Order on the server side is

1. Obtain pvfs_serv_getconfig = 13 first,

2. Check the directory attributes.

3. Create the Metafile

4. Create a datafile

5. Set file attributes.

6. Add a table item to the directory item.

If you do not have the permission to execute the last step, the result will be as follows (for example, under the root directory permission, a common user wants to create a file)

That is, the original metadata file and data file will be deleted.


Delete an object

Run pvfs2-rm/mnt/pvfs2/file on the client

The steps on the server side are as follows:

Step:

1. First, retrieve the config file.

2. Delete the parent directory

3. attribute Information of the file to be read (this step aims to obtain the distribution of the data file until the handle of the data file is obtained, but I have not found a function to check whether the file has permissions, for example, a common user deletes a root user file.

4. Delete the data file of the file

5. Delete the metadata file of the file

Create a directory

Execute pvfs2-mkdir/mnt/pvfs2/dir2 on the client

The operation steps on the server side are as follows:

The steps are as follows:

1. first obtain the config file

2. Obtain the attributes of the parent directory (what is the purpose? Check the permissions or check whether there are duplicate files or directories)

3. Create a directory object

4. Add a directory table entry to the parent directory

When the pvfs2-mkdir/mnt/pvfs2/dir2 is re-executed on the client

The steps on the server side are as follows:

When you add a directory item in the last step and find a directory item with the same name, delete the Created directory object and report an error to the client.

Delete a directory

Execute pvfs2-rm/mnt/pvfs2/dir2 on the client

The server performs the following steps:

Steps:

1. first obtain the config file

2. Delete the parent directory and table items.

3. Get the attribute information of the directory file (what is the purpose? check whether there is permission or why)

4. Delete directory file objects

Get Object Attributes

As a basic operation, the server executes


Lookup)

Before the preceding operations, this operation is used to find the handle of the directory file. For example, to create a file, first find the handle of the parent directory according to the path.

To delete a file, you also need to first find the parent directory of the file to be deleted, and then perform the following operations, create a directory, delete a directory similar to the above-created file, delete a file

Changes to sys-getattr.sm

nested machine pvfs2_client_getattr_sm{   /* state acache_lookup    {        run getattr_acache_lookup;        GETATTR_ACACHE_MISS => object_getattr_setup_msgpair;        GETATTR_NEED_DATAFILE_SIZES => datafile_get_sizes;        default => cleanup;    }*/    state object_getattr_setup_msgpair    {        run getattr_object_getattr_setup_msgpair;        success => object_getattr_xfer_msgpair;        default => cleanup;    }    state object_getattr_xfer_msgpair    {        jump pvfs2_msgpairarray_sm;        success => acache_insert;        GETATTR_NEED_DATAFILE_SIZES => datafile_get_sizes;        default => object_getattr_failure;    }    state acache_insert    {        run getattr_acache_insert;        default => cleanup;    }    state object_getattr_failure    {        run getattr_object_getattr_failure;        default => cleanup;    }    state datafile_get_sizes    {jump pvfs2_client_datafile_getattr_sizes_sm;success => acache_insert;        default => cleanup;    }    state cleanup    {        run getattr_cleanup;        default => return;    }}machine pvfs2_client_sysint_getattr_sm{    state dowork    {        jump pvfs2_client_getattr_sm;        default => set_sys_response;     }    state set_sys_response    {        run getattr_set_sys_response;        default => terminate;    }}

Changes to sys-lookup.sm

state lookup_segment_start    {run lookup_segment_start;        /*success => lookup_segment_query_ncache;*/        success => lookup_segment_setup_msgpair;default => lookup_segment_lookup_failure;    }

static PINT_sm_action lookup_segment_setup_msgpair(struct PINT_smcb *smcb,                                                   job_status_s *js_p){.............    /*seg_to_lookup = cur_seg->seg_remaining ? cur_seg->seg_remaining :                    cur_seg->seg_name;*/seg_to_lookup =  cur_seg->seg_name;.................}

When the client executes the pvfs2-mkdir/mnt/pvfs2/dir3/dir4/dir5/dir6/dir7/dir8/dir9

The steps on the server side are as follows:

Steps:

1. First, it is the active config file.

2. Find the dir3 directory.

3. Find the directory dir4.

4. Find the directory dir5.

5. Find the directory dir6.

6. Find the directory dir7.

7. Find the directory dir8

8. Obtain the attributes of the parent directory.

9. Create a directory

10 create a directory item in the parent directory

Similarly, creating a file in a long directory is similar.


Read the readdir directory


Execute pvfs2-ls on the client

The server performs the following steps:

The column directory has been analyzed above. Let's take a look at the steps of readdir.

Obviously, readdir is divided into two steps. The first step is to obtain the attribute information of the directory. The second step is to read the directory items. Why are there two readdir items here? This is because pvfs2 sets the number of directory items to be read each time, when the number of directory items in a directory exceeds a certain value, it is divided into multiple readdir operations.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.