Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-12507

llapi: llapi_layout_pool_name_set() should "nuke" the ost objects in the layout structure

    XMLWordPrintable

Details

    • New Feature
    • Resolution: Unresolved
    • Minor
    • None
    • Upstream
    • None
    • 9223372036854775807

    Description

      The llapi provides setters and getters around the struct llapi_layout. One of them is llapi_layout_pool_name_set(). The function's description gives the impression that it can be used to change an already existing layout's pool name to something else. In practice, there is information in the struct llapi_layout that is tied to the pool's name that must be erased after (or before) a pool name is set. Here is the definition of struct llapi_layout:

      /**
       * Layout component, which contains all attributes of a plain
       * V1/V3 layout.
       */
      struct llapi_layout_comp {
      	uint64_t	llc_pattern;
      	uint64_t	llc_stripe_size;
      	uint64_t	llc_stripe_count;
      	uint64_t	llc_stripe_offset;
      	/* Add 1 so user always gets back a null terminated string. */
      	char		llc_pool_name[LOV_MAXPOOLNAME + 1];
      	/** Number of objects in llc_objects array if was initialized. */
      	uint32_t	llc_objects_count;
      	struct		lov_user_ost_data_v1 *llc_objects;
      	/* fields used only for composite layouts */
      	struct lu_extent	llc_extent;	/* [start, end) of component */
      	uint32_t		llc_id;		/* unique ID of component */
      	uint32_t		llc_flags;	/* LCME_FL_* flags */
      	uint64_t		llc_timestamp;	/* snapshot timestamp */
      	struct list_head	llc_list;	/* linked to the llapi_layout
      						   components list */
      };
      
      /**
       * An Opaque data type abstracting the layout of a Lustre file.
       */
      struct llapi_layout {
      	uint32_t	llot_magic; /* LLAPI_LAYOUT_MAGIC */
      	uint32_t	llot_gen;
      	uint32_t	llot_flags;
      	bool		llot_is_composite;
      	uint16_t	llot_mirror_count;
      	/* Cursor pointing to one of the components in llot_comp_list */
      	struct llapi_layout_comp *llot_cur_comp;
      	struct list_head	  llot_comp_list;
      };
      

       
      llc_objects_count and llc_objects are the fields that must be reset. This can be done with a call to llapi_layout_ost_index_set() with stripe_number = 0 and ost_index = LLAPI_LAYOUT_DEFAULT.

      I think llapi_pool_name_set() should do this work itself. What do you think? Are there use cases to keeping a component's object list after a pool change?

      Attachments

        Issue Links

          Activity

            People

              pjones Peter Jones
              cealustre CEA
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated: