<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
John, you are probably right that allowing a passed fd would also be useful, but nobody has done it this way before because of the need to use O_LOV_DELAY_CREATE within the application code... &nbsp;and to be honest very few applications tune their IO to this extent,
 especially with PFL layouts being available to handle 99% of the usage.
<div class=""><br class="">
</div>
<div class="">Please feel free to submit a patch that splits llapi_layout_file_open() into two functions:</div>
<div class="">- llapi_layout_open_fd() (or ...fd_open()? not sure) that only opens the file with O_LOV_DELAY_CREATE and returns the fd</div>
<div class="">- llapi_layout_set_by_fd() that sets the layout on the provided fd (whatever the source)
<div class=""><br class="">
</div>
<div class="">Then&nbsp;llapi_layout_file_open() would just call those two functions internally, and you could use only the&nbsp;llapi_layout_set_by_fd() function, if available (you could add:</div>
<div class=""><br class="">
</div>
<div class="">#defeine HAVE_LLAPI_LAYOUT_SET_BY_FD</div>
<div class=""><br class="">
</div>
<div class="">in the lustreapi.h header to avoid the need for a separate configure check. &nbsp; Otherwise, your code would call your own internal wrapper of the same name that calls llapi_layout_file_open() and immediately closes the returned fd. &nbsp;That would be
 slightly less efficient than the new API (two opens and closes), but would allow you to migrate to the new (more efficient) implementation easily in the future.</div>
<div class=""><br class="">
</div>
<div class="">Cheers, Andreas</div>
<div class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On Jul 28, 2022, at 14:03, John Bauer &lt;<a href="mailto:bauerj@iodoctors.com" class="">bauerj@iodoctors.com</a>&gt; wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="">
<p class="">Andreas,</p>
<p class="">Thanks for the info.&nbsp; A related question:&nbsp; I am using the O_LOV_DELAY_CREATE open flag mechanism to open a file and then set the composite layout with llapi_layout_file_open().&nbsp; I was kind of surprised this worked.&nbsp; This ends up opening the file
 twice and I simply close the fd returned from llapi_layout_file_open().&nbsp; It would seem there should be an llapi function such as llapi_layout_set_by_fd() to match the llapi_layout_get_by_fd().&nbsp; I need to use this mechanism to set striping for files where the
 pathname is not necessarily known before the open, such as the mkstemps() family of opens.&nbsp; It also makes it easier to handle setting striping for files opened with openat().&nbsp; It seems it would be more straight forward for llapi to work with an fd than a pathname
 if a valid fd already exists. Am I missing an easier way to do this?</p>
<p class="">Thanks,</p>
<p class="">John<br class="">
</p>
<div class="moz-cite-prefix">On 7/27/22 16:25, Andreas Dilger wrote:<br class="">
</div>
<blockquote type="cite" cite="mid:D58CA859-926E-4B94-96AE-DA40C023DF8B@ddn.com" class="">
The HLD document was written before the feature was implemented, and is outdated. &nbsp;The lustreapi.h and llapi_layout_file_comp_del.3 man page are correct. &nbsp;Feel free to update the wiki to use the correct argument list.
<div class=""><br class="">
</div>
<div class="">I believe that it is possible to delete multiple components that match the &lt;flags&gt; argument (e.g. LCME_FL_NEG|LCME_FL_INIT), but I haven't tested that.&nbsp;<br class="">
<div class=""><br class="">
<blockquote type="cite" class="">
<div class="">On Jul 26, 2022, at 14:35, John Bauer &lt;<a href="mailto:bauerj@iodoctors.com" class="moz-txt-link-freetext" moz-do-not-send="true">bauerj@iodoctors.com</a>&gt; wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="">Hi all,<br class="">
<br class="">
I would like to use the llapi_layout_file_comp_del() function.&nbsp; I have found 2 prototypes in different places.&nbsp; One has the 3rd argument, uint32_t flags, and the other doesn't.&nbsp; I suspect the High Level Design document is incorrect.&nbsp; The one line of documentation
 in lustreapi.h indicates I could delete multiple components with one call.&nbsp; How does one do that? What are the applicable flags?<br class="">
<br class="">
>From version 2.12.8 lustreapi.h<br class="">
<br class="">
/**<br class="">
* Delete component(s) by the specified component id or flags.<br class="">
*/<br class="">
int &nbsp;llapi_layout_file_comp_del(const &nbsp;char &nbsp;*path, uint32_t &nbsp;id, uint32_t &nbsp;flags);<br class="">
<br class="">
<br class="">
>From <a href="https://wiki.lustre.org/PFL2_High_Level_Design" class="moz-txt-link-freetext" moz-do-not-send="true">
https://wiki.lustre.org/PFL2_High_Level_Design</a><br class="">
<br class="">
A new interface llapi_layout_file_comp_del(3) to delete component(s) by the specified component id (accepting LCME_ID_* wildcards also) from an existing file:<br class="">
<br class="">
int llapi_layout_file_comp_del(const char *path, uint32_t id);<br class="">
<br class="">
John<br class="">
<br class="">
_______________________________________________<br class="">
lustre-discuss mailing list<br class="">
<a href="mailto:lustre-discuss@lists.lustre.org" class="moz-txt-link-freetext" moz-do-not-send="true">lustre-discuss@lists.lustre.org</a><br class="">
<a class="moz-txt-link-freetext" href="http://lists.lustre.org/listinfo.cgi/lustre-discuss-lustre.org">http://lists.lustre.org/listinfo.cgi/lustre-discuss-lustre.org</a><br class="">
</div>
</div>
</blockquote>
</div>
<br class="">
<div class="">
<div dir="auto" class="">
<div dir="auto" class="">
<div dir="auto" class="">
<div dir="auto" class="">
<div dir="auto" class="">
<div dir="auto" class="">
<div class="">Cheers, Andreas</div>
<div class="">--</div>
<div class="">Andreas Dilger</div>
<div class="">Lustre&nbsp;Principal Architect</div>
<div class="">Whamcloud</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
</div>
</div>
</div>
</div>
</div>
<br class="Apple-interchange-newline">
</div>
<br class="Apple-interchange-newline">
<br class="Apple-interchange-newline">
</div>
<br class="">
</div>
</blockquote>
</div>
</div>
</blockquote>
</div>
<br class="">
<div class="">
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<div>Cheers, Andreas</div>
<div>--</div>
<div>Andreas Dilger</div>
<div>Lustre&nbsp;Principal Architect</div>
<div>Whamcloud</div>
<div><br class="">
</div>
<div><br class="">
</div>
<div><br class="">
</div>
</div>
</div>
</div>
</div>
</div>
<br class="Apple-interchange-newline">
</div>
<br class="Apple-interchange-newline">
<br class="Apple-interchange-newline">
</div>
<br class="">
</div>
</div>
</body>
</html>