<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Transitional//EN">
<HTML>
<HEAD>
  <!--
    *************************************************************************************
    * Copyright (c) 2005 VERITAS Software Corporation. All rights reserved. *

      For third-party license citations, please see the bottom of this file.
    *************************************************************************************
  -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="TEMPLATEBASE" content="vx_vxhelp_2005c">
<meta name="LASTUPDATED" content="06/13/05 10:02:07">
<meta name="PRODUCTNAME" content="VERITAS Software Documentation">
<meta name="FILENAME" content="04.app_interface.fm">
     
<title>Extent Information</title>

</HEAD>

<BODY bgcolor="#FFFFFF" link="#000066" vlink="#0000ff" marginheight="0" topmargin="0">
<basefont=1>

<a name="135687"></a>

<div align="left">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
 <tr>
   <td height="2" border="0" cellspacing="0" cellpadding="0" colspan="2" bgcolor="#000000">
   </td>
 </tr>
 <tr>
   <td height="15" width="50%" border="0" cellspacing="0" cellpadding="0" bgcolor="#cccccc">
    <img src="images/vxsymbol.gif" height="20" width="31" border="0" cellspacing="0" cellpadding="0" align="left">
     
     
   </td>
   <td align="right" width="50%" bgcolor="#cccccc">

<!-- Header Breadcrumbs -->
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="-2">&lt;&nbsp;<a href="04_app_interface_vxfs39_122558.html" title="Previous - Cache Advisories">Previous</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="04_app_interface_vxfs41_122703.html" title="Next - Freeze and Thaw">Next</a>
&nbsp;&gt;&nbsp;&nbsp;</font>
   </td>
 </tr>

 <tr>
  <td bgcolor="#CCCCCC" colspan="2" height="15" align="right">
  <font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="1">Product:  
<a href="vxfs_splashpage_docCD_vxfs1_103036.vxhd" title="File System Guides title page ">File System Guides</a>
  &nbsp;&nbsp;
  </font>
  </td>
 </tr>
 <tr>
  <td bgcolor="#CCCCCC" colspan="2" height="15" align="right">
  <font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="1">Manual:  
<a href="vxfs_admin_titlepage_docCD_vxfs2_73700.vxhd" title="File System 4.1 Administrator's Guide title page ">File System 4.1 Administrator's Guide</a>
  &nbsp;&nbsp;
  </font>
  </td>
 </tr>


</table>
</div>

<div align="left">
 <table border="0" width="100%" bgcolor="#FFFFFF">
  <tr>
   <td width="100%" valign="top" bgcolor="#FFFFFF">

<!-- Start Main Topic Content -->
        <a name="startcontent"></a>
	
<h1><font face="Arial, Helvetica, Geneva, sansserif, sans serif, Verdana" size="+1" color="#000000"><a name="135687"></a> Extent Information</font>
</h1>
         
<p>
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2"><a name="122652"></a>The <font face="Courier New, Courier, sansserif, sans serif" size="2">VX_SETEXT</font> ioctl command allows an application to reserve space for a file, and set fixed extent sizes and file allocation flags. Applications can obtain status information on VxFS files by using the <font face="Courier New, Courier, sansserif, sans serif" size="2">VX_GETEXT</font> ioctl. The <font face="Courier New, Courier, sansserif, sans serif" size="2">getext</font> command also provides access to this information. See the <font face="Courier New, Courier, sansserif, sans serif" size="2">setext</font>(1M), <font face="Courier New, Courier, sansserif, sans serif" size="2">getext</font>(1M), and <font face="Courier New, Courier, sansserif, sans serif" size="2">vxfsio</font>(7) manual pages for more information.</font>
</p>

<p>
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2"><a name="122657"></a>Each invocation of the <font face="Courier New, Courier, sansserif, sans serif" size="2">VX_SETEXT</font> ioctl affects all the elements in the <font face="Courier New, Courier, sansserif, sans serif" size="2">vx_ext</font> structure. When using <font face="Courier New, Courier, sansserif, sans serif" size="2">VX_SETEXT</font>, always use the following procedure:</font>
</p>

</ol>
<p><img src="images/stepintro.gif" height="16" width="16">
<font face="Arial, Helvetica, Geneva, sansserif, sans serif, Verdana" size="2" color="#000000"><a name="154651"></a>&nbsp;&nbsp;<b>To use VX_SETEXT</b></font>
</p>
<ol>
<li value="1">
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2"><a name="122658"></a>Use <font face="Courier New, Courier, sansserif, sans serif" size="2">VX_GETEXT</font> to read the current settings.
</font>
<li value="2">
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2"><a name="122659"></a>Modify the values to be changed.
</font>
<li value="3">
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2"><a name="122660"></a>Call <font face="Courier New, Courier, sansserif, sans serif" size="2">VX_SETEXT</font> to set the values.
</font>
<hr noshade size="2" width="100%" color="#000000">
<img src="images/caution.gif" alt="Caution " height="16" width="16">&nbsp;<font face="Arial, Helvetica, Geneva, sansserif, sans serif, Verdana" size="2" color="#000000"><a name="122661"></a><b>Caution  &nbsp;&nbsp;</b></font>
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2" color="#000000"> Follow this procedure carefully. A fixed extent size may be inadvertently cleared when the reservation is changed. </font>
<hr noshade size="2" width="100%" color="#000000">
</ol>



<h2><font face="Arial, Helvetica, Geneva, sansserif, sans serif, Verdana" size="3" color="#000000"><a name="122666"></a>Space Reservation</font>
</h2>
 
<p>
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2"><a name="122667"></a>Storage can be reserved for a file at any time. When a <font face="Courier New, Courier, sansserif, sans serif" size="2">VX_SETEXT</font> ioctl is issued, the reservation value is set in the inode on disk. If the file size is less than the reservation amount, the kernel allocates space to the file from the current file size up to the reservation amount. When the file is truncated, space below the reserved amount is not freed. The <font face="Courier New, Courier, sansserif, sans serif" size="2">VX_TRIM</font>, <font face="Courier New, Courier, sansserif, sans serif" size="2">VX_NOEXTEND</font>, <font face="Courier New, Courier, sansserif, sans serif" size="2">VX_CHGSIZE</font>, <font face="Courier New, Courier, sansserif, sans serif" size="2">VX_NORESERVE</font> and <font face="Courier New, Courier, sansserif, sans serif" size="2">VX_CONTIGUOUS</font> flags can be used to modify reservation requests.</font>
</p>

<hr noshade size="2" width="100%" color="#000000">
<img src="images/note.gif" alt="Note " height="16" width="16">&nbsp;
<font face="Arial, Helvetica, Geneva, sansserif, sans serif, Verdana" size="2" color="#000000">
<a name="122673"></a><b>Note  &nbsp;&nbsp;</b>
</font>
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2" color="#000000"><font face="Courier New, Courier, sansserif, sans serif" size="2">VX_NOEXTEND</font> is the only one of these flags that is persistent; the other flags may have persistent effects, but they are not returned by the <font face="Courier New, Courier, sansserif, sans serif" size="2">VX_GETEXT</font> ioctl.
</font>
<hr noshade size="2" width="100%" color="#000000">
<p>
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2"><a name="122674"></a>If the <font face="Courier New, Courier, sansserif, sans serif" size="2">VX_TRIM</font> flag is set, when the last close occurs on the inode, the reservation is trimmed to match the file size and the <font face="Courier New, Courier, sansserif, sans serif" size="2">VX_TRIM</font> flag is cleared. Any unused space is freed. This can be useful if an application needs enough space for a file, but it is not known how large the file will become. Enough space can be reserved to hold the largest expected file, and when the file has been written and closed, any extra space will be released.</font>
</p>

<p>
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2"><a name="122675"></a>If the <font face="Courier New, Courier, sansserif, sans serif" size="2">VX_NOEXTEND</font> flag is set, an attempt to write beyond the current reservation, which requires the allocation of new space for the file, fails instead. To allocate new space to the file, the space reservation must be increased. This can be used like <font face="Courier New, Courier, sansserif, sans serif" size="2">ulimit</font> to prevent a file from using too much space.</font>
</p>

<p>
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2"><a name="122676"></a>If the <font face="Courier New, Courier, sansserif, sans serif" size="2">VX_CONTIGUOUS</font> flag is set, any space allocated to satisfy the current reservation request is allocated in one extent. If there is not one extent large enough to satisfy the request, the request fails. For example, if a file is created and a 1 MB contiguous reservation is requested, the file size is set to zero and the reservation to 1 MB. The file will have one extent that is 1 MB long. If another reservation request is made for a 3 MB contiguous reservation, the new request will find that the first 1 MB is already allocated and allocate a 2 MB extent to satisfy the request. If there are no 2 MB extents available, the request fails. Extents are, by definition, contiguous.</font>
</p>

<hr noshade size="2" width="100%" color="#000000">
<img src="images/note.gif" alt="Note " height="16" width="16">&nbsp;
<font face="Arial, Helvetica, Geneva, sansserif, sans serif, Verdana" size="2" color="#000000">
<a name="130180"></a><b>Note  &nbsp;&nbsp;</b>
</font>
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2" color="#000000">Because <font face="Courier New, Courier, sansserif, sans serif" size="2">VX_CONTIGUOUS</font> is not a persistent flag, space will not be allocated contiguously after doing a file system restore.
</font>
<hr noshade size="2" width="100%" color="#000000">
<p>
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2"><a name="130182"></a>If the <font face="Courier New, Courier, sansserif, sans serif" size="2">VX_NORESERVE</font> flag is set, the reservation value in the inode is not changed. This flag is used by applications to do temporary reservation. Any space past the end of the file is given up when the file is closed. For example, if the <font face="Courier New, Courier, sansserif, sans serif" size="2">cp</font> command is copying a file that is 1 MB long, it can request a 1 MB reservation with the <font face="Courier New, Courier, sansserif, sans serif" size="2">VX_NORESERVE</font> flag set. The space is allocated, but the reservation in the file is left at 0. If the program aborts for any reason or the system crashes, the unused space past the end of the file is released. When the program finishes, there is no cleanup because the reservation was never recorded on disk.</font>
</p>

<p>
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2"><a name="122680"></a>If the <font face="Courier New, Courier, sansserif, sans serif" size="2">VX_CHGSIZE</font> flag is set, the file size is increased to match the reservation amount. This flag can be used to create files with uninitialized data. Because this allows uninitialized data in files, it is restricted to users with appropriate privileges.</font>
</p>

<p>
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2"><a name="122681"></a>It is possible to use these flags in combination. For example, using <font face="Courier New, Courier, sansserif, sans serif" size="2">VX_CHGSIZE</font> and <font face="Courier New, Courier, sansserif, sans serif" size="2">VX_NORESERVE</font> changes the file size but does not set any reservation. When the file is truncated, the space is freed. If the <font face="Courier New, Courier, sansserif, sans serif" size="2">VX_NORESERVE</font> flag had not been used, the reservation would have been set on disk along with the file size.</font>
</p>

<p>
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2"><a name="122682"></a>Space reservation is used to make sure applications do not fail because the file system is out of space. An application can preallocate space for all the files it needs before starting to do any work. By allocating space in advance, the file is optimally allocated for performance, and file accesses are not slowed down by the need to allocate storage. This allocation of resources can be important in applications that require a guaranteed response time.</font>
</p>

<p>
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2"><a name="122683"></a>With very large files, use of space reservation can avoid the need to use indirect extents. It can also improve performance and reduce fragmentation by guaranteeing that the file consists of large contiguous extents. Sometimes when critical file systems run out of space, <font face="Courier New, Courier, sansserif, sans serif" size="2">cron</font> jobs, mail, or printer requests fail. These failures are harder to track if the logs kept by the application cannot be written due to a lack of space on the file system. </font>
</p>

<p>
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2"><a name="122684"></a>By reserving space for key log files, the logs will not fail when the system runs out of space. Process accounting files can also have space reserved so accounting records will not be lost if the file system runs out of space. In addition, by using the <font face="Courier New, Courier, sansserif, sans serif" size="2">VX_NOEXTEND</font> flag for log files, the maximum size of these files can be limited. This can prevent a runaway failure in one component of the system from filling the file system with error messages and causing other failures. If the <font face="Courier New, Courier, sansserif, sans serif" size="2">VX_NOEXTEND</font> flag is used for log files, the logs should be cleaned up before they reach the size limit in order to avoid losing information. </font>
</p>




<h2><font face="Arial, Helvetica, Geneva, sansserif, sans serif, Verdana" size="3" color="#000000"><a name="122692"></a>Fixed Extent Sizes</font>
</h2>
 
<p>
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2"><a name="122693"></a>VxFS uses the I/O size of write requests, and a default policy, when allocating space to a file. For some applications, this may not work out well. These applications can set a fixed extent size, so that all new extents allocated to the file are of the fixed extent size.</font>
</p>

<p>
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2"><a name="122694"></a>By using a fixed extent size, an application can reduce allocations and guarantee good extent sizes for a file. An application can reserve most of the space a file needs, and then set a relatively large fixed extent size. If the file grows beyond the reservation, any new extents are allocated in the fixed extent size.</font>
</p>

<p>
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2"><a name="122697"></a>Another use of a fixed extent size occurs with sparse files. The file system usually does I/O in page size multiples. When allocating to a sparse file, the file system allocates pages as the smallest default unit. If the application always does sub-page I/O, it can request a fixed extent size to match its I/O size and avoid wasting extra space.</font>
</p>

<p>
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2"><a name="122698"></a>When setting a fixed extent size, an application should not select too large a size. When all extents of the required size have been used, attempts to allocate new extents fail: this failure can happen even though there are blocks free in smaller extents.</font>
</p>

<p>
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2"><a name="122699"></a>Fixed extent sizes can be modified by the <font face="Courier New, Courier, sansserif, sans serif" size="2">VX_ALIGN</font> flag. If the <font face="Courier New, Courier, sansserif, sans serif" size="2">VX_ALIGN</font> flag is set, then any future extents allocated to the file are aligned on a fixed extent size boundary relative to the start of the allocation unit. This can be used to align extents to disk striping boundaries or physical disk boundaries.</font>
</p>

<p>
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="2"><a name="122700"></a>The <font face="Courier New, Courier, sansserif, sans serif" size="2">VX_ALIGN</font> flag is persistent and is returned by the <font face="Courier New, Courier, sansserif, sans serif" size="2">VX_GETEXT</font> ioctl.</font>
</p>


<!-- End Main Topic Content -->

   </td>
  </tr>
 </table>
</div>

<div>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
 <tr>
  <td height="18" border="0" cellspacing="0" cellpadding="0" colspan="2" bgcolor="#FFFFFF">
  </td>
 </tr>
  <td align="left"><font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="-2">&nbsp;&#94;&nbsp;<a href="04_app_interface_vxfs40_135687.html" title="Extent Information">Return to Top</a></font>

  </td>
  <td align="right"><font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="-2">&lt;&nbsp;<a href="04_app_interface_vxfs39_122558.html" title="Previous - Cache Advisories">Previous</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="04_app_interface_vxfs41_122703.html" title="Next - Freeze and Thaw">Next</a>
&nbsp;&gt;&nbsp;&nbsp;</font>
  </td>
 <tr>
   <td height="9" border="0" cellspacing="0" cellpadding="0" colspan="2" bgcolor="#FFFFFF">
   </td>
 </tr>

<!-- Footer Breadcrumbs -->
<tr>
<td bgcolor="#FFFFFF" colspan="2" height="15" align="right">
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="1">Product:  
<a href="vxfs_splashpage_docCD_vxfs1_103036.vxhd" title="File System Guides title page ">File System Guides</a>&nbsp;&nbsp;</font></td>
</tr>

<tr>
<td bgcolor="#FFFFFF" colspan="2" height="15" align="right">
<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="1">Manual:  
<a href="vxfs_admin_titlepage_docCD_vxfs2_73700.vxhd" title="File System 4.1 Administrator's Guide title page ">File System 4.1 Administrator's Guide</a>&nbsp;&nbsp;</font></td>
</tr>


 <tr>
  <td colspan="2" align="left"><font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" color="#000000" align="right" size="-2">
<em>VERITAS Software Corporation
</em></font><br>

<font face="Verdana, Arial, Helvetica, Geneva, sansserif, sans serif" size="-2">www.veritas.com</font><br>
  </td>
 </tr>
</table>
</div>

</BODY>
  <!--
    *************************************************************************************
    * Copyright (c) 2005 VERITAS Software Corporation. All rights reserved. *

    VERITAS, VERITAS SOFTWARE, the VERITAS Logo, and VERITAS Software Documentation 
    are trademarks or registered trademarks of VERITAS Software Corporation 
    or its affiliates in the U.S. and other countries. Other names may be 
    trademarks of their respective owners. 

    Apache Jakarta Lucene:
    Apache Software License
    Version 1.1

    Copyright (c) 2000 The Apache Software Foundation. All rights reserved.

    Redistribution and use in source and binary forms, with or without modification, 
    are permitted provided that the following conditions are met:

    1. Redistributions of source code must retain the above copyright notice, this 
    list of conditions and the following disclaimer.

    2. Redistributions in binary form must reproduce the above copyright notice, this 
    list of conditions and the following disclaimer in the documentation and/or other 
    materials provided with the distribution.

    3. The end-user documentation included with the redistribution, if any, must include 
    the following acknowledgment: "This product includes software developed by the Apache 
    Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may 
    appear in the software itself, if and wherever such third-party acknowledgments 
    normally appear.

    4. The names "Apache" and "Apache Software Foundation" must not be used to endorse or 
    promote products derived from this software without prior written permission. For 
    written permission, please contact apache@apache.org.

    5. Products derived from this software may not be called "Apache", nor may "Apache" 
    appear in their name, without prior written permission of the Apache Software Foundation.

    THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, 
    BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 
    PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION 
    OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 
    OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 
    OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 
    ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
    NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
    ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

    This software consists of voluntary contributions made by many individuals on behalf 
    of the Apache Software Foundation. For more information on the Apache Software Foundation, 
    please see <http://www.apache.org/>. Portions of this software are based upon public domain 
    software originally written at the National Center for Supercomputing Applications, University 
    of Illinois, Urbana-Champaign.
    
    This product includes WebWindow Software developed by Horst Heistermann.
    *************************************************************************************
  -->
</HTML>
