xfs: current patch queue for 3.11
Subsystems (2)
cover xfs: current patch queue for 3.11
Hi folks,
This is an update of my current patch queue for the 3.11 release cycle. This series starts on top of the patch series I posted for 3.10-rc6, and builds upon the series previously posted last week:
http://oss.sgi.com/pipermail/xfs/2013-June/027040.html
The additions to the series since then are basically for making kernel/userspace code synchronisation much, much easier. it mostly consists of splitting code into shared and kernel-only files, both header and c files. Hence the majority of the diffstat comes from moving code between files, not actually modifying them. The diffstat looks a lot more frightening than it really is.
The result is, however, a massive reduction in the diff between the shared files:
~/src/xfsprogs-dev$ for f in libxfs/xfs_*.c include/xfs_*h; do \
Quoted 2 lines
echo $f; diff -u $f ../kern/xfsdev/fs/xfs/
basename $fdone |diffstat
diff: ../kern/xfsdev/fs/xfs/xfs_arch.h: No such file or directory
diff: ../kern/xfsdev/fs/xfs/xfs_btree_trace.h: No such file or directory
diff: ../kern/xfsdev/fs/xfs/xfs_metadump.h: No such file or directory
xfs_alloc.c | 29 xfs_alloc_btree.c | 95 -- xfs_attr.c | 27 xfs_attr_leaf.c | 29 xfs_attr_remote.c | 26 xfs_bmap.c | 270 ++++++ xfs_bmap_btree.c | 122 --- xfs_btree.c | 65 + xfs_btree.h | 38 xfs_da_btree.c | 27 xfs_dir2.c | 23 xfs_dir2_block.c | 25 xfs_dir2_data.c | 23 xfs_dir2_leaf.c | 23 xfs_dir2_node.c | 22 xfs_dir2_sf.c | 20 xfs_ialloc.c | 26 xfs_ialloc_btree.c | 95 -- xfs_inode.c | 35 xfs_rtalloc.c | 1602 ++++++++++++++++++++++++++++++++++++++++- xfs_sb.c | 64 + xfs_symlink.c | 560 ++++++++++++++ xfs_trace.h | 2058 +++++++++++++++++++++++++++++++++++++++++++++++++---- xfs_trans_resv.c | 30 24 files changed, 4837 insertions(+), 497 deletions(-)
Without the matching userspace patchset, the kernel/user diffstat comes out at:
45 files changed, 8336 insertions(+), 2406 deletions(-)
in which xfs_rtalloc.c, xfs_symlink.c and xfs_trace.h are unchanged.
So if we ignore xfs_trace.h as there is nothing common between user and kernel space there, xfs_symlink as it only has a some kernel-only functions at it's tail and xfs_rtalloc.c as I haven't touched it at all, then the remaining diffstat between user and kernel space is roughly +775/-300 lines, and most of that is in differences in #include lines at the top of each file.
The generic btree code differs in tracing stubs (low priority so been waiting for years to be fixed), and the xfs-bmap.c code differences are a couple of kernel functions, mostly xfs_bmap_finish() and xfs_bmap_rtalloc(). There's some more work that can be done, esp. w.r.t xfs_symlink.c and the rtalloc code that will reduce this even further.
IOWs, compared to before these patches, there's almost no difference at all. This is going to make user/kernel syncs a whole lot easier, and it's already found a lot of little differences that have been previously been missed when syncing the userspace code.
The last couple of patches also fix minor whitespace and comment differences noticed in the userspace code, and also fix all the situations where the userspace code triggeres compiler warnings that the kernel has turned off. With the userspace patch set, we end up with a clean, warning free compile on my build machines.
Thoughts, comments, flames?
Cheers,
Dave.
Documentation/filesystems/xfs.txt | 282 ++-- fs/xfs/Makefile | 13 +- fs/xfs/xfs_acl.c | 3 +- fs/xfs/xfs_aops.c | 81 +- fs/xfs/xfs_attr.c | 390 +----- fs/xfs/xfs_attr.h | 9 + fs/xfs/xfs_attr_inactive.c | 454 +++++++ fs/xfs/xfs_attr_leaf.c | 656 +-------- fs/xfs/xfs_attr_leaf.h | 2 + fs/xfs/xfs_attr_list.c | 655 +++++++++ fs/xfs/xfs_attr_remote.c | 17 +- fs/xfs/xfs_bmap.c | 559 ++------ fs/xfs/xfs_bmap.h | 10 +- fs/xfs/xfs_bmap_btree.c | 4 +- fs/xfs/xfs_btree.h | 2 - fs/xfs/xfs_buf.c | 1 + fs/xfs/xfs_buf_item.c | 87 +- fs/xfs/xfs_buf_item.h | 4 +- fs/xfs/xfs_da_btree.c | 6 +- fs/xfs/xfs_dfrag.c | 1 - fs/xfs/xfs_dir2.c | 35 - fs/xfs/xfs_dir2.h | 74 + fs/xfs/xfs_dir2_block.c | 120 +- fs/xfs/xfs_dir2_data.c | 1 + fs/xfs/xfs_dir2_format.h | 27 +- fs/xfs/xfs_dir2_leaf.c | 389 +----- fs/xfs/xfs_dir2_node.c | 3 + fs/xfs/xfs_dir2_priv.h | 33 +- fs/xfs/xfs_dir2_readdir.c | 661 +++++++++ fs/xfs/xfs_dir2_sf.c | 103 +- fs/xfs/xfs_discard.c | 1 + fs/xfs/xfs_export.c | 1 - fs/xfs/xfs_extent_ops.c | 1054 +++++++++++++++ fs/xfs/xfs_extent_ops.h | 30 + fs/xfs/xfs_file.c | 5 +- fs/xfs/xfs_fs.h | 17 + fs/xfs/xfs_ialloc.c | 69 +- fs/xfs/xfs_ialloc.h | 8 + fs/xfs/xfs_icache.c | 1 - fs/xfs/xfs_icreate_item.c | 195 +++ fs/xfs/xfs_icreate_item.h | 56 + fs/xfs/xfs_inode.c | 2596 ++++++----------------------------- fs/xfs/xfs_inode.h | 341 +---- fs/xfs/xfs_inode_ops.c | 2844 +++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_inode_ops.h | 371 +++++ fs/xfs/xfs_ioctl.c | 37 +- fs/xfs/xfs_ioctl.h | 6 + fs/xfs/xfs_ioctl32.c | 1 - fs/xfs/xfs_iomap.c | 13 + fs/xfs/xfs_iops.c | 3 +- fs/xfs/xfs_iops.h | 13 + fs/xfs/xfs_itable.c | 3 + fs/xfs/xfs_log.c | 21 +- fs/xfs/xfs_log.h | 5 +- fs/xfs/xfs_log_cil.c | 75 +- fs/xfs/xfs_log_recover.c | 116 +- fs/xfs/xfs_mount.c | 828 ++---------- fs/xfs/xfs_mount.h | 63 +- fs/xfs/xfs_quotaops.c | 1 + fs/xfs/xfs_rename.c | 1 - fs/xfs/xfs_rtalloc.c | 4 +- fs/xfs/xfs_sb.c | 714 ++++++++++ fs/xfs/xfs_sb.h | 26 + fs/xfs/xfs_super.c | 9 +- fs/xfs/xfs_symlink.h | 3 +- fs/xfs/xfs_trace.h | 4 + fs/xfs/xfs_trans.c | 618 +-------- fs/xfs/xfs_trans.h | 92 +- fs/xfs/xfs_trans_buf.c | 34 +- fs/xfs/xfs_trans_priv.h | 3 + fs/xfs/xfs_trans_resv.c | 705 ++++++++++ fs/xfs/xfs_trans_resv.h | 135 ++ fs/xfs/xfs_types.h | 3 +- fs/xfs/xfs_vnodeops.c | 1874 -------------------------- fs/xfs/xfs_vnodeops.h | 56 - fs/xfs/xfs_xattr.c | 1 - 76 files changed, 9378 insertions(+), 8360 deletions(-) create mode 100644 fs/xfs/xfs_attr_inactive.c create mode 100644 fs/xfs/xfs_attr_list.c create mode 100644 fs/xfs/xfs_dir2_readdir.c create mode 100644 fs/xfs/xfs_extent_ops.c create mode 100644 fs/xfs/xfs_extent_ops.h create mode 100644 fs/xfs/xfs_icreate_item.c create mode 100644 fs/xfs/xfs_icreate_item.h create mode 100644 fs/xfs/xfs_inode_ops.c create mode 100644 fs/xfs/xfs_inode_ops.h create mode 100644 fs/xfs/xfs_sb.c create mode 100644 fs/xfs/xfs_trans_resv.c create mode 100644 fs/xfs/xfs_trans_resv.h delete mode 100644 fs/xfs/xfs_vnodeops.c delete mode 100644 fs/xfs/xfs_vnodeops.h
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 1/27 xfs: update mount options documentation
From: Dave Chinner <[email protected]>
Because it's horribly out of date.
And mark various deprecated options as deprecated and give them a removal date.
--- Documentation/filesystems/xfs.txt | 282 +++++++++++++++++++++++++------------ 1 file changed, 192 insertions(+), 90 deletions(-)
Documentation/filesystems/xfs.txt +192 -90
@@ -25,6 +25,13 @@ When mounting an XFS filesystem, the following options are accepted. Valid values for this option are page size (typically 4KiB) through to 1GiB, inclusive, in power-of-2 increments. + The default behaviour is for dynamic end-of-file + preallocation size, which uses a set of heuristics to + optimise the preallocation size based on the current + allocation patterns within the file and the access patterns + to the file. Specifying a fixed allocsize value turns off + the dynamic behaviour. + attr2/noattr2 The options enable/disable (default is disabled for backward compatibility on-disk) an "opportunistic" improvement to be
@@ -36,86 +43,108 @@ When mounting an XFS filesystem, the following options are accepted. CRC enabled filesystems always use the attr2 format, and so will reject the noattr2 mount option if it is set. - barrier - Enables the use of block layer write barriers for writes into - the journal and unwritten extent conversion. This allows for - drive level write caching to be enabled, for devices that - support write barriers. + barrier/nobarrier + Enables/disables the use of block layer write barriers for + writes into the journal and for data integrity operations. + This allows for drive level write caching to be enabled, for + devices that support write barriers. - discard - Issue command to let the block device reclaim space freed by the - filesystem. This is useful for SSD devices, thinly provisioned - LUNs and virtual machine images, but may have a performance - impact. + The default behaviour is to enable barriers. - dmapi - Enable the DMAPI (Data Management API) event callouts. - Use with the "mtpt" option. + discard/nodiscard - grpid/bsdgroups and nogrpid/sysvgroups - These options define what group ID a newly created file gets. - When grpid is set, it takes the group ID of the directory in - which it is created; otherwise (the default) it takes the fsgid - of the current process, unless the directory has the setgid bit - set, in which case it takes the gid from the parent directory, - and also gets the setgid bit set if it is a directory itself. + Enable/disable the issuing of commands to let the block + device reclaim space freed by the filesystem. This is + useful for SSD devices, thinly provisioned LUNs and virtual + machine images, but may have a performance impact. - ihashsize=value - In memory inode hashes have been removed, so this option has - no function as of August 2007. Option is deprecated. + The default behaviour is disable discard commands. + + Note: It is currently recommended that you use the fstrim + application to discard unused blocks rather than the discard + mount option because the performance impact of this option + is quite severe. + + grpid/bsdgroups and nogrpid/sysvgroups + These options define what group ID a newly created file + gets. When grpid is set, it takes the group ID of the + directory in which it is created; otherwise (the default) it + takes the fsgid of the current process, unless the directory + has the setgid bit set, in which case it takes the gid from + the parent directory, and also gets the setgid bit set if it + is a directory itself. + + filestreams + Make the data allocator use the filestreams allocation mode + across the entire filesystem rather than just on directories + configured to use it. ikeep/noikeep - When ikeep is specified, XFS does not delete empty inode clusters - and keeps them around on disk. ikeep is the traditional XFS - behaviour. When noikeep is specified, empty inode clusters - are returned to the free space pool. The default is noikeep for - non-DMAPI mounts, while ikeep is the default when DMAPI is in use. + When ikeep is specified, XFS does not delete empty inode + clusters and keeps them around on disk. When noikeep is + specified, empty inode clusters are returned to the free + space pool. + + The default behaviour is delete inode clusters (noikeep). inode64 - Indicates that XFS is allowed to create inodes at any location - in the filesystem, including those which will result in inode - numbers occupying more than 32 bits of significance. This is - the default allocation option. Applications which do not handle - inode numbers bigger than 32 bits, should use inode32 option. + When inode64 is specified, it indicates that XFS is allowed + to create inodes at any location in the filesystem, + including those which will result in inode numbers occupying + more than 32 bits of significance. Applications which do + not handle inode numbers bigger than 32 bits should use + inode32 option. + + This is the default allocation behaviour, even on 32 bit + machines when neither inode64 or inode32 is specified. inode32 - Indicates that XFS is limited to create inodes at locations which - will not result in inode numbers with more than 32 bits of - significance. This is provided for backwards compatibility, since - 64 bits inode numbers might cause problems for some applications - that cannot handle large inode numbers. + When inode32 is specified, it indicates that XFS limits + inode creation to locations which will not result in inode + numbers with more than 32 bits of significance. This is + provided for backwards compatibility with older systems and + applications, since 64 bits inode numbers might cause + problems for some applications that cannot handle large + inode numbers. largeio/nolargeio If "nolargeio" is specified, the optimal I/O reported in - st_blksize by stat(2) will be as small as possible to allow user - applications to avoid inefficient read/modify/write I/O. - If "largeio" specified, a filesystem that has a "swidth" specified - will return the "swidth" value (in bytes) in st_blksize. If the - filesystem does not have a "swidth" specified but does specify - an "allocsize" then "allocsize" (in bytes) will be returned - instead. + st_blksize by stat(2) will be as small as possible to allow + user applications to avoid inefficient read/modify/write + I/O. This is typically the page size of the machine, as + this is the granularity of the page cache. + + If "largeio" specified, a filesystem that was created with a + "swidth" specified will return the "swidth" value (in bytes) + in st_blksize. If the filesystem does not have a "swidth" + specified but does specify an "allocsize" then "allocsize" + (in bytes) will be returned instead. Otherwise the behaviour + is the same as if "nolargeio" was specified. + If neither of these two options are specified, then filesystem will behave as if "nolargeio" was specified. logbufs=value - Set the number of in-memory log buffers. Valid numbers range - from 2-8 inclusive. - The default value is 8 buffers for filesystems with a - blocksize of 64KiB, 4 buffers for filesystems with a blocksize - of 32KiB, 3 buffers for filesystems with a blocksize of 16KiB - and 2 buffers for all other configurations. Increasing the - number of buffers may increase performance on some workloads - at the cost of the memory used for the additional log buffers - and their associated control structures. + Set the number of in-memory log buffers. Valid numbers + range from 2-8 inclusive. + + The default value is 8 buffers. + + If the memory cost of 8 log buffers is too high on small + systems, then it may be reduced at some cost to performance + on metadata intensive workloads. logbsize=value - Set the size of each in-memory log buffer. - Size may be specified in bytes, or in kilobytes with a "k" suffix. - Valid sizes for version 1 and version 2 logs are 16384 (16k) and - 32768 (32k). Valid sizes for version 2 logs also include - 65536 (64k), 131072 (128k) and 262144 (256k). - The default value for machines with more than 32MiB of memory - is 32768, machines with less memory use 16384 by default. + Set the size of each in-memory log buffer. The size may be + specified in bytes, or in kilobytes with a "k" suffix. + Valid sizes for version 1 and version 2 logs are 16384 (16k) + and 32768 (32k). Valid sizes for version 2 logs also + include 65536 (64k), 131072 (128k) and 262144 (256k). The + version 2 log size must be an integer multiple of the log + stripe unit configured at mkfs time. + + The default value for for version 1 logs is 32768, while the + default value for version 2 logs is MAX(32768, log_sunit). logdev=device and rtdev=device Use an external log (metadata journal) and/or real-time device.
@@ -124,16 +153,12 @@ When mounting an XFS filesystem, the following options are accepted. optional, and the log section can be separate from the data section or contained within it. - mtpt=mountpoint - Use with the "dmapi" option. The value specified here will be - included in the DMAPI mount event, and should be the path of - the actual mountpoint that is used. - noalign - Data allocations will not be aligned at stripe unit boundaries. - noatime - Access timestamps are not updated when a file is read. + Data allocations will not be aligned at stripe unit + boundaries. This is only relevant to filesystems created + with non-zero data alignment parameters (sunit, swidth) by + mkfs. norecovery The filesystem will be mounted without running log recovery.
@@ -144,8 +169,14 @@ When mounting an XFS filesystem, the following options are accepted. the mount will fail. nouuid - Don't check for double mounted file systems using the file system uuid. - This is useful to mount LVM snapshot volumes. + Don't check for double mounted file systems using the file + system uuid. This is useful to mount LVM snapshot volumes, + and often used in combination with "norecovery" for mounting + read-only snapshots. + + noquota + Forcibly turns off all quota accounting and enforcement + within the filesystem. uquota/usrquota/uqnoenforce/quota User disk quota accounting enabled, and limits (optionally)
@@ -160,24 +191,68 @@ When mounting an XFS filesystem, the following options are accepted. enforced. Refer to xfs_quota(8) for further details. sunit=value and swidth=value - Used to specify the stripe unit and width for a RAID device or - a stripe volume. "value" must be specified in 512-byte block - units. - If this option is not specified and the filesystem was made on - a stripe volume or the stripe width or unit were specified for - the RAID device at mkfs time, then the mount system call will - restore the value from the superblock. For filesystems that - are made directly on RAID devices, these options can be used - to override the information in the superblock if the underlying - disk layout changes after the filesystem has been created. - The "swidth" option is required if the "sunit" option has been - specified, and must be a multiple of the "sunit" value. + Used to specify the stripe unit and width for a RAID device + or a stripe volume. "value" must be specified in 512-byte + block units. These options are only relevant to filesystems + that were created with non-zero data alignment parameters. + + The sunit and swidth parameters specified must be compatible + with the existing filesystem alignment characteristics. If + the filesystem was not created with data alignment + constraints, then it may be impossible to set a valid sunit + (and hence swidth) value. In general, that means the only + valid changes to sunit are increasing it by a power-of-2 + multiple. Valid swidth values are any integer multiple of a + valid sunit value. + + For filesystems that have existing data alignment values on + disk (i.e. specified by mkfs), any new valid values passed + in as mount options will overwrite the values stored on + disk. Hence this mount option does not need to be specified + for every mount operation in this case. swalloc Data allocations will be rounded up to stripe width boundaries when the current end of file is being extended and the file size is larger than the stripe width size. + wsync + When specified, all filesystem namespace operations are + executed synchronously. This ensures that when the namespace + operation (create, unlink, etc) completes, the change to the + namespace is on stable storage. This is useful in HA setups + where failover must not result in clients seeing + inconsistent namespace presentation during or after a + failover event. + + +Deprecated Mount Options +======================== + + delaylog/nodelaylog + Delayed logging is the only logging method that XFS supports + now, so these mount options are now ignored. + + Due for removal in 3.12. + + ihashsize=value + In memory inode hashes have been removed, so this option has + no function as of August 2007. Option is deprecated. + + Due for removal in 3.12. + + irixsgid + This behaviour is now controlled by a sysctl, so the mount + option is ignored. + + Due for removal in 3.12. + + osyncisdsync + osyncisosync + O_SYNC and O_DSYNC are fully supported, so there is no need + for these options any more. + + Due for removal in 3.12. sysctls =======
@@ -189,15 +264,20 @@ The following sysctls are available for the XFS filesystem: in /proc/fs/xfs/stat. It then immediately resets to "0". fs.xfs.xfssyncd_centisecs (Min: 100 Default: 3000 Max: 720000) - The interval at which the xfssyncd thread flushes metadata - out to disk. This thread will flush log activity out, and - do some processing on unlinked inodes. + The interval at which the filesystem flushes metadata + out to disk and runs internal cache cleanup routines. - fs.xfs.xfsbufd_centisecs (Min: 50 Default: 100 Max: 3000) - The interval at which xfsbufd scans the dirty metadata buffers list. + fs.xfs.filestream_centisecs (Min: 1 Default: 3000 Max: 360000) + The interval at which the filesystem ages filestreams cache + references and returns timed-out AGs back to the free stream + pool. - fs.xfs.age_buffer_centisecs (Min: 100 Default: 1500 Max: 720000) - The age at which xfsbufd flushes dirty metadata buffers to disk. + fs.xfs.speculative_prealloc_lifetime + (Units: seconds Min: 1 Default: 300 Max: 86400) + The interval at which the background scanning for inodes + with unused speculative preallocation runs at. The scan + removes unused preallocation from clean inodes and releases + the unused space back to the free pool. fs.xfs.error_level (Min: 0 Default: 3 Max: 11) A volume knob for error reporting when internal errors occur.
@@ -254,9 +334,31 @@ The following sysctls are available for the XFS filesystem: by the xfs_io(8) chattr command on a directory to be inherited by files in that directory. + fs.xfs.inherit_nodefrag (Min: 0 Default: 1 Max: 1) + Setting this to "1" will cause the "nodefrag" flag set + by the xfs_io(8) chattr command on a directory to be + inherited by files in that directory. + fs.xfs.rotorstep (Min: 1 Default: 1 Max: 256) In "inode32" allocation mode, this option determines how many files the allocator attempts to allocate in the same allocation group before moving to the next allocation group. The intent is to control the rate at which the allocator moves between allocation groups when allocating extents for new files. + +Deprecated Sysctls +================== + + fs.xfs.xfsbufd_centisecs (Min: 50 Default: 100 Max: 3000) + Dirty metadata is now tracked by the log subsystem and + flushing is driven by log space and idling demands. The + xfsbufd no longer exists, so this syctl does nothing. + + Due for removal in 3.14. + + fs.xfs.age_buffer_centisecs (Min: 100 Default: 1500 Max: 720000) + Dirty metadata is now tracked by the log subsystem and + flushing is driven by log space and idling demands. The + xfsbufd no longer exists, so this syctl does nothing. + + Due for removal in 3.14.
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 01/27] xfs: update mount options documentation
Quoted 6 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Because it's horribly out of date.
And mark various deprecated options as deprecated and give them a removal date.
thanks for doing this. some nitpicks below.
Quoted 51 lines
Signed-off-by Dave Chinner <[email protected]>--- Documentation/filesystems/xfs.txt | 282 +++++++++++++++++++++++++------------ 1 file changed, 192 insertions(+), 90 deletions(-)Documentation/filesystems/xfs.txt +14
-14@@ -25,6 +25,13 @@ When mounting an XFS filesystem, the following options are accepted. Valid values for this option are page size (typically 4KiB) through to 1GiB, inclusive, in power-of-2 increments. + The default behaviour is for dynamic end-of-file + preallocation size, which uses a set of heuristics to + optimise the preallocation size based on the current + allocation patterns within the file and the access patterns + to the file. Specifying a fixed allocsize value turns off + the dynamic behaviour. + attr2/noattr2 The options enable/disable (default is disabled for backward compatibility on-disk) an "opportunistic" improvement to be@@ -36,86 +43,108 @@ When mounting an XFS filesystem, the following options are accepted. CRC enabled filesystems always use the attr2 format, and so will reject the noattr2 mount option if it is set. - barrier - Enables the use of block layer write barriers for writes into - the journal and unwritten extent conversion. This allows for - drive level write caching to be enabled, for devices that - support write barriers. + barrier/nobarrier + Enables/disables the use of block layer write barriers for + writes into the journal and for data integrity operations. + This allows for drive level write caching to be enabled, for + devices that support write barriers. - discard - Issue command to let the block device reclaim space freed by the - filesystem. This is useful for SSD devices, thinly provisioned - LUNs and virtual machine images, but may have a performance - impact. + The default behaviour is to enable barriers. - dmapi - Enable the DMAPI (Data Management API) event callouts. - Use with the "mtpt" option. + discard/nodiscard - grpid/bsdgroups and nogrpid/sysvgroups
Documentation/filesystems/xfs.txt When mounting an XFS filesystem, the following options are accepted. · line 59
Quoted 10 lines
Documentation/filesystems/xfs.txt +4
-6- These options define what group ID a newly created file gets. - When grpid is set, it takes the group ID of the directory in - which it is created; otherwise (the default) it takes the fsgid - of the current process, unless the directory has the setgid bit - set, in which case it takes the gid from the parent directory, - and also gets the setgid bit set if it is a directory itself. + Enable/disable the issuing of commands to let the block + device reclaim space freed by the filesystem. This is + useful for SSD devices, thinly provisioned LUNs and virtual + machine images, but may have a performance impact.
should we talk about fstrim as an alternative here?
Documentation/filesystems/xfs.txt When mounting an XFS filesystem, the following options are accepted. · line 66
Quoted 9 lines
Documentation/filesystems/xfs.txt +6
-3- ihashsize=value - In memory inode hashes have been removed, so this option has - no function as of August 2007. Option is deprecated. + The default behaviour is disable discard commands. + + Note: It is currently recommended that you use the fstrim + application to discard unused blocks rather than the discard + mount option because the performance impact of this option + is quite severe.
oh right!
Quoted 16 lines
Documentation/filesystems/xfs.txt +13
-1+ grpid/bsdgroups and nogrpid/sysvgroups + These options define what group ID a newly created file + gets. When grpid is set, it takes the group ID of the + directory in which it is created; otherwise (the default) it + takes the fsgid of the current process, unless the directory + has the setgid bit set, in which case it takes the gid from + the parent directory, and also gets the setgid bit set if it + is a directory itself. + + filestreams + Make the data allocator use the filestreams allocation mode + across the entire filesystem rather than just on directories + configured to use it. ikeep/noikeep - When ikeep is specified, XFS does not delete empty inode clusters
Documentation/filesystems/xfs.txt When mounting an XFS filesystem, the following options are accepted. · line 88
Quoted 10 lines
Documentation/filesystems/xfs.txt +6
-4- and keeps them around on disk. ikeep is the traditional XFS - behaviour. When noikeep is specified, empty inode clusters - are returned to the free space pool. The default is noikeep for - non-DMAPI mounts, while ikeep is the default when DMAPI is in use. + When ikeep is specified, XFS does not delete empty inode + clusters and keeps them around on disk. When noikeep is + specified, empty inode clusters are returned to the free + space pool. + + The default behaviour is delete inode clusters (noikeep).
is to delete inode clusters
Documentation/filesystems/xfs.txt When mounting an XFS filesystem, the following options are accepted. · line 96
Quoted 13 lines
Documentation/filesystems/xfs.txt +6
-5inode64 - Indicates that XFS is allowed to create inodes at any location - in the filesystem, including those which will result in inode - numbers occupying more than 32 bits of significance. This is - the default allocation option. Applications which do not handle - inode numbers bigger than 32 bits, should use inode32 option. + When inode64 is specified, it indicates that XFS is allowed + to create inodes at any location in the filesystem, + including those which will result in inode numbers occupying + more than 32 bits of significance. Applications which do + not handle inode numbers bigger than 32 bits should use + inode32 option.
While we're rewriting . . . applications don't use mount options, not really. So maybe:
If applications are in use which do not handle inode numbers bigger than 32 bits, the inode32 option should be specified.
Quoted 6 lines
Documentation/filesystems/xfs.txt +2
-2+ This is the default allocation behaviour, even on 32 bit + machines when neither inode64 or inode32 is specified. inode32 - Indicates that XFS is limited to create inodes at locations which - will not result in inode numbers with more than 32 bits of
Documentation/filesystems/xfs.txt When mounting an XFS filesystem, the following options are accepted. · line 108
Quoted 10 lines
Documentation/filesystems/xfs.txt +7
-3- significance. This is provided for backwards compatibility, since - 64 bits inode numbers might cause problems for some applications - that cannot handle large inode numbers. + When inode32 is specified, it indicates that XFS limits + inode creation to locations which will not result in inode + numbers with more than 32 bits of significance. This is + provided for backwards compatibility with older systems and + applications, since 64 bits inode numbers might cause + problems for some applications that cannot handle large + inode numbers.
Any point to talking about what this does to locality etc?
Quoted 13 lines
Documentation/filesystems/xfs.txt +4
-7largeio/nolargeio If "nolargeio" is specified, the optimal I/O reported in - st_blksize by stat(2) will be as small as possible to allow user - applications to avoid inefficient read/modify/write I/O. - If "largeio" specified, a filesystem that has a "swidth" specified - will return the "swidth" value (in bytes) in st_blksize. If the - filesystem does not have a "swidth" specified but does specify - an "allocsize" then "allocsize" (in bytes) will be returned - instead. + st_blksize by stat(2) will be as small as possible to allow + user applications to avoid inefficient read/modify/write + I/O. This is typically the page size of the machine, as + this is the granularity of the page cache.
Documentation/filesystems/xfs.txt When mounting an XFS filesystem, the following options are accepted. · line 125
Quoted 10 lines
Documentation/filesystems/xfs.txt +8
-0+ + If "largeio" specified, a filesystem that was created with a + "swidth" specified will return the "swidth" value (in bytes) + in st_blksize. If the filesystem does not have a "swidth" + specified but does specify an "allocsize" then "allocsize" + (in bytes) will be returned instead. Otherwise the behaviour + is the same as if "nolargeio" was specified. + If neither of these two options are specified, then filesystem will behave as if "nolargeio" was specified.
I have to wonder when anyone would want to use largeio. This doesn't tell me, either. ;)
I wonder if there's any clearer way to show defaults. Maybe:
largeio
nolargeio (*)
If "nolargeio" is specified, the optimal I/O reported in
...
Quoted 8 lines
Documentation/filesystems/xfs.txt +0
-7logbufs=value - Set the number of in-memory log buffers. Valid numbers range - from 2-8 inclusive. - The default value is 8 buffers for filesystems with a - blocksize of 64KiB, 4 buffers for filesystems with a blocksize - of 32KiB, 3 buffers for filesystems with a blocksize of 16KiB - and 2 buffers for all other configurations. Increasing the - number of buffers may increase performance on some workloads
Documentation/filesystems/xfs.txt When mounting an XFS filesystem, the following options are accepted. · line 135
Quoted 10 lines
Documentation/filesystems/xfs.txt +8
-2- at the cost of the memory used for the additional log buffers - and their associated control structures. + Set the number of in-memory log buffers. Valid numbers + range from 2-8 inclusive. + + The default value is 8 buffers. + + If the memory cost of 8 log buffers is too high on small + systems, then it may be reduced at some cost to performance + on metadata intensive workloads.
The logbsize option below controls the size of each buffer.
Quoted 5 lines
Documentation/filesystems/xfs.txt +0
-4logbsize=value - Set the size of each in-memory log buffer. - Size may be specified in bytes, or in kilobytes with a "k" suffix. - Valid sizes for version 1 and version 2 logs are 16384 (16k) and - 32768 (32k). Valid sizes for version 2 logs also include
Documentation/filesystems/xfs.txt When mounting an XFS filesystem, the following options are accepted. · line 144
Quoted 10 lines
Documentation/filesystems/xfs.txt +7
-3- 65536 (64k), 131072 (128k) and 262144 (256k). - The default value for machines with more than 32MiB of memory - is 32768, machines with less memory use 16384 by default. + Set the size of each in-memory log buffer. The size may be + specified in bytes, or in kilobytes with a "k" suffix. + Valid sizes for version 1 and version 2 logs are 16384 (16k) + and 32768 (32k). Valid sizes for version 2 logs also + include 65536 (64k), 131072 (128k) and 262144 (256k). The + version 2 log size must be an integer multiple of the log + stripe unit configured at mkfs time.
the version 2 log size, or logbsize?
Quoted 13 lines
Documentation/filesystems/xfs.txt +2
-4+ The default value for for version 1 logs is 32768, while the + default value for version 2 logs is MAX(32768, log_sunit). logdev=device and rtdev=device Use an external log (metadata journal) and/or real-time device.@@ -124,16 +153,12 @@ When mounting an XFS filesystem, the following options are accepted. optional, and the log section can be separate from the data section or contained within it. - mtpt=mountpoint - Use with the "dmapi" option. The value specified here will be - included in the DMAPI mount event, and should be the path of - the actual mountpoint that is used.
Documentation/filesystems/xfs.txt When mounting an XFS filesystem, the following options are accepted. · line 161
Quoted 10 lines
Documentation/filesystems/xfs.txt +4
-4- noalign - Data allocations will not be aligned at stripe unit boundaries. - noatime - Access timestamps are not updated when a file is read. + Data allocations will not be aligned at stripe unit + boundaries. This is only relevant to filesystems created + with non-zero data alignment parameters (sunit, swidth) by + mkfs.
why would I use this?
Quoted 29 lines
Documentation/filesystems/xfs.txt +8
-8norecovery The filesystem will be mounted without running log recovery.@@ -144,8 +169,14 @@ When mounting an XFS filesystem, the following options are accepted. the mount will fail. nouuid - Don't check for double mounted file systems using the file system uuid. - This is useful to mount LVM snapshot volumes. + Don't check for double mounted file systems using the file + system uuid. This is useful to mount LVM snapshot volumes, + and often used in combination with "norecovery" for mounting + read-only snapshots. + + noquota + Forcibly turns off all quota accounting and enforcement + within the filesystem. uquota/usrquota/uqnoenforce/quota User disk quota accounting enabled, and limits (optionally)@@ -160,24 +191,68 @@ When mounting an XFS filesystem, the following options are accepted. enforced. Refer to xfs_quota(8) for further details. sunit=value and swidth=value - Used to specify the stripe unit and width for a RAID device or - a stripe volume. "value" must be specified in 512-byte block - units. - If this option is not specified and the filesystem was made on - a stripe volume or the stripe width or unit were specified for - the RAID device at mkfs time, then the mount system call will
Documentation/filesystems/xfs.txt When mounting an XFS filesystem, the following options are accepted. · line 197
Quoted 10 lines
Documentation/filesystems/xfs.txt +4
-6- restore the value from the superblock. For filesystems that - are made directly on RAID devices, these options can be used - to override the information in the superblock if the underlying - disk layout changes after the filesystem has been created. - The "swidth" option is required if the "sunit" option has been - specified, and must be a multiple of the "sunit" value. + Used to specify the stripe unit and width for a RAID device + or a stripe volume. "value" must be specified in 512-byte + block units. These options are only relevant to filesystems + that were created with non-zero data alignment parameters.
(i.e. su/sw or sunit/swidth was specified at mkfs time).
Documentation/filesystems/xfs.txt When mounting an XFS filesystem, the following options are accepted. · line 206
Quoted 9 lines
Documentation/filesystems/xfs.txt +9
-0+ + The sunit and swidth parameters specified must be compatible + with the existing filesystem alignment characteristics. If + the filesystem was not created with data alignment + constraints, then it may be impossible to set a valid sunit + (and hence swidth) value. In general, that means the only + valid changes to sunit are increasing it by a power-of-2 + multiple. Valid swidth values are any integer multiple of a + valid sunit value.
now I'm confused. It's only relevant to a filesystem w/ geometry specified, but if it wasn't specified, it may be possible . . . ?
And if nothing was specified (i.e. 0 su/sw) then we can only increase that 0 by a power of 2?
Documentation/filesystems/xfs.txt When mounting an XFS filesystem, the following options are accepted. · line 212
Quoted 5 lines
Documentation/filesystems/xfs.txt +5
-0+ For filesystems that have existing data alignment values on + disk (i.e. specified by mkfs), any new valid values passed + in as mount options will overwrite the values stored on + disk. Hence this mount option does not need to be specified + for every mount operation in this case.
so I think this all needs to clarify whether it works on filesystems w/o existing geometry, or not. And "why you might want this" would be helpful too.
Quoted 51 lines
Documentation/filesystems/xfs.txt +37
-2swalloc Data allocations will be rounded up to stripe width boundaries when the current end of file is being extended and the file size is larger than the stripe width size. + wsync + When specified, all filesystem namespace operations are + executed synchronously. This ensures that when the namespace + operation (create, unlink, etc) completes, the change to the + namespace is on stable storage. This is useful in HA setups + where failover must not result in clients seeing + inconsistent namespace presentation during or after a + failover event. + + +Deprecated Mount Options +======================== + + delaylog/nodelaylog + Delayed logging is the only logging method that XFS supports + now, so these mount options are now ignored. + + Due for removal in 3.12. + + ihashsize=value + In memory inode hashes have been removed, so this option has + no function as of August 2007. Option is deprecated. + + Due for removal in 3.12. + + irixsgid + This behaviour is now controlled by a sysctl, so the mount + option is ignored. + + Due for removal in 3.12. + + osyncisdsync + osyncisosync + O_SYNC and O_DSYNC are fully supported, so there is no need + for these options any more. + + Due for removal in 3.12. sysctls =======@@ -189,15 +264,20 @@ The following sysctls are available for the XFS filesystem: in /proc/fs/xfs/stat. It then immediately resets to "0". fs.xfs.xfssyncd_centisecs (Min: 100 Default: 3000 Max: 720000) - The interval at which the xfssyncd thread flushes metadata - out to disk. This thread will flush log activity out, and
Documentation/filesystems/xfs.txt The following sysctls are available for the XFS filesystem: · line 273
Quoted 10 lines
Documentation/filesystems/xfs.txt +6
-3- do some processing on unlinked inodes. + The interval at which the filesystem flushes metadata + out to disk and runs internal cache cleanup routines. - fs.xfs.xfsbufd_centisecs (Min: 50 Default: 100 Max: 3000) - The interval at which xfsbufd scans the dirty metadata buffers list. + fs.xfs.filestream_centisecs (Min: 1 Default: 3000 Max: 360000) + The interval at which the filesystem ages filestreams cache + references and returns timed-out AGs back to the free stream + pool.
I bet Documentation/filesystem/xfs-filestreams.txt would be handy, but *shrug*
Documentation/filesystems/xfs.txt The following sysctls are available for the XFS filesystem: · line 278
Quoted 6 lines
Documentation/filesystems/xfs.txt +4
-2- fs.xfs.age_buffer_centisecs (Min: 100 Default: 1500 Max: 720000) - The age at which xfsbufd flushes dirty metadata buffers to disk. + fs.xfs.speculative_prealloc_lifetime + (Units: seconds Min: 1 Default: 300 Max: 86400) + The interval at which the background scanning for inodes + with unused speculative preallocation runs at. The scan
The interval at which the background scanning . . . runs. (no at.)
Quoted 28 lines
Documentation/filesystems/xfs.txt +14
-0+ removes unused preallocation from clean inodes and releases + the unused space back to the free pool. fs.xfs.error_level (Min: 0 Default: 3 Max: 11) A volume knob for error reporting when internal errors occur.@@ -254,9 +334,31 @@ The following sysctls are available for the XFS filesystem: by the xfs_io(8) chattr command on a directory to be inherited by files in that directory. + fs.xfs.inherit_nodefrag (Min: 0 Default: 1 Max: 1) + Setting this to "1" will cause the "nodefrag" flag set + by the xfs_io(8) chattr command on a directory to be + inherited by files in that directory. + fs.xfs.rotorstep (Min: 1 Default: 1 Max: 256) In "inode32" allocation mode, this option determines how many files the allocator attempts to allocate in the same allocation group before moving to the next allocation group. The intent is to control the rate at which the allocator moves between allocation groups when allocating extents for new files. + +Deprecated Sysctls +================== + + fs.xfs.xfsbufd_centisecs (Min: 50 Default: 100 Max: 3000) + Dirty metadata is now tracked by the log subsystem and + flushing is driven by log space and idling demands. The
Documentation/filesystems/xfs.txt The following sysctls are available for the XFS filesystem: · line 364
Quoted 10 lines
Documentation/filesystems/xfs.txt +10
-0+ xfsbufd no longer exists, so this syctl does nothing. + + Due for removal in 3.14. + + fs.xfs.age_buffer_centisecs (Min: 100 Default: 1500 Max: 720000) + Dirty metadata is now tracked by the log subsystem and + flushing is driven by log space and idling demands. The + xfsbufd no longer exists, so this syctl does nothing. + + Due for removal in 3.14.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 01/27] xfs: update mount options documentation
Quoted 9 lines · Eric Sandeen
Quoted 6 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Because it's horribly out of date.
And mark various deprecated options as deprecated and give them a removal date.
thanks for doing this. some nitpicks below.
....
Quoted 9 lines
Documentation/filesystems/xfs.txt When mounting an XFS filesystem, the following options are accepted. · line 59
Quoted 6 lines
Documentation/filesystems/xfs.txt +5
-0+ discard/nodiscard + Enable/disable the issuing of commands to let the block + device reclaim space freed by the filesystem. This is + useful for SSD devices, thinly provisioned LUNs and virtual + machine images, but may have a performance impact.should we talk about fstrim as an alternative here?
Quoted 11 lines
Documentation/filesystems/xfs.txt When mounting an XFS filesystem, the following options are accepted. · line 66
Quoted 9 lines
Documentation/filesystems/xfs.txt +6
-3- ihashsize=value - In memory inode hashes have been removed, so this option has - no function as of August 2007. Option is deprecated. + The default behaviour is disable discard commands. + + Note: It is currently recommended that you use the fstrim + application to discard unused blocks rather than the discard + mount option because the performance impact of this option + is quite severe.oh right!
patch obfuscation for the win!
Quoted 15 lines
Quoted 15 lines
Documentation/filesystems/xfs.txt +13
-0+ grpid/bsdgroups and nogrpid/sysvgroups + These options define what group ID a newly created file + gets. When grpid is set, it takes the group ID of the + directory in which it is created; otherwise (the default) it + takes the fsgid of the current process, unless the directory + has the setgid bit set, in which case it takes the gid from + the parent directory, and also gets the setgid bit set if it + is a directory itself. + + filestreams + Make the data allocator use the filestreams allocation mode + across the entire filesystem rather than just on directories + configured to use it.
Quoted 14 lines
Documentation/filesystems/xfs.txt When mounting an XFS filesystem, the following options are accepted. · line 88
Quoted 12 lines
ikeep/noikeep
Documentation/filesystems/xfs.txt +6
-5- When ikeep is specified, XFS does not delete empty inode clusters - and keeps them around on disk. ikeep is the traditional XFS - behaviour. When noikeep is specified, empty inode clusters - are returned to the free space pool. The default is noikeep for - non-DMAPI mounts, while ikeep is the default when DMAPI is in use. + When ikeep is specified, XFS does not delete empty inode + clusters and keeps them around on disk. When noikeep is + specified, empty inode clusters are returned to the free + space pool. + + The default behaviour is delete inode clusters (noikeep).is to delete inode clusters
*nod*
Quoted 18 lines
Quoted 4 lines
inode64Documentation/filesystems/xfs.txt +0
-1- Indicates that XFS is allowed to create inodes at any locationDocumentation/filesystems/xfs.txt When mounting an XFS filesystem, the following options are accepted. · line 96
Quoted 10 lines
Documentation/filesystems/xfs.txt +6
-4- in the filesystem, including those which will result in inode - numbers occupying more than 32 bits of significance. This is - the default allocation option. Applications which do not handle - inode numbers bigger than 32 bits, should use inode32 option. + When inode64 is specified, it indicates that XFS is allowed + to create inodes at any location in the filesystem, + including those which will result in inode numbers occupying + more than 32 bits of significance. Applications which do + not handle inode numbers bigger than 32 bits should use + inode32 option.While we're rewriting . . . applications don't use mount options, not really. So maybe:
Quoted 2 lines
If applications are in use which do not handle inode numbers bigger than 32 bits, the inode32 option should be specified.
Fair enough.
Quoted 4 lines
Quoted 4 lines
Documentation/filesystems/xfs.txt +2
-0+ This is the default allocation behaviour, even on 32 bit + machines when neither inode64 or inode32 is specified.
Quoted 15 lines
Documentation/filesystems/xfs.txt When mounting an XFS filesystem, the following options are accepted. · line 108
Quoted 13 lines
inode32Documentation/filesystems/xfs.txt +7
-5- Indicates that XFS is limited to create inodes at locations which - will not result in inode numbers with more than 32 bits of - significance. This is provided for backwards compatibility, since - 64 bits inode numbers might cause problems for some applications - that cannot handle large inode numbers. + When inode32 is specified, it indicates that XFS limits + inode creation to locations which will not result in inode + numbers with more than 32 bits of significance. This is + provided for backwards compatibility with older systems and + applications, since 64 bits inode numbers might cause + problems for some applications that cannot handle large + inode numbers.Any point to talking about what this does to locality etc?
No, not here. If we start talking about detailed impacts, then every second mount option needs huge amount more text. Detailed descriptions of impact on allocation strategies belongs in advanced user guides, not mount option documentation....
Quoted 19 lines
Quoted 19 lines
largeio/nolargeio
Documentation/filesystems/xfs.txt +9
-7If "nolargeio" is specified, the optimal I/O reported in - st_blksize by stat(2) will be as small as possible to allow user - applications to avoid inefficient read/modify/write I/O. - If "largeio" specified, a filesystem that has a "swidth" specified - will return the "swidth" value (in bytes) in st_blksize. If the - filesystem does not have a "swidth" specified but does specify - an "allocsize" then "allocsize" (in bytes) will be returned - instead. + st_blksize by stat(2) will be as small as possible to allow + user applications to avoid inefficient read/modify/write + I/O. This is typically the page size of the machine, as + this is the granularity of the page cache. + + If "largeio" specified, a filesystem that was created with a + "swidth" specified will return the "swidth" value (in bytes) + in st_blksize. If the filesystem does not have a "swidth" + specified but does specify an "allocsize" then "allocsize"
Quoted 8 lines
Documentation/filesystems/xfs.txt When mounting an XFS filesystem, the following options are accepted. · line 125
Quoted 5 lines
Documentation/filesystems/xfs.txt +3
-0+ (in bytes) will be returned instead. Otherwise the behaviour + is the same as if "nolargeio" was specified. + If neither of these two options are specified, then filesystem will behave as if "nolargeio" was specified.I have to wonder when anyone would want to use largeio. This doesn't tell me, either. ;)
When you want stat to return a stripe width as the optimal IO size so applications like cp can do large, aligned IOs....
Quoted 6 lines
I wonder if there's any clearer way to show defaults. Maybe:
largeio
nolargeio (*)
If "nolargeio" is specified, the optimal I/O reported in...
Yeah, that makes sense.
Quoted 9 lines
Quoted 9 lines
logbsize=value
Documentation/filesystems/xfs.txt +1
-7- Set the size of each in-memory log buffer. - Size may be specified in bytes, or in kilobytes with a "k" suffix. - Valid sizes for version 1 and version 2 logs are 16384 (16k) and - 32768 (32k). Valid sizes for version 2 logs also include - 65536 (64k), 131072 (128k) and 262144 (256k). - The default value for machines with more than 32MiB of memory - is 32768, machines with less memory use 16384 by default. + Set the size of each in-memory log buffer. The size may be
Quoted 8 lines
Documentation/filesystems/xfs.txt When mounting an XFS filesystem, the following options are accepted. · line 144
Quoted 6 lines
Documentation/filesystems/xfs.txt +6
-0+ specified in bytes, or in kilobytes with a "k" suffix. + Valid sizes for version 1 and version 2 logs are 16384 (16k) + and 32768 (32k). Valid sizes for version 2 logs also + include 65536 (64k), 131072 (128k) and 262144 (256k). The + version 2 log size must be an integer multiple of the log + stripe unit configured at mkfs time.the version 2 log size, or logbsize?
logbsize.
Quoted 18 lines
Quoted 18 lines
Documentation/filesystems/xfs.txt +2
-6+ The default value for for version 1 logs is 32768, while the + default value for version 2 logs is MAX(32768, log_sunit). logdev=device and rtdev=device Use an external log (metadata journal) and/or real-time device.@@ -124,16 +153,12 @@ When mounting an XFS filesystem, the following options are accepted. optional, and the log section can be separate from the data section or contained within it. - mtpt=mountpoint - Use with the "dmapi" option. The value specified here will be - included in the DMAPI mount event, and should be the path of - the actual mountpoint that is used. - noalign - Data allocations will not be aligned at stripe unit boundaries.
Quoted 8 lines
Documentation/filesystems/xfs.txt When mounting an XFS filesystem, the following options are accepted. · line 161
Quoted 6 lines
Documentation/filesystems/xfs.txt +4
-2- noatime - Access timestamps are not updated when a file is read. + Data allocations will not be aligned at stripe unit + boundaries. This is only relevant to filesystems created + with non-zero data alignment parameters (sunit, swidth) by + mkfs.why would I use this?
Explanation of "why" is not in the scope of this document. This is a "what" document.
Quoted 37 lines
Quoted 7 lines
Documentation/filesystems/xfs.txt +0
-6sunit=value and swidth=value - Used to specify the stripe unit and width for a RAID device or - a stripe volume. "value" must be specified in 512-byte block - units. - If this option is not specified and the filesystem was made on - a stripe volume or the stripe width or unit were specified for - the RAID device at mkfs time, then the mount system call willDocumentation/filesystems/xfs.txt When mounting an XFS filesystem, the following options are accepted. · line 197
Quoted 10 lines
Documentation/filesystems/xfs.txt +4
-6- restore the value from the superblock. For filesystems that - are made directly on RAID devices, these options can be used - to override the information in the superblock if the underlying - disk layout changes after the filesystem has been created. - The "swidth" option is required if the "sunit" option has been - specified, and must be a multiple of the "sunit" value. + Used to specify the stripe unit and width for a RAID device + or a stripe volume. "value" must be specified in 512-byte + block units. These options are only relevant to filesystems + that were created with non-zero data alignment parameters.(i.e. su/sw or sunit/swidth was specified at mkfs time).
Documentation/filesystems/xfs.txt When mounting an XFS filesystem, the following options are accepted. · line 206
Quoted 9 lines
Documentation/filesystems/xfs.txt +9
-0+ + The sunit and swidth parameters specified must be compatible + with the existing filesystem alignment characteristics. If + the filesystem was not created with data alignment + constraints, then it may be impossible to set a valid sunit + (and hence swidth) value. In general, that means the only + valid changes to sunit are increasing it by a power-of-2 + multiple. Valid swidth values are any integer multiple of a + valid sunit value.now I'm confused. It's only relevant to a filesystem w/ geometry specified, but if it wasn't specified, it may be possible . . . ?
And if nothing was specified (i.e. 0 su/sw) then we can only increase that 0 by a power of 2?
Quoted 9 lines
Documentation/filesystems/xfs.txt When mounting an XFS filesystem, the following options are accepted. · line 212
Quoted 5 lines
Documentation/filesystems/xfs.txt +5
-0+ For filesystems that have existing data alignment values on + disk (i.e. specified by mkfs), any new valid values passed + in as mount options will overwrite the values stored on + disk. Hence this mount option does not need to be specified + for every mount operation in this case.so I think this all needs to clarify whether it works on filesystems w/o existing geometry, or not. And "why you might want this" would be helpful too.
It's obviously too complex to explain everything in a short "what" description. I suspect that the best thing to do here is simply document it as a method of changing alignment for a device that has changed geometry such as a adding a disk to a MD RAID5 device. I'm going to drop any reference to sunit/swidth being zero because that case was a hack for fixing a CXFS client bug.
Quoted 12 lines
Quoted 12 lines
sysctls
=======Documentation/filesystems/xfs.txt +2
-3@@ -189,15 +264,20 @@ The following sysctls are available for the XFS filesystem: in /proc/fs/xfs/stat. It then immediately resets to "0". fs.xfs.xfssyncd_centisecs (Min: 100 Default: 3000 Max: 720000) - The interval at which the xfssyncd thread flushes metadata - out to disk. This thread will flush log activity out, and - do some processing on unlinked inodes. + The interval at which the filesystem flushes metadata + out to disk and runs internal cache cleanup routines.
Quoted 8 lines
Documentation/filesystems/xfs.txt The following sysctls are available for the XFS filesystem: · line 273
Quoted 6 lines
Documentation/filesystems/xfs.txt +4
-2- fs.xfs.xfsbufd_centisecs (Min: 50 Default: 100 Max: 3000) - The interval at which xfsbufd scans the dirty metadata buffers list. + fs.xfs.filestream_centisecs (Min: 1 Default: 3000 Max: 360000) + The interval at which the filesystem ages filestreams cache + references and returns timed-out AGs back to the free stream + pool.I bet
Documentation/filesystem/xfs-filestreams.txtwould be handy, but *shrug*
You're welcome to write it and then make the filestreams code behave reliably as per the documentation for the 2 people that use it.... ;)
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 01/27] xfs: update mount options documentation
Quoted 25 lines · Dave Chinner
Quoted 16 lines
Quoted 16 lines
+
Quoted 8 lines
Documentation/filesystems/xfs.txt When mounting an XFS filesystem, the following options are accepted. · line 206
Quoted 8 lines
Documentation/filesystems/xfs.txt +8
-0+ The sunit and swidth parameters specified must be compatible + with the existing filesystem alignment characteristics. If + the filesystem was not created with data alignment + constraints, then it may be impossible to set a valid sunit + (and hence swidth) value. In general, that means the only + valid changes to sunit are increasing it by a power-of-2 + multiple. Valid swidth values are any integer multiple of a + valid sunit value.now I'm confused. It's only relevant to a filesystem w/ geometry specified, but if it wasn't specified, it may be possible . . . ? And if nothing was specified (i.e. 0 su/sw) then we can only increase that 0 by a power of 2?
Quoted 9 lines
Quoted 9 lines
Quoted 5 lines
Documentation/filesystems/xfs.txt When mounting an XFS filesystem, the following options are accepted. · line 212
Quoted 5 lines
Documentation/filesystems/xfs.txt +5
-0+ For filesystems that have existing data alignment values on + disk (i.e. specified by mkfs), any new valid values passed + in as mount options will overwrite the values stored on + disk. Hence this mount option does not need to be specified + for every mount operation in this case.so I think this all needs to clarify whether it works on filesystems w/o existing geometry, or not. And "why you might want this" would be helpful too.
Quoted 7 lines
It's obviously too complex to explain everything in a short "what" description. I suspect that the best thing to do here is simply document it as a method of changing alignment for a device that has changed geometry such as a adding a disk to a MD RAID5 device. I'm going to drop any reference to sunit/swidth being zero because that case was a hack for fixing a CXFS client bug.
Ok, fair enough on the what not why.
But FWIW, even if we aren't saying why, just what, the docs seem inconsistent here.
It talks about existing geometry being required for this option, but also says what happens if it's not.
If you drop that part, then that sounds good.
Thanks,
-Eric
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 2/27 xfs: add pluging for bulkstat readahead
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
I was running some tests on bulkstat on CRC enabled filesystems when I noticed that all the IO being issued was 8k in size, regardless of the fact taht we are issuing sequential 8k buffers for inodes clusters. The IO size shoul dbe 16k for 256 byte inodes, and 32k for 512 byte inodes, but this wasn't happening.
blktrace showed that there was an explict plug and unplug happening around each readahead IO from _xfs_buf_ioapply, and the unplug was causing the IO to be issued immediately. Hence no opportunity was being given to the elevator to merge adjacent readahead requests and dispatch them as a single IO.
Add plugging around the inode chunk readahead dispatch loop tin bulkstat to ensure that we don't unplug the queue between adjacent inode buffer readahead IOs and so we get fewer, larger IO requests hitting the storage subsystemi for bulkstat.
--- fs/xfs/xfs_itable.c | 3 +++ 1 file changed, 3 insertions(+)
fs/xfs/xfs_itable.c +3 -0
@@ -383,11 +383,13 @@ xfs_bulkstat(* Also start read-ahead now for this chunk. */ if (r.ir_freecount <XFS_INODES_PER_CHUNK ) { +struct blk_plug plug;/* * Loop over all clusters in the next chunk. * Do a readahead if there are any allocated * inodes in that cluster. */ +blk_start_plug (&plug); agbno =XFS_AGINO_TO_AGBNO (mp, r.ir_startino); for (chunkidx = 0; chunkidx < XFS_INODES_PER_CHUNK;
@@ -399,6 +401,7 @@ xfs_bulkstat( agbno, nbcluster, &xfs_inode_buf_ops); } +blk_finish_plug (&plug); irbp->ir_startino = r.ir_startino; irbp->ir_freecount = r.ir_freecount; irbp->ir_free = r.ir_free;
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 3/27 xfs: plug directory buffer readahead
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Similar to bulkstat inode chunk readahead, we need to plug directory data buffer readahead during getdents to ensure that we can merge adjacent readahead requests and sort out of order requests optimally before they are dispatched. This improves the readahead efficiency and reduces the IO load it generates as the IO patterns are significantly better for both contiguous and fragmented directories.
--- fs/xfs/xfs_dir2_leaf.c | 3 +++ 1 file changed, 3 insertions(+)
fs/xfs/xfs_dir2_leaf.c +3 -0
@@ -1108,6 +1108,7 @@ xfs_dir2_leaf_readbuf(struct xfs_mount *mp = dp->i_mount;struct xfs_buf *bp = *bpp;struct xfs_bmbt_irec *map = mip->map; +struct blk_plug plug;int error =0 ;int length;int i;
@@ -1236,6 +1237,7 @@ xfs_dir2_leaf_readbuf(/* * Do we need more readahead? */ +blk_start_plug (&plug);for (mip->ra_index = mip->ra_offset = i =0 ; mip->ra_want > mip->ra_current && i < mip->map_blocks; i += mp->m_dirblkfsbs) {
@@ -1287,6 +1289,7 @@ xfs_dir2_leaf_readbuf( } } } +blk_finish_plug (&plug); out: *bpp = bp;
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 4/27 xfs: don't use speculative prealloc for small files
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Dedicated small file workloads have been seeing significant free space fragmentation causing premature inode allocation failure when large inode sizes are in use. A particular test case showed that a workload that runs to a real ENOSPC on 256 byte inodes would fail inode allocation with ENOSPC about about 80% full with 512 byte inodes, and at about 50% full with 1024 byte inodes.
The same workload, when run with -o allocsize=4096 on 1024 byte inodes would run to being 100% full before giving ENOSPC. That is, no freespace fragmentation at all.
The issue was caused by the specific IO pattern the application had
- the framework it was using did not support direct IO, and so it was emulating it by using fadvise(DONT_NEED). The result was that the data was getting written back before the speculative prealloc had been trimmed from memory by the close(), and so small single block files were being allocated with 2 blocks, and then having one truncated away. The result was lots of small 4k free space extents, and hence each new 8k allocation would take another 8k from contiguous free space and turn it into 4k of allocated space and 4k of free space.
Hence inode allocation, which requires contiguous, aligned allocation of 16k (256 byte inodes), 32k (512 byte inodes) or 64k (1024 byte inodes) can fail to find sufficiently large freespace and hence fail while there is still lots of free space available.
There's a simple fix for this, and one that has precendence in the allocator code already - don't do speculative allocation unless the size of the file is larger than a certain size. In this case, that size is the minimum default preallocation size:mp->m_writeio_blocks. And to keep with the concept of being nice to people when the files are still relatively small, cap the prealloc to mp->m_writeio_blocks until the file goes over a stripe unit is size, at which point we'll fall back to the current behaviour based on the last extent size.
This will effectively turn off speculative prealloc for very small files, keep preallocation low for small files, and behave as it currently does for any file larger than a stripe unit. This completely avoids the freespace fragmentation problem this particular IO pattern was causing.
--- fs/xfs/xfs_iomap.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
fs/xfs/xfs_iomap.c +13 -0
@@ -284,6 +284,15 @@ xfs_iomap_eof_want_preallocate(return 0 ;/* +* If the file is smaller than the minimum prealloc and we are using +* dynamic preallocation, don't do any preallocation at all as it is +* likely this is the only write to the file that is going to be done. +*/ +if (!(mp->m_flags &XFS_MOUNT_DFLT_IOSIZE ) && +XFS_ISIZE (ip) < mp->m_writeio_blocks) +return 0 ; + +/* * If there are any real blocks past eof, then don't * do any speculative allocation. */
@@ -345,6 +354,10 @@ xfs_iomap_eof_prealloc_initial_size(if (mp->m_flags &XFS_MOUNT_DFLT_IOSIZE )return 0 ; +/* If the file is small, then use the minimum prealloc */ +if (XFS_ISIZE (ip) < mp->m_dalign) +return 0 ; +/* * As we write multiple pages, the offset will always align to the * start of a page and hence point to a hole at EOF. i.e. if the size is
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 04/27] xfs: don't use speculative prealloc for small files
Quoted 2 lines · Dave Chinner
From: Dave Chinner <[email protected]>
...
Quoted 10 lines
--- fs/xfs/xfs_iomap.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)fs/xfs/xfs_iomap.c +0
-0@@ -284,6 +284,15 @@ xfs_iomap_eof_want_preallocate(return 0 ;
fs/xfs/xfs_iomap.c xfs_iomap_eof_want_preallocate( · line 294
Quoted 10 lines
fs/xfs/xfs_iomap.c +8
-0/* +* If the file is smaller than the minimum prealloc and we are using +* dynamic preallocation, don't do any preallocation at all as it is +* likely this is the only write to the file that is going to be done. +*/ +if (!(mp->m_flags &XFS_MOUNT_DFLT_IOSIZE ) && +XFS_ISIZE (ip) < mp->m_writeio_blocks) +return 0 ; +
I stuck this on a box, got a 64k prealloc on an 8k file and then noticed this was comparing inode size against a block count. This should probably be:
XFS_ISIZE(ip) < XFS_FSB_TO_B(mp, mp->m_writeio_blocks)
Given that, we avoid preallocs entirely until the file size reaches the minimum write size (assuming dynamic prealloc mode).
fs/xfs/xfs_iomap.c xfs_iomap_eof_prealloc_initial_size( · line 360
Quoted 12 lines
fs/xfs/xfs_iomap.c +5
-0+/* * If there are any real blocks past eof, then don't * do any speculative allocation. */ @@ -345,6 +354,10 @@ xfs_iomap_eof_prealloc_initial_size(if (mp->m_flags &XFS_MOUNT_DFLT_IOSIZE )return 0 ; +/* If the file is small, then use the minimum prealloc */ +if (XFS_ISIZE (ip) < mp->m_dalign) +return 0 ; +
...
... and the same fsb->b conversion applies here.
If the file is larger than the minimum write size but smaller than the stripe unit, we prealloc by the minimum prealloc size (m_writeio_blocks) until the file grows beyond the stripe unit. That means if the stripe unit is smaller than m_writeio_blocks or not specified, we'd just start right into the dynamic prealloc algorithm. Seems reasonable.
Brian
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 04/27] xfs: don't use speculative prealloc for small files
Quoted 29 lines · Brian Foster
Quoted 2 lines · Dave Chinner
From: Dave Chinner <[email protected]>
...
Quoted 10 lines
--- fs/xfs/xfs_iomap.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)fs/xfs/xfs_iomap.c +0
-0@@ -284,6 +284,15 @@ xfs_iomap_eof_want_preallocate(return 0 ;fs/xfs/xfs_iomap.c xfs_iomap_eof_want_preallocate( · line 294
Quoted 10 lines
fs/xfs/xfs_iomap.c +8
-0/* +* If the file is smaller than the minimum prealloc and we are using +* dynamic preallocation, don't do any preallocation at all as it is +* likely this is the only write to the file that is going to be done. +*/ +if (!(mp->m_flags &XFS_MOUNT_DFLT_IOSIZE ) && +XFS_ISIZE (ip) < mp->m_writeio_blocks) +return 0 ; +I stuck this on a box, got a 64k prealloc on an 8k file and then noticed this was comparing inode size against a block count. This should probably be:
Quoted 4 lines
XFS_ISIZE(ip) < XFS_FSB_TO_B(mp, mp->m_writeio_blocks)Given that, we avoid preallocs entirely until the file size reaches the minimum write size (assuming dynamic prealloc mode).
Doh! Will fix.
Cheers
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 5/27 xfs: don't do IO when creating an new inode
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
When we are allocating a new inode, we read the inode cluster off disk to increment the generation number. We are already using a random generation number for newly allocated inodes, so if we are not using the ikeep mode, we can just generate a new generation number when we initialise the newly allocated inode.
This avoids the need for reading the inode buffer during inode creation. This will speed up allocation of inodes in cold, partially allocated clusters as they will no longer need to be read from disk during allocation. It will also reduce the CPU overhead of inode allocation by not having the process the buffer read, even on cache hits.
--- fs/xfs/xfs_inode.c | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-)
fs/xfs/xfs_inode.c +28 -8
@@ -1028,6 +1028,11 @@ xfs_dinode_calc_crc(/* * Read the disk inode attributes into the in-core inode structure. +* +* If we are initialising a new inode and we are not utilising the +* XFS_MOUNT_IKEEP inode cluster mode, we can simple build the new inode core +* with a random generation number. If we are keeping inodes around, we need to +* read the inode cluster to get the existing generation number off disk. */ int xfs_iread(
@@ -1047,6 +1052,22 @@ xfs_iread(if (error)return error; +/* shortcut IO on inode allocation if possible */ +if ((iget_flags &XFS_IGET_CREATE ) && + !(mp->m_flags &XFS_MOUNT_IKEEP )) { +/* initialise the on-disk inode core */ +memset (&ip->i_d,0 ,sizeof (ip->i_d)); + ip->i_d.di_magic =XFS_DINODE_MAGIC ; + ip->i_d.di_gen =prandom_u32 (); +if (xfs_sb_version_hascrc (&mp->m_sb)) { + ip->i_d.di_version =3 ; + ip->i_d.di_ino = ip->i_ino; +uuid_copy (&ip->i_d.di_uuid, &mp->m_sb.sb_uuid); + }else + ip->i_d.di_version =2 ; +return 0 ; + } +/* * Get pointers to the on-disk inode and the buffer containing it. */
@@ -1133,17 +1154,16 @@ xfs_iread(xfs_buf_set_ref (bp,XFS_INO_REF );/* -* Use xfs_trans_brelse() to release the buffer containing the -* on-disk inode, because it was acquired with xfs_trans_read_buf() -* in xfs_imap_to_bp() above. If tp is NULL, this is just a normal +* Use xfs_trans_brelse() to release the buffer containing the on-disk +* inode, because it was acquired with xfs_trans_read_buf() in +* xfs_imap_to_bp() above. If tp is NULL, this is just a normal * brelse(). If we're within a transaction, then xfs_trans_brelse() * will only release the buffer if it is not dirty within the * transaction. It will be OK to release the buffer in this case, -* because inodes on disk are never destroyed and we will be -* locking the new in-core inode before putting it in the hash -* table where other processes can find it. Thus we don't have -* to worry about the inode being changed just because we released -* the buffer. +* because inodes on disk are never destroyed and we will be locking the +* new in-core inode before putting it in the cache where other +* processes can find it. Thus we don't have to worry about the inode +* being changed just because we released the buffer. */ out_brelse:xfs_trans_brelse (tp, bp);
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 6/27 xfs: xfs_ifree doesn't need to modify the inode buffer
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Long ago, bulkstat used to read inodes directly fromteh backing buffer for speed. This had the unfortunate problem of being cache incoherent with unlinks, and so xfs_ifree() had to mark the inode as free directly in the backing buffer. bulkstat was changed some time ago to use inode cache coherent lookups, and so will never see unlinked inodes in it's lookups. Hence xfs_ifree() does not need to touch the inode backing buffer anymore.
--- fs/xfs/xfs_inode.c | 32 ++++---------------------------- 1 file changed, 4 insertions(+), 28 deletions(-)
fs/xfs/xfs_inode.c +4 -28
@@ -2048,8 +2048,6 @@ xfs_ifree(int error;int delete;xfs_ino_t first_ino; -xfs_dinode_t *dip; -xfs_buf_t *ibp;ASSERT (xfs_isilocked (ip,XFS_ILOCK_EXCL ));ASSERT (ip->i_d.di_nlink ==0 );
@@ -2062,14 +2060,13 @@ xfs_ifree(* Pull the on-disk inode from the AGI unlinked list. */ error =xfs_iunlink_remove (tp, ip); -if (error !=0 ) { +if (error)return error; - } error =xfs_difree (tp, ip->i_ino, flist, &delete, &first_ino); -if (error !=0 ) { +if (error)return error; - } + ip->i_d.di_mode =0 ;/* mark incore inode as free */ ip->i_d.di_flags =0 ; ip->i_d.di_dmevmask =0 ;
@@ -2081,31 +2078,10 @@ xfs_ifree(* by reincarnations of this inode. */ ip->i_d.di_gen++; -xfs_trans_log_inode (tp, ip,XFS_ILOG_CORE ); - error =xfs_imap_to_bp (ip->i_mount, tp, &ip->i_imap, &dip, &ibp, -0 ,0 ); -if (error) -return error; - -/* -* Clear the on-disk di_mode. This is to prevent xfs_bulkstat -* from picking up this inode when it is reclaimed (its incore state -* initialzed but not flushed to disk yet). The in-core di_mode is -* already cleared and a corresponding transaction logged. -* The hack here just synchronizes the in-core to on-disk -* di_mode value in advance before the actual inode sync to disk. -* This is OK because the inode is already unlinked and would never -* change its di_mode again for this inode generation. -* This is a temporary hack that would require a proper fix -* in the future. -*/ - dip->di_mode =0 ; - -if (delete) { +if (delete) error =xfs_ifree_cluster (ip, tp, first_ino); - }return error; }
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 7/27 xfs: Introduce ordered log vector support
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
And "ordered log vector" is a log vector that is used for tracking a log item through the CIL and into the AIL as part of the log checkpointing. These ordered log vectors are special in that they are not written to to journal in any way, and are not accounted to the checkpoint being written.
The reason for this behaviour is to allow operations to attach items to transactions and have them follow the normal transactional lifecycle without actually having to write them to the journal. This allows logging of items that track high level logical changes and writing them to the log, while the physical items being modified pass through into the AIL and pin the tail of the log (and therefore the logical item in the log) until all the modified items are physically written to disk.
IOWs, it allows us to write metadata without physically logging every individual change but still maintain the full transactional integrity guarantees we currently have w.r.t. crash recovery.
This change modifies some of the CIL item insertion loops, as ordered log vectors introduce some new constraints as they don't track any data. One advantage of this change is that it combines two log vector chain walks into a single pass, so there is less overhead in the transaction commit pass as well. It also kills some unused code in the log vector walk loop when committing the CIL.
--- fs/xfs/xfs_log.c | 21 +++++++++++--- fs/xfs/xfs_log.h | 2 ++ fs/xfs/xfs_log_cil.c | 75 ++++++++++++++++++++++++++++++++++---------------- 3 files changed, 70 insertions(+), 28 deletions(-)
fs/xfs/xfs_log.c +17 -4
@@ -1963,6 +1963,10 @@ xlog_write_calc_vec_length( headers++;for (lv = log_vector; lv; lv = lv->lv_next) { +/* we don't write ordered log vectors */ +if (lv->lv_buf_len ==XFS_LOG_VEC_ORDERED ) +continue ; + headers += lv->lv_niovecs;for (i =0 ; i < lv->lv_niovecs; i++) {
@@ -2216,7 +2220,7 @@ xlog_write( index =0 ; lv = log_vector; vecp = lv->lv_iovecp; -while (lv && index < lv->lv_niovecs) { +while (lv && (!lv->lv_niovecs || index < lv->lv_niovecs)) {void *ptr;int log_offset;
@@ -2236,13 +2240,21 @@ xlog_write(* This loop writes out as many regions as can fit in the amount * of space which was allocated by xlog_state_get_iclog_space(). */ -while (lv && index < lv->lv_niovecs) { -struct xfs_log_iovec *reg = &vecp[index]; +while (lv && (!lv->lv_niovecs || index < lv->lv_niovecs)) { +struct xfs_log_iovec *reg;struct xlog_op_header *ophdr;int start_rec_copy;int copy_len;int copy_off; +bool ordered = false; + +/* ordered log vectors have no regions to write */ +if (lv->lv_buf_len ==XFS_LOG_VEC_ORDERED ) { + ordered = true; + goto next_lv; + } + reg = &vecp[index];ASSERT (reg->i_len %sizeof (__int32_t) ==0 );ASSERT ((unsigned long )ptr %sizeof (__int32_t) ==0 );
@@ -2302,12 +2314,13 @@ xlog_write(break ;if (++index == lv->lv_niovecs) { +next_lv: lv = lv->lv_next; index =0 ;if (lv) vecp = lv->lv_iovecp; } -if (record_cnt ==0 ) { +if (record_cnt ==0 && ordered == false) {if (!lv)return 0 ;break ;
fs/xfs/xfs_log.h +2 -0
@@ -105,6 +105,8 @@ struct xfs_log_vec {int lv_buf_len;/* size of formatted buffer */ }; +#define XFS_LOG_VEC_ORDERED (-1) +/* * Structure used to pass callback function and the function's argument * to the log manager.
fs/xfs/xfs_log_cil.c +51 -24
151 lines not on this page · raw message
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 8/27 xfs: Introduce an ordered buffer item
In reply to Dave ChinnerIf we have a buffer that we have modified but we do not wish to physically log in a transaction (e.g. we've logged a logical change), we still need to ensure that transactional integrity is maintained. Hence we must not move the tail of the log past the transaction that the buffer is associated with before the buffer is written to disk.
This means these special buffers still need to be included in the transaction and added to the AIL just like a normal buffer, but we do not want the modifications to the buffer written into the transaction. IOWs, what we want is an "ordered buffer" that maintains the same transactional life cycle as a physically logged buffer, just without the transcribing of the modifications to the log.
Hence we need to flag the buffer as an "ordered buffer" to avoid including it in vector size calculations or formatting during the transaction. Once the transaction is committed, the buffer appears for all intents to be the same as a physically logged buffer as it transitions through the log and AIL.
Relogging will also work just fine for such an ordered buffer - the logical transaction will be replayed before the subsequent modifications that relog the buffer, so everything will be reconstructed correctly by recovery.
--- fs/xfs/xfs_buf_item.c | 75 +++++++++++++++++++++++++++++++----------------- fs/xfs/xfs_buf_item.h | 4 ++- fs/xfs/xfs_trace.h | 4 +++ fs/xfs/xfs_trans.h | 1 + fs/xfs/xfs_trans_buf.c | 34 ++++++++++++++++++++-- 5 files changed, 87 insertions(+), 31 deletions(-)
fs/xfs/xfs_buf_item.c +48 -27
@@ -140,6 +140,16 @@ xfs_buf_item_size(ASSERT (bip->bli_flags &XFS_BLI_LOGGED ); +if (bip->bli_flags &XFS_BLI_ORDERED ) { +/* +* The buffer has been logged just to order it. +* It is not being included in the transaction +* commit, so no vectors are used at all. +*/ +trace_xfs_buf_item_size_ordered (bip); +return XFS_LOG_VEC_ORDERED ; + } +/* * the vector count is based on the number of buffer vectors we have * dirty bits in. This will only be greater than one when we have a
@@ -212,6 +222,7 @@ xfs_buf_item_format_segment( goto out; } +/* * Fill in an iovec for each set of contiguous chunks. */
@@ -311,6 +322,16 @@ xfs_buf_item_format( bip->bli_flags &= ~XFS_BLI_INODE_BUF ; } +if ((bip->bli_flags & (XFS_BLI_ORDERED |XFS_BLI_STALE )) == +XFS_BLI_ORDERED ) { +/* +* The buffer has been logged just to order it. It is not being +* included in the transaction commit, so don't format it. +*/ +trace_xfs_buf_item_format_ordered (bip); +return ; + } +for (i =0 ; i < bip->bli_format_count; i++) { vecp =xfs_buf_item_format_segment (bip, vecp, offset, &bip->bli_formats[i]);
@@ -340,6 +361,7 @@ xfs_buf_item_pin(ASSERT (atomic_read (&bip->bli_refcount) >0 );ASSERT ((bip->bli_flags &XFS_BLI_LOGGED ) || + (bip->bli_flags &XFS_BLI_ORDERED ) || (bip->bli_flags &XFS_BLI_STALE ));trace_xfs_buf_item_pin (bip);
@@ -512,8 +534,9 @@ xfs_buf_item_unlock( {struct xfs_buf_log_item *bip =BUF_ITEM (lip);struct xfs_buf *bp = bip->bli_buf; -int aborted, clean, i; -uint hold; +bool clean; +bool aborted; +int flags;/* Clear the buffer's association with this transaction. */ bp->b_transp =NULL ;
@@ -524,23 +547,21 @@ xfs_buf_item_unlock(* (cancelled) buffers at unpin time, but we'll never go through the * pin/unpin cycle if we abort inside commit. */ - aborted = (lip->li_flags &XFS_LI_ABORTED ) !=0 ; - + aborted = (lip->li_flags &XFS_LI_ABORTED ) ? true : false;/* -* Before possibly freeing the buf item, determine if we should -* release the buffer at the end of this routine. +* Before possibly freeing the buf item, copy the per-transaction state +* so we can reference it safely later after clearing it from the +* buffer log item. */ - hold = bip->bli_flags &XFS_BLI_HOLD ; - -/* Clear the per transaction state. */ - bip->bli_flags &= ~(XFS_BLI_LOGGED |XFS_BLI_HOLD ); + flags = bip->bli_flags; + bip->bli_flags &= ~(XFS_BLI_LOGGED |XFS_BLI_HOLD |XFS_BLI_ORDERED );/* * If the buf item is marked stale, then don't do anything. We'll * unlock the buffer and free the buf item when the buffer is unpinned * for the last time. */ -if (bip->bli_flags &XFS_BLI_STALE ) { +if (flags &XFS_BLI_STALE ) {trace_xfs_buf_item_unlock_stale (bip);ASSERT (bip->__bli_format.blf_flags &XFS_BLF_CANCEL );if (!aborted) {
@@ -557,13 +578,19 @@ xfs_buf_item_unlock(* be the only reference to the buf item, so we free it anyway * regardless of whether it is dirty or not. A dirty abort implies a * shutdown, anyway. +* +* Ordered buffers are dirty but may have no recorded changes, so ensure +* we only release clean items here. */ - clean =1 ; -for (i =0 ; i < bip->bli_format_count; i++) { -if (!xfs_bitmap_empty (bip->bli_formats[i].blf_data_map, - bip->bli_formats[i].blf_map_size)) { - clean =0 ; -break ; + clean = (flags &XFS_BLI_DIRTY ) ? false : true; +if (clean) { +int i; +for (i =0 ; i < bip->bli_format_count; i++) { +if (!xfs_bitmap_empty (bip->bli_formats[i].blf_data_map, + bip->bli_formats[i].blf_map_size)) { + clean = false; +break ; + } } }if (clean)
@@ -576,7 +603,7 @@ xfs_buf_item_unlock( }else atomic_dec (&bip->bli_refcount); -if (!hold) +if (!(flags &XFS_BLI_HOLD ))xfs_buf_relse (bp); }
@@ -842,12 +869,6 @@ xfs_buf_item_log(struct xfs_buf *bp = bip->bli_buf;/* -* Mark the item as having some dirty data for -* quick reference in xfs_buf_item_dirty. -*/ - bip->bli_flags |=XFS_BLI_DIRTY ; - -/* * walk each buffer segment and mark them dirty appropriately. */ start =0 ;
@@ -873,7 +894,7 @@ xfs_buf_item_log(/* -* Return 1 if the buffer has some data that has been logged (at any +* Return 1 if the buffer has been logged or ordered in a transaction (at any * point, not just the current transaction) and 0 if not. */ uint
@@ -907,11 +928,11 @@ voidxfs_buf_item_relse ( xfs_buf_t *bp) { -xfs_buf_log_item_t *bip; +xfs_buf_log_item_t *bip = bp->b_fspriv;trace_xfs_buf_item_relse (bp, _RET_IP_); +ASSERT (!(bip->bli_item.li_flags &XFS_LI_IN_AIL )); - bip = bp->b_fspriv; bp->b_fspriv = bip->bli_item.li_bio_list;if (bp->b_fspriv ==NULL ) bp->b_iodone =NULL ;
fs/xfs/xfs_buf_item.h +3 -1
@@ -120,6 +120,7 @@ xfs_blft_from_flags(struct xfs_buf_log_format *blf)#define XFS_BLI_INODE_ALLOC_BUF 0x10#define XFS_BLI_STALE_INODE 0x20#define XFS_BLI_INODE_BUF 0x40 +#define XFS_BLI_ORDERED 0x80#define XFS_BLI_FLAGS \ { XFS_BLI_HOLD, "HOLD" }, \
@@ -128,7 +129,8 @@ xfs_blft_from_flags(struct xfs_buf_log_format *blf) { XFS_BLI_LOGGED, "LOGGED" }, \ { XFS_BLI_INODE_ALLOC_BUF, "INODE_ALLOC" }, \ { XFS_BLI_STALE_INODE, "STALE_INODE" }, \ - { XFS_BLI_INODE_BUF, "INODE_BUF" } + { XFS_BLI_INODE_BUF, "INODE_BUF" }, \ + { XFS_BLI_ORDERED, "ORDERED" } #ifdef __KERNEL__
fs/xfs/xfs_trace.h +4 -0
@@ -486,9 +486,12 @@ DEFINE_EVENT(xfs_buf_item_class, name, \ TP_PROTO(struct xfs_buf_log_item *bip), \ TP_ARGS(bip)) DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size); +DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_ordered); DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_stale); DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format); +DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format_ordered); DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format_stale); +DEFINE_BUF_ITEM_EVENT(xfs_buf_item_ordered); DEFINE_BUF_ITEM_EVENT(xfs_buf_item_pin); DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin); DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin_stale);
@@ -508,6 +511,7 @@ DEFINE_BUF_ITEM_EVENT(xfs_trans_bjoin);DEFINE_BUF_ITEM_EVENT (xfs_trans_bhold);DEFINE_BUF_ITEM_EVENT (xfs_trans_bhold_release);DEFINE_BUF_ITEM_EVENT (xfs_trans_binval); +DEFINE_BUF_ITEM_EVENT (xfs_trans_buf_ordered); DECLARE_EVENT_CLASS(xfs_lock_class, TP_PROTO(struct xfs_inode *ip, unsigned lock_flags,
fs/xfs/xfs_trans.h +1 -0
@@ -503,6 +503,7 @@ void xfs_trans_bhold_release(xfs_trans_t *, struct xfs_buf *);void xfs_trans_binval (xfs_trans_t *,struct xfs_buf *);void xfs_trans_inode_buf (xfs_trans_t *,struct xfs_buf *);void xfs_trans_stale_inode_buf (xfs_trans_t *,struct xfs_buf *); +void xfs_trans_ordered_buf (xfs_trans_t *,struct xfs_buf *);void xfs_trans_dquot_buf (xfs_trans_t *,struct xfs_buf *,uint );void xfs_trans_inode_alloc_buf (xfs_trans_t *,struct xfs_buf *);void xfs_trans_ichgtime (struct xfs_trans *,struct xfs_inode *,int );
fs/xfs/xfs_trans_buf.c +31 -3
@@ -397,7 +397,6 @@ shutdown_abort:return XFS_ERROR (EIO ); } -/* * Release the buffer bp which was previously acquired with one of the * xfs_trans_... buffer allocation routines if the buffer has not
@@ -603,8 +602,14 @@ xfs_trans_log_buf(xfs_trans_t *tp, tp->t_flags |=XFS_TRANS_DIRTY ; bip->bli_item.li_desc->lid_flags |=XFS_LID_DIRTY ; - bip->bli_flags |=XFS_BLI_LOGGED ; -xfs_buf_item_log (bip, first, last); + +/* +* If we have an ordered buffer we are not logging any dirty range but +* it still needs to be marked dirty and that it has been logged. +*/ + bip->bli_flags |=XFS_BLI_DIRTY |XFS_BLI_LOGGED ; +if (!(bip->bli_flags &XFS_BLI_ORDERED )) +xfs_buf_item_log (bip, first, last); }
@@ -757,6 +762,29 @@ xfs_trans_inode_alloc_buf( }/* +* Mark the buffer as ordered for this transaction. This means +* that the contents of the buffer are not recorded in the transaction +* but it is tracked in the AIL as though it was. This allows us +* to record logical changes in transactions rather than the physical +* changes we make to the buffer without changing writeback ordering +* constraints of metadata buffers. +*/ +void +xfs_trans_ordered_buf ( +struct xfs_trans *tp, +struct xfs_buf *bp) +{ +struct xfs_buf_log_item *bip = bp->b_fspriv; + +ASSERT (bp->b_transp == tp); +ASSERT (bip !=NULL ); +ASSERT (atomic_read (&bip->bli_refcount) >0 ); + + bip->bli_flags |=XFS_BLI_ORDERED ; +trace_xfs_buf_item_ordered (bip); +} + +/* * Set the type of the buffer for log recovery so that it can correctly identify * and hence attach the correct buffer ops to the buffer after replay. */
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 9/27 xfs: Inode create log items
In reply to Dave ChinnerIntroduce the inode create log item type for logical inode create logging. Instead of logging the changes in buffers, pass the range to be initialised through the log by a new transaction type. This reduces the amount of log space required to record initialisation during allocation from about 128 bytes per inode to a small fixed amount per inode extent to be initialised.
This requires a new log item type to track it through the log and the AIL. This is a relatively simple item - most callbacks are noops as this item has the same life cycle as the transaction.
--- fs/xfs/Makefile | 1 + fs/xfs/xfs_icreate_item.c | 195 +++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_icreate_item.h | 52 ++++++++++++ fs/xfs/xfs_log.h | 3 +- fs/xfs/xfs_super.c | 8 ++ fs/xfs/xfs_trans.h | 4 +- 6 files changed, 261 insertions(+), 2 deletions(-) create mode 100644 fs/xfs/xfs_icreate_item.c create mode 100644 fs/xfs/xfs_icreate_item.h
fs/xfs/Makefile +1 -0
@@ -71,6 +71,7 @@ xfs-y += xfs_alloc.o \ xfs_dir2_sf.o \ xfs_ialloc.o \ xfs_ialloc_btree.o \ + xfs_icreate_item.o \ xfs_inode.o \ xfs_log_recover.o \ xfs_mount.o \
fs/xfs/xfs_icreate_item.c new file +195 -0
195 lines not on this page · raw message
fs/xfs/xfs_icreate_item.h new file +52 -0
52 lines not on this page · raw message
fs/xfs/xfs_log.h +2 -1
@@ -88,7 +88,8 @@ static inline xfs_lsn_t _lsn_cmp(xfs_lsn_t lsn1, xfs_lsn_t lsn2)#define XLOG_REG_TYPE_UNMOUNT 17#define XLOG_REG_TYPE_COMMIT 18#define XLOG_REG_TYPE_TRANSHDR 19 -#define XLOG_REG_TYPE_MAX 19 +#define XLOG_REG_TYPE_ICREATE 20 +#define XLOG_REG_TYPE_MAX 20 typedef struct xfs_log_iovec { void *i_addr; /* beginning address of region */
fs/xfs/xfs_super.c +8 -0
@@ -51,6 +51,7 @@#include "xfs_inode_item.h" #include "xfs_icache.h" #include "xfs_trace.h" +#include "xfs_icreate_item.h" #include <linux/namei.h> #include <linux/init.h>
@@ -1655,9 +1656,15 @@ xfs_init_zones(void) KM_ZONE_SPREAD, NULL);if (!xfs_ili_zone) goto out_destroy_inode_zone; + xfs_icreate_zone =kmem_zone_init (sizeof (struct xfs_icreate_item ), +"xfs_icr" ); +if (!xfs_icreate_zone) + goto out_destroy_ili_zone;return 0 ; + out_destroy_ili_zone: +kmem_zone_destroy (xfs_ili_zone); out_destroy_inode_zone:kmem_zone_destroy (xfs_inode_zone); out_destroy_efi_zone:
@@ -1696,6 +1703,7 @@ xfs_destroy_zones(void)* destroy caches. */ rcu_barrier (); +kmem_zone_destroy (xfs_icreate_zone);kmem_zone_destroy (xfs_ili_zone);kmem_zone_destroy (xfs_inode_zone);kmem_zone_destroy (xfs_efi_zone);
fs/xfs/xfs_trans.h +3 -1
@@ -48,6 +48,7 @@ typedef struct xfs_trans_header {#define XFS_LI_BUF 0x123c/* v2 bufs, variable sized inode bufs */ #define XFS_LI_DQUOT 0x123d#define XFS_LI_QUOTAOFF 0x123e +#define XFS_LI_ICREATE 0x123f#define XFS_LI_TYPE_DESC \ { XFS_LI_EFI, "XFS_LI_EFI" }, \
@@ -107,7 +108,8 @@ typedef struct xfs_trans_header {#define XFS_TRANS_SWAPEXT 40#define XFS_TRANS_SB_COUNT 41#define XFS_TRANS_CHECKPOINT 42 -#define XFS_TRANS_TYPE_MAX 42 +#define XFS_TRANS_ICREATE 43 +#define XFS_TRANS_TYPE_MAX 43/* new transaction types need to be reflected in xfs_logprint(8) */ #define XFS_TRANS_TYPES \
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 10/27 xfs: Inode create transaction reservations
In reply to Dave ChinnerDefine the log and space transaction sizes. Factor the current create log reservation macro into the two logical halves and reuse one half for the new icreate transactions. The icreate transaction is transparent to all the high level create code - the pre-calculated reservations will correctly set the reservations dependent on whether the filesystem supports the icreate transaction.
--- fs/xfs/xfs_trans.c | 118 ++++++++++++++++++++++++++++++++++------------------ 1 file changed, 77 insertions(+), 41 deletions(-)
fs/xfs/xfs_trans.c +77 -41
@@ -234,71 +234,93 @@ xfs_calc_remove_reservation( }/* -* For symlink we can modify: +* For create, break it in to the two cases that the transaction +* covers. We start with the modify case - allocation done by modification +* of the state of existing inodes - and the allocation case. +*/ + +/* +* For create we can modify: * the parent directory inode: inode size * the new inode: inode size -* the inode btree entry: 1 block +* the inode btree entry: block size +* the superblock for the nlink flag: sector size * the directory btree: (max depth + v2) * dir block size * the directory inode's bmap btree: (max depth + v2) * block size -* the blocks for the symlink: 1 kB -* Or in the first xact we allocate some inodes giving: +*/ +STATIC uint +xfs_calc_create_resv_modify ( +struct xfs_mount *mp) +{ +return xfs_calc_buf_res (2 , mp->m_sb.sb_inodesize) + +xfs_calc_buf_res (1 , mp->m_sb.sb_sectsize) + + (uint )XFS_FSB_TO_B (mp,1 ) + +xfs_calc_buf_res (XFS_DIROP_LOG_COUNT (mp),XFS_FSB_TO_B (mp,1 )); +} + +/* +* For create we can allocate some inodes giving: * the agi and agf of the ag getting the new inodes: 2 * sectorsize +* the superblock for the nlink flag: sector size * the inode blocks allocated: XFS_IALLOC_BLOCKS * blocksize * the inode btree: max depth * blocksize -* the allocation btrees: 2 trees * (2 * max depth - 1) * block size +* the allocation btrees: 2 trees * (max depth - 1) * block size */ STATIC uint -xfs_calc_symlink_reservation ( +xfs_calc_create_resv_alloc ( +struct xfs_mount *mp) +{ +return xfs_calc_buf_res (2 , mp->m_sb.sb_sectsize) + + mp->m_sb.sb_sectsize + +xfs_calc_buf_res (XFS_IALLOC_BLOCKS (mp),XFS_FSB_TO_B (mp,1 )) + +xfs_calc_buf_res (mp->m_in_maxlevels,XFS_FSB_TO_B (mp,1 )) + +xfs_calc_buf_res (XFS_ALLOCFREE_LOG_COUNT (mp,1 ), +XFS_FSB_TO_B (mp,1 )); +} + +STATIC uint +__xfs_calc_create_reservation (struct xfs_mount *mp) {return XFS_DQUOT_LOGRES (mp) + -MAX ((xfs_calc_buf_res (2 , mp->m_sb.sb_inodesize) + -xfs_calc_buf_res (1 ,XFS_FSB_TO_B (mp,1 )) + -xfs_calc_buf_res (XFS_DIROP_LOG_COUNT (mp), -XFS_FSB_TO_B (mp,1 )) + -xfs_calc_buf_res (1 ,1024 )), - (xfs_calc_buf_res (2 , mp->m_sb.sb_sectsize) + -xfs_calc_buf_res (XFS_IALLOC_BLOCKS (mp), -XFS_FSB_TO_B (mp,1 )) + -xfs_calc_buf_res (mp->m_in_maxlevels, -XFS_FSB_TO_B (mp,1 )) + -xfs_calc_buf_res (XFS_ALLOCFREE_LOG_COUNT (mp,1 ), -XFS_FSB_TO_B (mp,1 )))); +MAX (xfs_calc_create_resv_alloc (mp), +xfs_calc_create_resv_modify (mp)); }/* -* For create we can modify: -* the parent directory inode: inode size -* the new inode: inode size -* the inode btree entry: block size -* the superblock for the nlink flag: sector size -* the directory btree: (max depth + v2) * dir block size -* the directory inode's bmap btree: (max depth + v2) * block size -* Or in the first xact we allocate some inodes giving: +* For icreate we can allocate some inodes giving: * the agi and agf of the ag getting the new inodes: 2 * sectorsize * the superblock for the nlink flag: sector size -* the inode blocks allocated: XFS_IALLOC_BLOCKS * blocksize * the inode btree: max depth * blocksize * the allocation btrees: 2 trees * (max depth - 1) * block size */ STATIC uint -xfs_calc_create_reservation ( +xfs_calc_icreate_resv_alloc (struct xfs_mount *mp) { +return xfs_calc_buf_res (2 , mp->m_sb.sb_sectsize) + + mp->m_sb.sb_sectsize + +xfs_calc_buf_res (mp->m_in_maxlevels,XFS_FSB_TO_B (mp,1 )) + +xfs_calc_buf_res (XFS_ALLOCFREE_LOG_COUNT (mp,1 ), +XFS_FSB_TO_B (mp,1 )); +} + +STATIC uint +xfs_calc_icreate_reservation (xfs_mount_t *mp) +{return XFS_DQUOT_LOGRES (mp) + -MAX ((xfs_calc_buf_res (2 , mp->m_sb.sb_inodesize) + -xfs_calc_buf_res (1 , mp->m_sb.sb_sectsize) + - (uint )XFS_FSB_TO_B (mp,1 ) + -xfs_calc_buf_res (XFS_DIROP_LOG_COUNT (mp), -XFS_FSB_TO_B (mp,1 ))), - (xfs_calc_buf_res (2 , mp->m_sb.sb_sectsize) + - mp->m_sb.sb_sectsize + -xfs_calc_buf_res (XFS_IALLOC_BLOCKS (mp), -XFS_FSB_TO_B (mp,1 )) + -xfs_calc_buf_res (mp->m_in_maxlevels, -XFS_FSB_TO_B (mp,1 )) + -xfs_calc_buf_res (XFS_ALLOCFREE_LOG_COUNT (mp,1 ), -XFS_FSB_TO_B (mp,1 )))); +MAX (xfs_calc_icreate_resv_alloc (mp), +xfs_calc_create_resv_modify (mp)); +} + +STATIC uint +xfs_calc_create_reservation ( +struct xfs_mount *mp) +{ +if (xfs_sb_version_hascrc (&mp->m_sb)) +return xfs_calc_icreate_reservation (mp); +return __xfs_calc_create_reservation (mp); + }/*
@@ -311,6 +333,20 @@ xfs_calc_mkdir_reservation(return xfs_calc_create_reservation (mp); } + +/* +* Making a new symplink is the same as creating a new file, but +* with the added blocks for remote symlink data which can be up to 1kB in +* length (MAXPATHLEN). +*/ +STATIC uint +xfs_calc_symlink_reservation ( +struct xfs_mount *mp) +{ +return xfs_calc_create_reservation (mp) + +xfs_calc_buf_res (1 ,MAXPATHLEN ); +} +/* * In freeing an inode we can modify: * the inode being freed: inode size
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 11/27 xfs: Inode create item recovery
In reply to Dave ChinnerWhen we find a icreate transaction, we need to get and initialise the buffers in the range that has been passed. Extract and verify the information in the item record, then loop over the range initialising and issuing the buffer writes delayed.
Support an arbitrary size range to initialise so that in future when we allocate inodes in much larger chunks all kernels that understand this transaction can still recover them.
--- fs/xfs/xfs_ialloc.c | 37 +++++++++++---- fs/xfs/xfs_ialloc.h | 8 ++++ fs/xfs/xfs_log_recover.c | 114 ++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 145 insertions(+), 14 deletions(-)
fs/xfs/xfs_ialloc.c +28 -9
@@ -150,12 +150,16 @@ xfs_check_agi_freecount(#endif /* -* Initialise a new set of inodes. +* Initialise a new set of inodes. When called without a transaction context +* (e.g. from recovery) we initiate a delayed write of the inode buffers rather +* than logging them (which in a transaction context puts them into the AIL +* for writeback rather than the xfsbufd queue). */ STATIC int xfs_ialloc_inode_init( struct xfs_mount *mp, struct xfs_trans *tp, + struct list_head *buffer_list, xfs_agnumber_t agno, xfs_agblock_t agbno, xfs_agblock_t length,
@@ -247,18 +251,33 @@ xfs_ialloc_inode_init( ino++;uuid_copy (&free->di_uuid, &mp->m_sb.sb_uuid);xfs_dinode_calc_crc (mp, free); - }else { + }else if (tp) {/* just log the inode core */ xfs_trans_log_buf (tp, fbuf, ioffset, ioffset + isize -1 ); } } -if (version ==3 ) { -/* need to log the entire buffer */ -xfs_trans_log_buf (tp, fbuf,0 , -BBTOB (fbuf->b_length) -1 ); + +if (tp) { +/* +* Mark the buffer as an inode allocation buffer so it +* sticks in AIL at the point of this allocation +* transaction. This ensures the they are on disk before +* the tail of the log can be moved past this +* transaction (i.e. by preventing relogging from moving +* it forward in the log). +*/ +xfs_trans_inode_alloc_buf (tp, fbuf); +if (version ==3 ) { +/* need to log the entire buffer */ +xfs_trans_log_buf (tp, fbuf,0 , +BBTOB (fbuf->b_length) -1 ); + } + }else { + fbuf->b_flags |=XBF_DONE ; +xfs_buf_delwri_queue (fbuf, buffer_list); +xfs_buf_relse (fbuf); } -xfs_trans_inode_alloc_buf (tp, fbuf); }return 0 ; }
@@ -303,7 +322,7 @@ xfs_ialloc_ag_alloc(* First try to allocate inodes contiguous with the last-allocated * chunk of inodes. If the filesystem is striped, this will fill * an entire stripe unit with inodes. -*/ +*/ agi =XFS_BUF_TO_AGI (agbp); newino =be32_to_cpu (agi->agi_newino); agno =be32_to_cpu (agi->agi_seqno);
@@ -402,7 +421,7 @@ xfs_ialloc_ag_alloc(* rather than a linear progression to prevent the next generation * number from being easily guessable. */ - error =xfs_ialloc_inode_init (args.mp, tp, agno, args.agbno, + error =xfs_ialloc_inode_init (args.mp, tp,NULL , agno, args.agbno, args.len,prandom_u32 ());if (error)
fs/xfs/xfs_ialloc.h +8 -0
@@ -150,6 +150,14 @@ int xfs_inobt_lookup(struct xfs_btree_cur *cur, xfs_agino_t ino,int xfs_inobt_get_rec (struct xfs_btree_cur *cur,xfs_inobt_rec_incore_t *rec,int *stat); +/* +* Inode chunk initialisation routine +*/ +int xfs_ialloc_inode_init (struct xfs_mount *mp,struct xfs_trans *tp, +struct list_head *buffer_list, +xfs_agnumber_t agno,xfs_agblock_t agbno, +xfs_agblock_t length,unsigned int gen); +extern const struct xfs_buf_ops xfs_agi_buf_ops;#endif /* __XFS_IALLOC_H__ */
fs/xfs/xfs_log_recover.c +109 -5
156 lines not on this page · raw message
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 12/27 xfs: Use inode create transaction
In reply to Dave ChinnerReplace the use of buffer based logging of inode initialisation, uses the new logical form to describe the range to be initialised in recovery. We continue to "log" the inode buffers to push them into the AIL and ensure that the inode create transaction is not removed from the log before the inode buffers are written to disk.
Update the transaction identifier and reservations to match the changed implementation.
--- fs/xfs/xfs_buf_item.c | 12 ++++++++++-- fs/xfs/xfs_ialloc.c | 32 +++++++++++++++++++++++--------- 2 files changed, 33 insertions(+), 11 deletions(-)
fs/xfs/xfs_buf_item.c +10 -2
@@ -310,13 +310,21 @@ xfs_buf_item_format(/* * If it is an inode buffer, transfer the in-memory state to the -* format flags and clear the in-memory state. We do not transfer +* format flags and clear the in-memory state. +* +* For buffer based inode allocation, we do not transfer * this state if the inode buffer allocation has not yet been committed * to the log as setting the XFS_BLI_INODE_BUF flag will prevent * correct replay of the inode allocation. +* +* For icreate item based inode allocation, the buffers aren't written +* to the journal during allocation, and hence we should always tag the +* buffer as an inode buffer so that the correct unlinked list replay +* occurs during recovery. */ if (bip->bli_flags &XFS_BLI_INODE_BUF ) { -if (!((bip->bli_flags &XFS_BLI_INODE_ALLOC_BUF ) && +if (xfs_sb_version_hascrc (&lip->li_mountp->m_sb) || + !((bip->bli_flags &XFS_BLI_INODE_ALLOC_BUF ) &&xfs_log_item_in_current_chkpt (lip))) bip->__bli_format.blf_flags |=XFS_BLF_INODE_BUF ; bip->bli_flags &= ~XFS_BLI_INODE_BUF ;
fs/xfs/xfs_ialloc.c +23 -9
@@ -38,6 +38,7 @@#include "xfs_bmap.h" #include "xfs_cksum.h" #include "xfs_buf_item.h" +#include "xfs_icreate_item.h" /*
@@ -155,7 +156,7 @@ xfs_check_agi_freecount(* than logging them (which in a transaction context puts them into the AIL * for writeback rather than the xfsbufd queue). */ -STATIC int +int xfs_ialloc_inode_init( struct xfs_mount *mp, struct xfs_trans *tp,
@@ -212,6 +213,18 @@ xfs_ialloc_inode_init( version =3 ; ino =XFS_AGINO_TO_INO (mp, agno,XFS_OFFBNO_TO_AGINO (mp, agbno,0 )); + +/* +* log the initialisation that is about to take place as an +* logical operation. This means the transaction does not +* need to log the physical changes to the inode buffers as log +* recovery will know what initialisation is actually needed. +* Hence we only need to log the buffers as "ordered" buffers so +* they track in the AIL as if they were physically logged. +*/ +if (tp) +xfs_icreate_log (tp, agno, agbno,XFS_IALLOC_INODES (mp), + mp->m_sb.sb_inodesize, length, gen); }else if (xfs_sb_version_hasnlink (&mp->m_sb)) version =2 ;else
@@ -227,13 +240,8 @@ xfs_ialloc_inode_init( XBF_UNMAPPED);if (!fbuf)return ENOMEM ; -/* -* Initialize all inodes in this buffer and then log them. -* -* XXX: It would be much better if we had just one transaction -* to log a whole cluster of inodes instead of all the -* individual transactions causing a lot of log traffic. -*/ + +/* Initialize the inode buffers and log them appropriately. */ fbuf->b_ops = &xfs_inode_buf_ops;xfs_buf_zero (fbuf,0 ,BBTOB (fbuf->b_length));for (i =0 ; i < ninodes; i++) {
@@ -269,7 +277,13 @@ xfs_ialloc_inode_init(*/ xfs_trans_inode_alloc_buf (tp, fbuf);if (version ==3 ) { -/* need to log the entire buffer */ +/* +* Mark the buffer as ordered so that they are +* not physically logged in the transaction but +* still tracked in the AIL as part of the +* transaction and pin the log appropriately. +*/ +xfs_trans_ordered_buf (tp, fbuf);xfs_trans_log_buf (tp, fbuf,0 ,BBTOB (fbuf->b_length) -1 ); }
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 13/27 xfs: remove local fork format handling from xfs_bmapi_write()
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The conversion from local format to extent format requires interpretation of the data in the fork being converted, so it cannot be done in a generic way. It is up to the caller to convert the fork format to extent format before calling into xfs_bmapi_write() so format conversion can be done correctly.
The code in xfs_bmapi_write() to convert the format is used implicitly by the attribute and directory code, but they specifically zero the fork size so that the conversion does not do any allocation or manipulation. Move this conversion into the shortform to leaf functions for the dir/attr code so the conversions are explicitly controlled by all callers.
Now we can remove the conversion code in xfs_bmapi_write.
--- fs/xfs/xfs_attr_leaf.c | 2 + fs/xfs/xfs_bmap.c | 199 ++++++++++++++++++++--------------------------- fs/xfs/xfs_bmap.h | 1 + fs/xfs/xfs_dir2_block.c | 20 +++-- 4 files changed, 98 insertions(+), 124 deletions(-)
fs/xfs/xfs_attr_leaf.c +2 -0
@@ -690,6 +690,8 @@ xfs_attr_shortform_to_leaf(xfs_da_args_t *args) sf = (xfs_attr_shortform_t *)tmpbuffer;xfs_idata_realloc (dp, -size,XFS_ATTR_FORK ); +xfs_bmap_local_to_extents_empty (dp,XFS_ATTR_FORK ); + bp =NULL ; error =xfs_da_grow_inode (args, &blkno);if (error) {
fs/xfs/xfs_bmap.c +83 -116
257 lines not on this page · raw message
fs/xfs/xfs_bmap.h +1 -0
@@ -172,6 +172,7 @@ void xfs_bmap_trace_exlist(struct xfs_inode *ip, xfs_extnum_t cnt,#endif int xfs_bmap_add_attrfork (struct xfs_inode *ip,int size,int rsvd); +void xfs_bmap_local_to_extents_empty (struct xfs_inode *ip,int whichfork);void xfs_bmap_add_free (xfs_fsblock_t bno,xfs_filblks_t len,struct xfs_bmap_free *flist,struct xfs_mount *mp);void xfs_bmap_cancel (struct xfs_bmap_free *flist);
fs/xfs/xfs_dir2_block.c +12 -8
@@ -29,6 +29,7 @@#include "xfs_dinode.h" #include "xfs_inode.h" #include "xfs_inode_item.h" +#include "xfs_bmap.h" #include "xfs_buf_item.h" #include "xfs_dir2.h" #include "xfs_dir2_format.h"
@@ -1167,13 +1168,15 @@ xfs_dir2_sf_to_block(__be16 *tagp;/* end of data entry */ xfs_trans_t *tp;/* transaction pointer */ struct xfs_name name; +struct xfs_ifork *ifp;trace_xfs_dir2_sf_to_block (args); dp = args->dp; tp = args->trans; mp = dp->i_mount; -ASSERT (dp->i_df.if_flags &XFS_IFINLINE ); + ifp =XFS_IFORK_PTR (dp,XFS_DATA_FORK ); +ASSERT (ifp->if_flags &XFS_IFINLINE );/* * Bomb out if the shortform directory is way too short. */
@@ -1182,22 +1185,23 @@ xfs_dir2_sf_to_block(return XFS_ERROR (EIO ); } - oldsfp = (xfs_dir2_sf_hdr_t *)dp->i_df.if_u1.if_data; + oldsfp = (xfs_dir2_sf_hdr_t *)ifp->if_u1.if_data; -ASSERT (dp->i_df.if_bytes == dp->i_d.di_size); -ASSERT (dp->i_df.if_u1.if_data !=NULL ); +ASSERT (ifp->if_bytes == dp->i_d.di_size); +ASSERT (ifp->if_u1.if_data !=NULL );ASSERT (dp->i_d.di_size >=xfs_dir2_sf_hdr_size (oldsfp->i8count)); +ASSERT (dp->i_d.di_nextents ==0 );/* * Copy the directory into a temporary buffer. * Then pitch the incore inode data so we can make extents. */ - sfp =kmem_alloc (dp->i_df.if_bytes,KM_SLEEP ); -memcpy (sfp, oldsfp, dp->i_df.if_bytes); + sfp =kmem_alloc (ifp->if_bytes,KM_SLEEP ); +memcpy (sfp, oldsfp, ifp->if_bytes); -xfs_idata_realloc (dp, -dp->i_df.if_bytes,XFS_DATA_FORK ); +xfs_idata_realloc (dp, -ifp->if_bytes,XFS_DATA_FORK ); +xfs_bmap_local_to_extents_empty (dp,XFS_DATA_FORK ); dp->i_d.di_size =0 ; -xfs_trans_log_inode (tp, dp,XFS_ILOG_CORE );/* * Add block 0 to the inode.
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 14/27 xfs: move getdents code into it's own file
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The directory readdir code isno used by userspace, but it is intermingled with files that are shared with userspace. This makes it difficult to compare the differences between the userspac eand kernel files are the userspace files don't have the getdents code in them. Move all the kernel getdents code to a separate file to bring the shared content between userspace and kernel files closer together.
--- fs/xfs/Makefile | 1 + fs/xfs/xfs_dir2.c | 34 --- fs/xfs/xfs_dir2_block.c | 100 +------ fs/xfs/xfs_dir2_leaf.c | 391 --------------------------- fs/xfs/xfs_dir2_priv.h | 2 + fs/xfs/xfs_dir2_readdir.c | 661 +++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_dir2_sf.c | 99 ------- 7 files changed, 665 insertions(+), 623 deletions(-) create mode 100644 fs/xfs/xfs_dir2_readdir.c
fs/xfs/Makefile +1 -0
@@ -30,6 +30,7 @@ xfs-y += xfs_aops.o \ xfs_bit.o \ xfs_buf.o \ xfs_dfrag.o \ + xfs_dir2_readdir.o \ xfs_discard.o \ xfs_error.o \ xfs_export.o \
fs/xfs/xfs_dir2.c +0 -34
@@ -363,40 +363,6 @@ xfs_dir_removename( }/* -* Read a directory. -*/ -int -xfs_readdir ( -xfs_inode_t *dp, -void *dirent, -size_t bufsize, -xfs_off_t *offset, -filldir_t filldir) -{ -int rval;/* return value */ -int v;/* type-checking value */ - -trace_xfs_readdir (dp); - -if (XFS_FORCED_SHUTDOWN (dp->i_mount)) -return XFS_ERROR (EIO ); - -ASSERT (S_ISDIR (dp->i_d.di_mode)); -XFS_STATS_INC (xs_dir_getdents); - -if (dp->i_d.di_format ==XFS_DINODE_FMT_LOCAL ) - rval =xfs_dir2_sf_getdents (dp, dirent, offset, filldir); -else if ((rval =xfs_dir2_isblock (NULL , dp, &v))) - ; -else if (v) - rval =xfs_dir2_block_getdents (dp, dirent, offset, filldir); -else - rval =xfs_dir2_leaf_getdents (dp, dirent, bufsize, offset, - filldir); -return rval; -} - -/* * Replace the inode number of a directory entry. */ int
fs/xfs/xfs_dir2_block.c +1 -99
112 lines not on this page · raw message
fs/xfs/xfs_dir2_leaf.c +0 -391
397 lines not on this page · raw message
fs/xfs/xfs_dir2_priv.h +2 -0
@@ -32,6 +32,8 @@ extern int xfs_dir_cilookup_result(struct xfs_da_args *args,/* xfs_dir2_block.c */ extern const struct xfs_buf_ops xfs_dir3_block_buf_ops; +extern int xfs_dir3_block_read (struct xfs_trans *tp,struct xfs_inode *dp, +struct xfs_buf **bpp);extern int xfs_dir2_block_addname (struct xfs_da_args *args);extern int xfs_dir2_block_getdents (struct xfs_inode *dp,void *dirent,xfs_off_t *offset,filldir_t filldir);
fs/xfs/xfs_dir2_readdir.c new file +661 -0
661 lines not on this page · raw message
fs/xfs/xfs_dir2_sf.c +0 -99
105 lines not on this page · raw message
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 15/27 xfs: reshuffle dir2 definitions around for userspace
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Many of the definitions within xfs_dir2_priv.h are needed in userspace outside libxfs. Definitions within xfs_dir2_priv.h are wholly contained within libxfs, so we need to shuffle some of the definitions around to keep consistency across files shared between user and kernel space.
--- fs/xfs/xfs_dir2.h | 71 ++++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_dir2_data.c | 1 + fs/xfs/xfs_dir2_format.h | 24 ---------------- fs/xfs/xfs_dir2_leaf.c | 1 + fs/xfs/xfs_dir2_node.c | 1 + fs/xfs/xfs_dir2_priv.h | 31 -------------------- fs/xfs/xfs_dir2_sf.c | 4 +-- fs/xfs/xfs_file.c | 3 +- fs/xfs/xfs_log_recover.c | 2 +- 9 files changed, 78 insertions(+), 60 deletions(-)
fs/xfs/xfs_dir2.h +71 -0
@@ -23,10 +23,35 @@ struct xfs_da_args;struct xfs_inode ;struct xfs_mount ;struct xfs_trans ; +struct xfs_dir2_sf_hdr ; +struct xfs_dir2_sf_entry ; +struct xfs_dir2_data_hdr ; +struct xfs_dir2_data_entry ; +struct xfs_dir2_data_unused ;extern struct xfs_name xfs_name_dotdot;/* +* Directory type definitions +*/ + +/* Byte offset in data block and shortform entry. */ +typedef __uint16_t xfs_dir2_data_off_t ; +#define NULLDATAOFF 0xffffU +typedef uint xfs_dir2_data_aoff_t ;/* argument form */ + +/* Offset in data space of a data entry. */ +typedef __uint32_t xfs_dir2_dataptr_t ; +#define XFS_DIR2_MAX_DATAPTR ((xfs_dir2_dataptr_t)0xffffffff) +#define XFS_DIR2_NULL_DATAPTR ((xfs_dir2_dataptr_t)0) + +/* Byte offset in a directory. */ +typedef xfs_off_t xfs_dir2_off_t ; + +/* Directory block number (logical dirblk in file) */ +typedef __uint32_t xfs_dir2_db_t ; + +/* * Generic directory interface routines */ extern void xfs_dir_startup (void );
@@ -57,4 +82,50 @@ extern int xfs_dir_canenter(struct xfs_trans *tp, struct xfs_inode *dp,*/ extern int xfs_dir2_sf_to_block (struct xfs_da_args *args); +/* +* Direct call on directory open, before entering the readdir code. +*/ +extern int xfs_dir3_data_readahead (struct xfs_trans *tp,struct xfs_inode *dp, +xfs_dablk_t bno,xfs_daddr_t mapped_bno); + +/* +* Interface routines used by userspace utilities +*/ +extern xfs_ino_t xfs_dir2_sf_get_parent_ino (struct xfs_dir2_sf_hdr *sfp); +extern void xfs_dir2_sf_put_parent_ino (struct xfs_dir2_sf_hdr *sfp, +xfs_ino_t ino); +extern xfs_ino_t xfs_dir2_sfe_get_ino (struct xfs_dir2_sf_hdr *sfp, +struct xfs_dir2_sf_entry *sfep); +extern void xfs_dir2_sfe_put_ino (struct xfs_dir2_sf_hdr *, +struct xfs_dir2_sf_entry *sfep,xfs_ino_t ino); + +extern int xfs_dir2_isblock (struct xfs_trans *tp,struct xfs_inode *dp,int *r); +extern int xfs_dir2_isleaf (struct xfs_trans *tp,struct xfs_inode *dp,int *r); +extern int xfs_dir2_shrink_inode (struct xfs_da_args *args,xfs_dir2_db_t db, +struct xfs_buf *bp); + +extern void xfs_dir2_data_freescan (struct xfs_mount *mp, +struct xfs_dir2_data_hdr *hdr,int *loghead); +extern void xfs_dir2_data_log_entry (struct xfs_trans *tp,struct xfs_buf *bp, +struct xfs_dir2_data_entry *dep); +extern void xfs_dir2_data_log_header (struct xfs_trans *tp, +struct xfs_buf *bp); +extern void xfs_dir2_data_log_unused (struct xfs_trans *tp,struct xfs_buf *bp, +struct xfs_dir2_data_unused *dup); +extern void xfs_dir2_data_make_free (struct xfs_trans *tp,struct xfs_buf *bp, +xfs_dir2_data_aoff_t offset,xfs_dir2_data_aoff_t len, +int *needlogp,int *needscanp); +extern void xfs_dir2_data_use_free (struct xfs_trans *tp,struct xfs_buf *bp, +struct xfs_dir2_data_unused *dup,xfs_dir2_data_aoff_t offset, +xfs_dir2_data_aoff_t len,int *needlogp,int *needscanp); + +extern struct xfs_dir2_data_free *xfs_dir2_data_freefind ( +struct xfs_dir2_data_hdr *hdr,struct xfs_dir2_data_unused *dup); + +extern const struct xfs_buf_ops xfs_dir3_block_buf_ops; +extern const struct xfs_buf_ops xfs_dir3_leafn_buf_ops; +extern const struct xfs_buf_ops xfs_dir3_leaf1_buf_ops; +extern const struct xfs_buf_ops xfs_dir3_free_buf_ops; +extern const struct xfs_buf_ops xfs_dir3_data_buf_ops; +#endif /* __XFS_DIR2_H__ */
fs/xfs/xfs_dir2_data.c +1 -0
@@ -28,6 +28,7 @@#include "xfs_bmap_btree.h" #include "xfs_dinode.h" #include "xfs_inode.h" +#include "xfs_dir2.h" #include "xfs_dir2_format.h" #include "xfs_dir2_priv.h" #include "xfs_error.h"
fs/xfs/xfs_dir2_format.h +0 -24
@@ -69,36 +69,12 @@#define XFS_DIR3_FREE_MAGIC 0x58444633/* XDF3: free index blocks */ /* -* Byte offset in data block and shortform entry. -*/ -typedef __uint16_t xfs_dir2_data_off_t ; -#define NULLDATAOFF 0xffffU -typedef uint xfs_dir2_data_aoff_t ;/* argument form */ - -/* * Normalized offset (in a data block) of the entry, really xfs_dir2_data_off_t. * Only need 16 bits, this is the byte offset into the single block form. */ typedef struct { __uint8_t i[2]; } __arch_pack xfs_dir2_sf_off_t;/* -* Offset in data space of a data entry. -*/ -typedef __uint32_t xfs_dir2_dataptr_t ; -#define XFS_DIR2_MAX_DATAPTR ((xfs_dir2_dataptr_t)0xffffffff) -#define XFS_DIR2_NULL_DATAPTR ((xfs_dir2_dataptr_t)0) - -/* -* Byte offset in a directory. -*/ -typedef xfs_off_t xfs_dir2_off_t ; - -/* -* Directory block number (logical dirblk in file) -*/ -typedef __uint32_t xfs_dir2_db_t ; - -/* * Inode number stored as 8 8-bit values. */ typedef struct {__uint8_t i[8 ]; }xfs_dir2_ino8_t ;
fs/xfs/xfs_dir2_leaf.c +1 -0
@@ -30,6 +30,7 @@#include "xfs_dinode.h" #include "xfs_inode.h" #include "xfs_bmap.h" +#include "xfs_dir2.h" #include "xfs_dir2_format.h" #include "xfs_dir2_priv.h" #include "xfs_error.h"
fs/xfs/xfs_dir2_node.c +1 -0
@@ -29,6 +29,7 @@#include "xfs_dinode.h" #include "xfs_inode.h" #include "xfs_bmap.h" +#include "xfs_dir2.h" #include "xfs_dir2_format.h" #include "xfs_dir2_priv.h" #include "xfs_error.h"
fs/xfs/xfs_dir2_priv.h +0 -31
@@ -20,18 +20,12 @@/* xfs_dir2.c */ extern int xfs_dir_ino_validate (struct xfs_mount *mp,xfs_ino_t ino); -extern int xfs_dir2_isblock (struct xfs_trans *tp,struct xfs_inode *dp,int *r); -extern int xfs_dir2_isleaf (struct xfs_trans *tp,struct xfs_inode *dp,int *r);extern int xfs_dir2_grow_inode (struct xfs_da_args *args,int space,xfs_dir2_db_t *dbp); -extern int xfs_dir2_shrink_inode (struct xfs_da_args *args,xfs_dir2_db_t db, -struct xfs_buf *bp);extern int xfs_dir_cilookup_result (struct xfs_da_args *args,const unsigned char *name,int len);/* xfs_dir2_block.c */ -extern const struct xfs_buf_ops xfs_dir3_block_buf_ops; -extern int xfs_dir3_block_read (struct xfs_trans *tp,struct xfs_inode *dp,struct xfs_buf **bpp);extern int xfs_dir2_block_addname (struct xfs_da_args *args);
@@ -50,39 +44,17 @@ extern int xfs_dir2_leaf_to_block(struct xfs_da_args *args,#define xfs_dir3_data_check (dp,bp)#endif -extern const struct xfs_buf_ops xfs_dir3_data_buf_ops; -extern const struct xfs_buf_ops xfs_dir3_free_buf_ops; -extern int __xfs_dir3_data_check (struct xfs_inode *dp,struct xfs_buf *bp);extern int xfs_dir3_data_read (struct xfs_trans *tp,struct xfs_inode *dp,xfs_dablk_t bno,xfs_daddr_t mapped_bno,struct xfs_buf **bpp); -extern int xfs_dir3_data_readahead (struct xfs_trans *tp,struct xfs_inode *dp, -xfs_dablk_t bno,xfs_daddr_t mapped_bno);extern struct xfs_dir2_data_free *xfs_dir2_data_freeinsert (struct xfs_dir2_data_hdr *hdr,struct xfs_dir2_data_unused *dup,int *loghead); -extern void xfs_dir2_data_freescan (struct xfs_mount *mp, -struct xfs_dir2_data_hdr *hdr,int *loghead);extern int xfs_dir3_data_init (struct xfs_da_args *args,xfs_dir2_db_t blkno,struct xfs_buf **bpp); -extern void xfs_dir2_data_log_entry (struct xfs_trans *tp,struct xfs_buf *bp, -struct xfs_dir2_data_entry *dep); -extern void xfs_dir2_data_log_header (struct xfs_trans *tp, -struct xfs_buf *bp); -extern void xfs_dir2_data_log_unused (struct xfs_trans *tp,struct xfs_buf *bp, -struct xfs_dir2_data_unused *dup); -extern void xfs_dir2_data_make_free (struct xfs_trans *tp,struct xfs_buf *bp, -xfs_dir2_data_aoff_t offset,xfs_dir2_data_aoff_t len, -int *needlogp,int *needscanp); -extern void xfs_dir2_data_use_free (struct xfs_trans *tp,struct xfs_buf *bp, -struct xfs_dir2_data_unused *dup,xfs_dir2_data_aoff_t offset, -xfs_dir2_data_aoff_t len,int *needlogp,int *needscanp);/* xfs_dir2_leaf.c */ -extern const struct xfs_buf_ops xfs_dir3_leaf1_buf_ops; -extern const struct xfs_buf_ops xfs_dir3_leafn_buf_ops; -extern int xfs_dir3_leafn_read (struct xfs_trans *tp,struct xfs_inode *dp,xfs_dablk_t fbno,xfs_daddr_t mappedbno,struct xfs_buf **bpp); extern int xfs_dir2_block_to_leaf(struct xfs_da_args *args,
@@ -146,9 +118,6 @@ extern int xfs_dir2_free_read(struct xfs_trans *tp, struct xfs_inode *dp, xfs_dablk_t fbno, struct xfs_buf **bpp);/* xfs_dir2_sf.c */ -extern xfs_ino_t xfs_dir2_sf_get_parent_ino (struct xfs_dir2_sf_hdr *sfp); -extern xfs_ino_t xfs_dir2_sfe_get_ino (struct xfs_dir2_sf_hdr *sfp, -struct xfs_dir2_sf_entry *sfep);extern int xfs_dir2_block_sfsize (struct xfs_inode *dp,struct xfs_dir2_data_hdr *block,struct xfs_dir2_sf_hdr *sfhp); extern int xfs_dir2_block_to_sf(struct xfs_da_args *args, struct xfs_buf *bp,
fs/xfs/xfs_dir2_sf.c +2 -2
@@ -95,7 +95,7 @@ xfs_dir2_sf_get_parent_ino(return xfs_dir2_sf_get_ino (hdr, &hdr->parent); } -static void +void xfs_dir2_sf_put_parent_ino (struct xfs_dir2_sf_hdr *hdr,xfs_ino_t ino)
@@ -123,7 +123,7 @@ xfs_dir2_sfe_get_ino(return xfs_dir2_sf_get_ino (hdr,xfs_dir2_sfe_inop (sfep)); } -static void +void xfs_dir2_sfe_put_ino( struct xfs_dir2_sf_hdr *hdr, struct xfs_dir2_sf_entry *sfep,
fs/xfs/xfs_file.c +1 -2
@@ -31,8 +31,7 @@#include "xfs_error.h" #include "xfs_vnodeops.h" #include "xfs_da_btree.h" -#include "xfs_dir2_format.h" -#include "xfs_dir2_priv.h" +#include "xfs_dir2.h" #include "xfs_ioctl.h" #include "xfs_trace.h"
fs/xfs/xfs_log_recover.c +1 -1
@@ -50,8 +50,8 @@/* Need all the magic numbers and buffer ops structures from these headers */ #include "xfs_symlink.h" #include "xfs_da_btree.h" +#include "xfs_dir2.h" #include "xfs_dir2_format.h" -#include "xfs_dir2_priv.h" #include "xfs_attr_leaf.h" #include "xfs_attr_remote.h"
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 15/27] xfs: reshuffle dir2 definitions around for userspace
Quoted 7 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Many of the definitions within
xfs_dir2_priv.hare needed in userspace outside libxfs. Definitions withinxfs_dir2_priv.hare wholly contained within libxfs, so we need to shuffle some of the definitions around to keep consistency across files shared between user and kernel space.
I created the xfs_dir2_format.h header so that it would be self contained. Despite not mentioning it in the description this patch also moves typedefs out of xfs_dir2_format.h which is something I'd rather avoid. Where in userspace would we need these defintions but can't include xfs_dir2_format.h?
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 15/27] xfs: reshuffle dir2 definitions around for userspace
Quoted 9 lines · Christoph Hellwig
Quoted 7 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Many of the definitions within
xfs_dir2_priv.hare needed in userspace outside libxfs. Definitions withinxfs_dir2_priv.hare wholly contained within libxfs, so we need to shuffle some of the definitions around to keep consistency across files shared between user and kernel space.
Quoted 5 lines
I created the
xfs_dir2_format.hheader so that it would be self contained. Despite not mentioning it in the description this patch also moves typedefs out ofxfs_dir2_format.hwhich is something I'd rather avoid. Where in userspace would we need these defintions but can't includexfs_dir2_format.h?
They are needed by the declarations of the public dir2 functions used by userspace. i.e. they aren't just on-disk format definitions
- they are API definitions as well.
This was one of the problems I had with the previous libxfs/kernel sync - converting all the userspace code to use xfs_dir2_format.h. I had no idea exactly how you intended to structure the usrespace code, and so I was really flying blind.
The separation of dir2.h/format.h/priv.h is fine from the kernel side, but I found that a significant number of functions declared in xfs_dir2_priv.h are actually public functions in userspace and so need to be in xfs_dir2.h, not xfs_dir2_priv.h. And then that requires the definitions from xfs_fir2_format.h for the function prototypes in xfs_dir2.h....
Having just done all the other __KERNEL__ changes, I see this dir2 change in a different light now. I can probably rework the userspace includes to include xfs_dir2_format.h before xfs_dir2.h and hence remove the need to modify xfs_dir2_format.h...
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 15/27] xfs: reshuffle dir2 definitions around for userspace
Quoted 32 lines · Dave Chinner
Quoted 9 lines · Christoph Hellwig
Quoted 7 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Many of the definitions within
xfs_dir2_priv.hare needed in userspace outside libxfs. Definitions withinxfs_dir2_priv.hare wholly contained within libxfs, so we need to shuffle some of the definitions around to keep consistency across files shared between user and kernel space.Quoted 5 lines
I created the
xfs_dir2_format.hheader so that it would be self contained. Despite not mentioning it in the description this patch also moves typedefs out ofxfs_dir2_format.hwhich is something I'd rather avoid. Where in userspace would we need these defintions but can't includexfs_dir2_format.h?They are needed by the declarations of the public dir2 functions used by userspace. i.e. they aren't just on-disk format definitions
- they are API definitions as well.This was one of the problems I had with the previous libxfs/kernel sync - converting all the userspace code to use
xfs_dir2_format.h. I had no idea exactly how you intended to structure the usrespace code, and so I was really flying blind.The separation of
dir2.h/format.h/priv.his fine from the kernel side, but I found that a significant number of functions declared inxfs_dir2_priv.hare actually public functions in userspace and so need to be inxfs_dir2.h, notxfs_dir2_priv.h. And then that requires the definitions fromxfs_fir2_format.hfor the function prototypes inxfs_dir2.h....
Quoted 4 lines
Having just done all the other
__KERNEL__changes, I see this dir2 change in a different light now. I can probably rework the userspace includes to includexfs_dir2_format.hbeforexfs_dir2.hand hence remove the need to modifyxfs_dir2_format.h...
Yes, it can. The problem was that xfs_dir2_format.h requires the definition of struct xfs_mount (due to static inline functions), but there are no such restrictions on xfs_dir2.h so it can be moved to after the include for xfs_dir2_format.h.
Ok, so xfs_dir2_format.h doesn't need to change.
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 16/27 xfs: split out attribute listing code into separate file
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The attribute listing code is not used by userspace, so like the directory readdir code, split it out into a separate file to minimise the differences between the filesystem shared with libxfs in userspace.
--- fs/xfs/Makefile | 1 + fs/xfs/xfs_attr.c | 317 +---------------------- fs/xfs/xfs_attr.h | 1 + fs/xfs/xfs_attr_leaf.c | 300 ---------------------- fs/xfs/xfs_attr_list.c | 655 ++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 658 insertions(+), 616 deletions(-) create mode 100644 fs/xfs/xfs_attr_list.c
fs/xfs/Makefile +1 -0
@@ -27,6 +27,7 @@ xfs-y += xfs_trace.o # highlevel code xfs-y += xfs_aops.o \ + xfs_attr_list.o \ xfs_bit.o \ xfs_buf.o \ xfs_dfrag.o \
fs/xfs/xfs_attr.c +1 -316
350 lines not on this page · raw message
fs/xfs/xfs_attr.h +1 -0
@@ -141,5 +141,6 @@ typedef struct xfs_attr_list_context {*/ int xfs_attr_inactive (struct xfs_inode *dp);int xfs_attr_list_int (struct xfs_attr_list_context *); +int xfs_inode_hasattr (struct xfs_inode *ip);#endif /* __XFS_ATTR_H__ */
fs/xfs/xfs_attr_leaf.c +0 -300
312 lines not on this page · raw message
fs/xfs/xfs_attr_list.c new file +655 -0
655 lines not on this page · raw message
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 17/27 xfs: split out attribute fork truncation code into separate file
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The attribute inactivation code is not used by userspace, so like the attribute listing, split it out into a separate file to minimise the differences between the filesystem shared with libxfs in userspace.
--- fs/xfs/Makefile | 1 + fs/xfs/xfs_attr.c | 71 ------- fs/xfs/xfs_attr_inactive.c | 453 ++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_attr_leaf.c | 341 --------------------------------- 4 files changed, 454 insertions(+), 412 deletions(-) create mode 100644 fs/xfs/xfs_attr_inactive.c
fs/xfs/Makefile +1 -0
@@ -27,6 +27,7 @@ xfs-y += xfs_trace.o # highlevel code xfs-y += xfs_aops.o \ + xfs_attr_inactive.o \ xfs_attr_list.o \ xfs_bit.o \ xfs_buf.o \
fs/xfs/xfs_attr.c +0 -71
77 lines not on this page · raw message
fs/xfs/xfs_attr_inactive.c new file +453 -0
453 lines not on this page · raw message
fs/xfs/xfs_attr_leaf.c +0 -341
344 lines not on this page · raw message
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 18/27 xfs: split out xfs inode operations into separate file
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The core xfs inode operations such as locking, allocation, reading and writing are not shared with userspace. However, much of the remaining internal inode code such as the incore extent tracking and formatting is. Split the XFS inode operations out into a new xfs_inode_iops.c file to minimise the differences between the files shred with userspace.
--- fs/xfs/Makefile | 1 + fs/xfs/xfs_inode.c | 2295 ++++++------------------------------------------ fs/xfs/xfs_inode.h | 341 +------ fs/xfs/xfs_inode_ops.c | 1772 +++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_inode_ops.h | 353 ++++++++ 5 files changed, 2418 insertions(+), 2344 deletions(-) create mode 100644 fs/xfs/xfs_inode_ops.c create mode 100644 fs/xfs/xfs_inode_ops.h
fs/xfs/Makefile +1 -0
@@ -42,6 +42,7 @@ xfs-y += xfs_aops.o \ xfs_fsops.o \ xfs_globals.o \ xfs_icache.o \ + xfs_inode_ops.o \ xfs_ioctl.o \ xfs_iomap.o \ xfs_iops.o \
fs/xfs/xfs_inode.c +284 -2011
2,386 lines not on this page · raw message
fs/xfs/xfs_inode.h +8 -333
370 lines not on this page · raw message
fs/xfs/xfs_inode_ops.c new file +1772 -0
237 lines not on this page · raw message
fs/xfs/xfs_inode_ops.h new file +353 -0
353 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Part of the diff is not shown here. View the raw message.
Re: [PATCH 18/27] xfs: split out xfs inode operations into separate file
Quoted 8 lines · Dave Chinner
From: Dave Chinner <[email protected]>
The core xfs inode operations such as locking, allocation, reading and writing are not shared with userspace. However, much of the remaining internal inode code such as the incore extent tracking and formatting is. Split the XFS inode operations out into a new
xfs_inode_iops.cfile to minimise the differences between the files shred with userspace.
Having struct xfs_inode in an xfs_inode_ops.h file while xfs_inode.h is still around strikes me as extremely odd. It seems like icdinode should be in xfs_inode_item.h as is part of the log format primarily.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 18/27] xfs: split out xfs inode operations into separate file
Quoted 10 lines · Christoph Hellwig
Quoted 8 lines · Dave Chinner
From: Dave Chinner <[email protected]>
The core xfs inode operations such as locking, allocation, reading and writing are not shared with userspace. However, much of the remaining internal inode code such as the incore extent tracking and formatting is. Split the XFS inode operations out into a new
xfs_inode_iops.cfile to minimise the differences between the files shred with userspace.
Quoted 2 lines
Having struct
xfs_inodein anxfs_inode_ops.hfile whilexfs_inode.his still around strikes me as extremely odd.
Consider it a first step in a longer process....
Quoted 2 lines
It seems like icdinode
should be inxfs_inode_item.has is part of the log format primarily.
Yes, I've definitely been looking at that, because xfs_inode_item.h is shared with userspace and there are some issues with cyclic inclusion and definitions in userspace based around the fact that the icdinode is defined in xfs_inode.h and so needs to be included before the struct xfs_inode is defined in include/libxfs.h. Yet there is static inline code in xfs_inode.h that needs to know the structure of the struct xfs_inode....
So there's a bunch of issues around xfs_inode.h, and this really is the first step to cleaning it all up. What currently remains in xfs_inode.h can be moved to different files - most of what is there deals with inode forks or the xfs_icdinode, and so if I move them to specific header files we ned up with an empty xfs_inode.h header.
At taht point, we can stop sharing xfs_inode.h with userspace, and we can move all the kernel-only inode defintions back into xfs_inode.h, and #include all the other header files with the shared definitions directly. Userspace can do the same thing through libxfs.h....
Indeed, the underlying reason for all this separation is that in the medium term, __KERNEL__ is going to be removed from the kernel build. That's the direction being set by all the UAPI work that David Howells has been doing, and XFS is really a special snowflake when it comes to headers and userspace code sharing. Hence I'm trying to restructure the code now while we are doing lots of userspace work.
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 18/27] xfs: split out xfs inode operations into separate file
Quoted 19 lines · Dave Chinner
Quoted 10 lines · Christoph Hellwig
Quoted 8 lines · Dave Chinner
From: Dave Chinner <[email protected]>
The core xfs inode operations such as locking, allocation, reading and writing are not shared with userspace. However, much of the remaining internal inode code such as the incore extent tracking and formatting is. Split the XFS inode operations out into a new
xfs_inode_iops.cfile to minimise the differences between the files shred with userspace.Quoted 2 lines
Having struct
xfs_inodein anxfs_inode_ops.hfile whilexfs_inode.his still around strikes me as extremely odd.Consider it a first step in a longer process....
Quoted 2 lines
It seems like icdinode
should be inxfs_inode_item.has is part of the log format primarily.
Quoted 7 lines
Yes, I've definitely been looking at that, because
xfs_inode_item.his shared with userspace and there are some issues with cyclic inclusion and definitions in userspace based around the fact that the icdinode is defined inxfs_inode.hand so needs to be included before the structxfs_inodeis defined ininclude/libxfs.h. Yet there is static inline code inxfs_inode.hthat needs to know the structure of the structxfs_inode....
And this is where it gets sticky. The xfs_inode_ops.h header has a dependency on struct xfs_icdinode. Moving that to xfs_inode_item.h means that we now have a dependencies of:
xfs_inode_ops.h requires
xfs_inode_item.h requires:
xfs_trans.h requires:
xfs_log.h
which are new. And it also introduces a circular dependency as xfs_inode_item.h has a dependency on the struct xfs_inode already being defined, so it can't be included before struct xfs_inode is defined.....
As it is, xfs_inode_item.h still has a section under #ifdef __KERNEL__. It's the section dealing with the struct inode_log_item, and all the other logitem header files have similar kernel only sections. libxfs has it's own definitions for these structures, so what we've got here is the shared on-disk log format definitions and kernel-only log item definitions sharing the same files in the kernel tree.
So what I really think needs to happen here first is similar to the dir2 header file re-org. That is, a header file to define the format, and a header file to define the in-kernel structures and APIs....
The header files in XFS have never been properly sorted out - it's about time we cleaned up this mess ;)
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 18/27] xfs: split out xfs inode operations into separate file
Quoted 4 lines · Dave Chinner
So what I really think needs to happen here first is similar to the dir2 header file re-org. That is, a header file to define the format, and a header file to define the in-kernel structures and APIs....
Yes, I think we need to do this rather sooner than later. In fact I'd feeling we need to tackle the whole header mess first before splitting the .c files. Making sure the on-disk format is in one or just a few headers is the most important bit of that.
These days I'm actually of the opinion that we probably should be even more drastic about cutting the number of headers. For the on disk format a xfs_format.h for all the regular on disk format and maybe and xfs_log_format.h should be more than enough.
But back to the _ops.c naming. I really hate it and the best counter proposals I can come up with is to add a _common postfix to every file intended to be shared with userspace. Using a directly also would make sense, but for some reason Kbuild always had problems with modules built from multiple directories and I'm more than glad that we finally managed to get rid of the subdirectories.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 18/27] xfs: split out xfs inode operations into separate file
Hey Christoph,
Quoted 11 lines · Christoph Hellwig
Quoted 4 lines · Dave Chinner
So what I really think needs to happen here first is similar to the dir2 header file re-org. That is, a header file to define the format, and a header file to define the in-kernel structures and APIs....
Yes, I think we need to do this rather sooner than later. In fact I'd feeling we need to tackle the whole header mess first before splitting the .c files. Making sure the on-disk format is in one or just a few headers is the most important bit of that.
Quoted 4 lines
These days I'm actually of the opinion that we probably should be even more drastic about cutting the number of headers. For the on disk format a
xfs_format.hfor all the regular on disk format and maybe andxfs_log_format.hshould be more than enough.
I like the idea of having the entire on-disk format in just a few files. It would be a nice clean up. I don't know if splitting the .c files needs to wait on it though.
Quoted 3 lines
But back to the
_ops.cnaming. I really hate it and the best counter proposals I can come up with is to add a_commonpostfix to every file intended to be shared with userspace.
I don't understand what you don't like about the _ops.c naming...
Quoted 4 lines
Using a directly also would make
sense, but for some reasonKbuildalways had problems with modules built from multiple directories and I'm more than glad that we finally managed to get rid of the subdirectories.
but I really like the libxfs subdirectory idea. Any idea if the Kbuild issues are sorted out?
-Ben
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 18/27] xfs: split out xfs inode operations into separate file
Quoted 14 lines · Ben Myers
Hey Christoph,
Quoted 11 lines · Christoph Hellwig
Quoted 4 lines · Dave Chinner
So what I really think needs to happen here first is similar to the dir2 header file re-org. That is, a header file to define the format, and a header file to define the in-kernel structures and APIs....
Yes, I think we need to do this rather sooner than later. In fact I'd feeling we need to tackle the whole header mess first before splitting the .c files. Making sure the on-disk format is in one or just a few headers is the most important bit of that.
Quoted 8 lines
Quoted 4 lines
These days I'm actually of the opinion that we probably should be even more drastic about cutting the number of headers. For the on disk format a
xfs_format.hfor all the regular on disk format and maybe andxfs_log_format.hshould be more than enough.I like the idea of having the entire on-disk format in just a few files. It would be a nice clean up. I don't know if splitting the .c files needs to wait on it though.
I've got patches that separate out all shared user/kernel header information now. They QA'd OK overnight, so I'll post them in a short while. There's no more __KERNEL__ definitions in the code after the patch set...
Quoted 5 lines
Quoted 3 lines
But back to the
_ops.cnaming. I really hate it and the best counter proposals I can come up with is to add a_commonpostfix to every file intended to be shared with userspace.I don't understand what you don't like about the
_ops.cnaming...
I can make xfs_inode_ops.[ch] go away as xfs_inode.[ch] is no longer shared with userspace and contain kernel-only functionality. I didn't go as far as moving everything back into xfs_inode.[ch] because we want to merge some of it with xfs_iops.c, some with xfs_ialloc.c, etc...
Quoted 7 lines
Quoted 4 lines
Using a directly also would make
sense, but for some reasonKbuildalways had problems with modules built from multiple directories and I'm more than glad that we finally managed to get rid of the subdirectories.but I really like the libxfs subdirectory idea. Any idea if the
Kbuildissues are sorted out?
No idea - I don't know the issue is.
However, if the issue has been fixed (or could be easily solved) then it seems like there is a rough agreement on moving towards a common shared libxfs base?
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 18/27] xfs: split out xfs inode operations into separate file
Quoted 20 lines · Dave Chinner
Quoted 19 lines · Ben Myers
Hey Christoph,
Quoted 15 lines · Christoph Hellwig
Quoted 4 lines · Dave Chinner
So what I really think needs to happen here first is similar to the dir2 header file re-org. That is, a header file to define the format, and a header file to define the in-kernel structures and APIs....
Yes, I think we need to do this rather sooner than later. In fact I'd feeling we need to tackle the whole header mess first before splitting the .c files. Making sure the on-disk format is in one or just a few headers is the most important bit of that.
These days I'm actually of the opinion that we probably should be even more drastic about cutting the number of headers. For the on disk format a
xfs_format.hfor all the regular on disk format and maybe andxfs_log_format.hshould be more than enough.
Quoted 8 lines
Quoted 3 lines
I like the idea of having the entire on-disk format in just a few files. It would be a nice clean up. I don't know if splitting the .c files needs to wait on it though.
I've got patches that separate out all shared user/kernel header information now. They QA'd OK overnight, so I'll post them in a short while. There's no more
__KERNEL__definitions in the code after the patch set...
Cool, sounds good.
Quoted 17 lines
Quoted 5 lines
Quoted 3 lines
But back to the
_ops.cnaming. I really hate it and the best counter proposals I can come up with is to add a_commonpostfix to every file intended to be shared with userspace.I don't understand what you don't like about the
_ops.cnaming...I can make xfs_inode_ops.[ch] go away as xfs_inode.[ch] is no longer shared with userspace and contain kernel-only functionality. I didn't go as far as moving everything back into xfs_inode.[ch] because we want to merge some of it with
xfs_iops.c, some withxfs_ialloc.c, etc...Quoted 5 lines
Quoted 4 lines
Using a directly also would make
sense, but for some reasonKbuildalways had problems with modules built from multiple directories and I'm more than glad that we finally managed to get rid of the subdirectories.
Quoted 8 lines
Quoted 2 lines
but I really like the libxfs subdirectory idea. Any idea if the
Kbuildissues are sorted out?No idea - I don't know the issue is.
However, if the issue has been fixed (or could be easily solved) then it seems like there is a rough agreement on moving towards a common shared libxfs base?
Yeah, it sounds like it... regardless of whether it goes into a separate directory. I would also be good to get that old xfstest going again. Looks like it was 040.
-Ben
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 18/27] xfs: split out xfs inode operations into separate file
Quoted 12 lines · Ben Myers
Quoted 11 lines · Dave Chinner
Quoted 7 lines · Ben Myers
Quoted 4 lines
Using a directly also would make
sense, but for some reasonKbuildalways had problems with modules built from multiple directories and I'm more than glad that we finally managed to get rid of the subdirectories.but I really like the libxfs subdirectory idea. Any idea if the
Kbuildissues are sorted out?No idea - I don't know the issue is.
Quoted 7 lines
Quoted 3 lines
However, if the issue has been fixed (or could be easily solved) then it seems like there is a rough agreement on moving towards a common shared libxfs base?
Yeah, it sounds like it... regardless of whether it goes into a separate directory. I would also be good to get that old xfstest going again. Looks like it was 040.
Which was dependent on the old integrated Irix ptools source tree structure for xfs-cmds (i.e. prior to separate GPL source trees for xfsprogs, etc). It hasn't been updated since 2003 and so doesn't even have "supported_os" tag in it. I'm pretty sure that getting it to "work" is more hassle than it's worth because the diffs will never been clean like they were on irix where libxfs was an ism link to the kernel code from within the xfs-cmds ism...
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 19/27 xfs: consolidate xfs_vnodeops.c into xfs_inode_ops.c
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Now we have xfs_inode_ops.c for holding kernel-only XFS inode operations, move all the operations from xfs_vnodeops.c to this new file as it holds another set of kernel-only inode operations. The name of this file traces back to the days of Irix and it's vnodes, so it's more relevant to the current code to move them to the inode operations file...
This consolidates some inode locking functions, some EOF preallocation functions, and a bunch of xfs inode operations into the one file.
This leaves only internal preallocation and hole punching functions in vnodeops.c. Rename this file to xfs_extent_ops.c so we have a place to consolidate all the various in-kernel physical extent manipulation and querying functions.
--- fs/xfs/Makefile | 2 +- fs/xfs/xfs_acl.c | 1 - fs/xfs/xfs_aops.c | 1 - fs/xfs/xfs_attr.c | 1 - fs/xfs/xfs_attr.h | 8 + fs/xfs/xfs_bmap.c | 1 - fs/xfs/xfs_dfrag.c | 1 - fs/xfs/xfs_dir2.c | 1 - fs/xfs/xfs_dir2.h | 3 + fs/xfs/xfs_export.c | 1 - fs/xfs/xfs_extent_ops.c | 771 +++++++++++++++++++ fs/xfs/xfs_extent_ops.h | 24 + fs/xfs/xfs_file.c | 2 +- fs/xfs/xfs_icache.c | 1 - fs/xfs/xfs_inode.c | 1 - fs/xfs/xfs_inode_ops.c | 1146 ++++++++++++++++++++++++++++- fs/xfs/xfs_inode_ops.h | 24 +- fs/xfs/xfs_ioctl.c | 37 +- fs/xfs/xfs_ioctl.h | 6 + fs/xfs/xfs_ioctl32.c | 1 - fs/xfs/xfs_iops.c | 2 +- fs/xfs/xfs_iops.h | 13 + fs/xfs/xfs_rename.c | 1 - fs/xfs/xfs_super.c | 1 - fs/xfs/xfs_vnodeops.c | 1874 ----------------------------------------------- fs/xfs/xfs_vnodeops.h | 56 -- fs/xfs/xfs_xattr.c | 1 - 27 files changed, 1994 insertions(+), 1987 deletions(-) create mode 100644 fs/xfs/xfs_extent_ops.c create mode 100644 fs/xfs/xfs_extent_ops.h delete mode 100644 fs/xfs/xfs_vnodeops.c delete mode 100644 fs/xfs/xfs_vnodeops.h
fs/xfs/Makefile +1 -1
@@ -37,6 +37,7 @@ xfs-y += xfs_aops.o \ xfs_error.o \ xfs_export.o \ xfs_extent_busy.o \ + xfs_extent_ops.o \ xfs_file.o \ xfs_filestream.o \ xfs_fsops.o \
@@ -52,7 +53,6 @@ xfs-y += xfs_aops.o \ xfs_rename.o \ xfs_super.o \ xfs_utils.o \ - xfs_vnodeops.o \ xfs_xattr.o \ kmem.o \ uuid.o
fs/xfs/xfs_acl.c +0 -1
@@ -20,7 +20,6 @@#include "xfs_attr.h" #include "xfs_bmap_btree.h" #include "xfs_inode.h" -#include "xfs_vnodeops.h" #include "xfs_sb.h" #include "xfs_mount.h" #include "xfs_trace.h"
fs/xfs/xfs_aops.c +0 -1
@@ -28,7 +28,6 @@#include "xfs_alloc.h" #include "xfs_error.h" #include "xfs_iomap.h" -#include "xfs_vnodeops.h" #include "xfs_trace.h" #include "xfs_bmap.h" #include <linux/aio.h>
fs/xfs/xfs_attr.c +0 -1
@@ -38,7 +38,6 @@#include "xfs_error.h" #include "xfs_quota.h" #include "xfs_trans_space.h" -#include "xfs_vnodeops.h" #include "xfs_trace.h" /*
fs/xfs/xfs_attr.h +8 -0
@@ -142,5 +142,13 @@ typedef struct xfs_attr_list_context {int xfs_attr_inactive (struct xfs_inode *dp);int xfs_attr_list_int (struct xfs_attr_list_context *);int xfs_inode_hasattr (struct xfs_inode *ip); +int xfs_attr_get (struct xfs_inode *ip,const unsigned char *name, +unsigned char *value,int *valuelenp,int flags); +int xfs_attr_set (struct xfs_inode *dp,const unsigned char *name, +unsigned char *value,int valuelen,int flags); +int xfs_attr_remove (struct xfs_inode *dp,const unsigned char *name,int flags); +int xfs_attr_list (struct xfs_inode *dp,char *buffer,int bufsize, +int flags,struct attrlist_cursor_kern *cursor); +#endif /* __XFS_ATTR_H__ */
fs/xfs/xfs_bmap.c +0 -1
@@ -46,7 +46,6 @@#include "xfs_trans_space.h" #include "xfs_buf_item.h" #include "xfs_filestream.h" -#include "xfs_vnodeops.h" #include "xfs_trace.h" #include "xfs_symlink.h"
fs/xfs/xfs_dfrag.c +0 -1
@@ -31,7 +31,6 @@#include "xfs_itable.h" #include "xfs_dfrag.h" #include "xfs_error.h" -#include "xfs_vnodeops.h" #include "xfs_trace.h"
fs/xfs/xfs_dir2.c +0 -1
@@ -35,7 +35,6 @@#include "xfs_dir2_format.h" #include "xfs_dir2_priv.h" #include "xfs_error.h" -#include "xfs_vnodeops.h" #include "xfs_trace.h" struct xfs_name xfs_name_dotdot = { (unsigned char *)".." ,2 };
fs/xfs/xfs_dir2.h +3 -0
@@ -87,6 +87,9 @@ extern int xfs_dir2_sf_to_block(struct xfs_da_args *args);*/ extern int xfs_dir3_data_readahead (struct xfs_trans *tp,struct xfs_inode *dp,xfs_dablk_t bno,xfs_daddr_t mapped_bno); +extern int xfs_readdir (struct xfs_inode *dp,void *dirent,size_t bufsize, +xfs_off_t *offset,filldir_t filldir); +/* * Interface routines used by userspace utilities
fs/xfs/xfs_export.c +0 -1
@@ -24,7 +24,6 @@#include "xfs_dir2.h" #include "xfs_mount.h" #include "xfs_export.h" -#include "xfs_vnodeops.h" #include "xfs_bmap_btree.h" #include "xfs_inode.h" #include "xfs_inode_item.h"
fs/xfs/xfs_extent_ops.c new file +771 -0
771 lines not on this page · raw message
fs/xfs/xfs_extent_ops.h new file +24 -0
@@ -0,0 +1,24 @@ +/* +* Copyright (c) 2000-2005 Silicon Graphics, Inc. +* All Rights Reserved. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation. +* +* This program is distributed in the hope that it would be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write the Free Software Foundation, +* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ +#ifndef _XFS_EXTENT_OPS_H +#define _XFS_EXTENT_OPS_H 1 + +int xfs_change_file_space (struct xfs_inode *ip,int cmd, +xfs_flock64_t *bf,xfs_off_t offset,int attr_flags); + +#endif /* _XFS_EXTENT_OPS_H */
fs/xfs/xfs_file.c +1 -1
@@ -29,11 +29,11 @@#include "xfs_inode_item.h" #include "xfs_bmap.h" #include "xfs_error.h" -#include "xfs_vnodeops.h" #include "xfs_da_btree.h" #include "xfs_dir2.h" #include "xfs_ioctl.h" #include "xfs_trace.h" +#include "xfs_extent_ops.h" #include <linux/aio.h> #include <linux/dcache.h>
fs/xfs/xfs_icache.c +0 -1
@@ -31,7 +31,6 @@#include "xfs_dinode.h" #include "xfs_error.h" #include "xfs_filestream.h" -#include "xfs_vnodeops.h" #include "xfs_inode_item.h" #include "xfs_quota.h" #include "xfs_trace.h"
fs/xfs/xfs_inode.c +0 -1
@@ -43,7 +43,6 @@#include "xfs_utils.h" #include "xfs_quota.h" #include "xfs_filestream.h" -#include "xfs_vnodeops.h" #include "xfs_cksum.h" #include "xfs_trace.h" #include "xfs_icache.h"
fs/xfs/xfs_inode_ops.c +1109 -37
1,205 lines not on this page · raw message
fs/xfs/xfs_inode_ops.h +21 -3
@@ -307,9 +307,22 @@ static inline int xfs_isiflocked(struct xfs_inode *ip) ((pip)->i_d.di_mode & S_ISGID)) -/* -* xfs_inode.c prototypes. -*/ +int xfs_release (struct xfs_inode *ip); +int xfs_inactive (struct xfs_inode *ip); +int xfs_lookup (struct xfs_inode *dp,struct xfs_name *name, +struct xfs_inode **ipp,struct xfs_name *ci_name); +int xfs_create (struct xfs_inode *dp,struct xfs_name *name, +umode_t mode,xfs_dev_t rdev,struct xfs_inode **ipp); +int xfs_remove (struct xfs_inode *dp,struct xfs_name *name, +struct xfs_inode *ip); +int xfs_link (struct xfs_inode *tdp,struct xfs_inode *sip, +struct xfs_name *target_name); +int xfs_rename (struct xfs_inode *src_dp,struct xfs_name *src_name, +struct xfs_inode *src_ip,struct xfs_inode *target_dp, +struct xfs_name *target_name, +struct xfs_inode *target_ip); +int xfs_free_eofblocks (struct xfs_mount *,struct xfs_inode *,bool ); +void xfs_ilock (xfs_inode_t *,uint );int xfs_ilock_nowait (xfs_inode_t *,uint );void xfs_iunlock (xfs_inode_t *,uint );
@@ -337,6 +350,11 @@ void xfs_lock_two_inodes(xfs_inode_t *, xfs_inode_t *, uint);xfs_extlen_t xfs_get_extsz_hint (struct xfs_inode *ip); +/* from xfs_file.c */ +int xfs_zero_eof (struct xfs_inode *,xfs_off_t ,xfs_fsize_t ); +int xfs_iozero (struct xfs_inode *,loff_t ,size_t ); + +#define IHOLD (ip) \ do { \ ASSERT(atomic_read(&VFS_I(ip)->i_count) > 0) ; \
fs/xfs/xfs_ioctl.c +36 -1
@@ -36,13 +36,14 @@#include "xfs_utils.h" #include "xfs_dfrag.h" #include "xfs_fsops.h" -#include "xfs_vnodeops.h" #include "xfs_discard.h" #include "xfs_quota.h" #include "xfs_inode_item.h" #include "xfs_export.h" #include "xfs_trace.h" #include "xfs_icache.h" +#include "xfs_symlink.h" +#include "xfs_extent_ops.h" #include <linux/capability.h> #include <linux/dcache.h>
@@ -350,6 +351,40 @@ xfs_readlink_by_handle(return error; } +int +xfs_set_dmattrs ( +xfs_inode_t *ip, +u_int evmask, +u_int16_t state) +{ +xfs_mount_t *mp = ip->i_mount; +xfs_trans_t *tp; +int error; + +if (!capable (CAP_SYS_ADMIN )) +return XFS_ERROR (EPERM ); + +if (XFS_FORCED_SHUTDOWN (mp)) +return XFS_ERROR (EIO ); + + tp =xfs_trans_alloc (mp,XFS_TRANS_SET_DMATTRS ); + error =xfs_trans_reserve (tp,0 ,XFS_ICHANGE_LOG_RES (mp),0 ,0 ,0 ); +if (error) { +xfs_trans_cancel (tp,0 ); +return error; + } +xfs_ilock (ip,XFS_ILOCK_EXCL ); +xfs_trans_ijoin (tp, ip,XFS_ILOCK_EXCL ); + + ip->i_d.di_dmevmask = evmask; + ip->i_d.di_dmstate = state; + +xfs_trans_log_inode (tp, ip,XFS_ILOG_CORE ); + error =xfs_trans_commit (tp,0 ); + +return error; +} + STATIC int xfs_fssetdm_by_handle( struct file *parfilp,
fs/xfs/xfs_ioctl.h +6 -0
@@ -82,4 +82,10 @@ xfs_file_compat_ioctl(unsigned int cmd, unsigned long arg); +extern int +xfs_set_dmattrs ( +struct xfs_inode *ip, +u_int evmask, +u_int16_t state); +#endif
fs/xfs/xfs_ioctl32.c +0 -1
@@ -34,7 +34,6 @@#include "xfs_itable.h" #include "xfs_error.h" #include "xfs_dfrag.h" -#include "xfs_vnodeops.h" #include "xfs_fsops.h" #include "xfs_alloc.h" #include "xfs_rtalloc.h"
fs/xfs/xfs_iops.c +1 -1
@@ -35,10 +35,10 @@#include "xfs_attr.h" #include "xfs_buf_item.h" #include "xfs_utils.h" -#include "xfs_vnodeops.h" #include "xfs_inode_item.h" #include "xfs_trace.h" #include "xfs_icache.h" +#include "xfs_symlink.h" #include <linux/capability.h> #include <linux/xattr.h>
fs/xfs/xfs_iops.h +13 -0
@@ -27,4 +27,17 @@ extern ssize_t xfs_vn_listxattr(struct dentry *, char *data, size_t size);extern void xfs_setup_inode (struct xfs_inode *); +/* +* Internal setattr interfaces. +*/ +#define XFS_ATTR_DMI 0x01/* invocation from a DMI function */ +#define XFS_ATTR_NONBLOCK 0x02/* return EAGAIN if op would block */ +#define XFS_ATTR_NOLOCK 0x04/* Don't grab any conflicting locks */ +#define XFS_ATTR_NOACL 0x08/* Don't call xfs_acl_chmod */ +#define XFS_ATTR_SYNC 0x10/* synchronous operation required */ + +extern int xfs_setattr_nonsize (struct xfs_inode *ip,struct iattr *vap, +int flags); +extern int xfs_setattr_size (struct xfs_inode *ip,struct iattr *vap,int flags); +#endif /* __XFS_IOPS_H__ */
fs/xfs/xfs_rename.c +0 -1
@@ -34,7 +34,6 @@#include "xfs_quota.h" #include "xfs_utils.h" #include "xfs_trans_space.h" -#include "xfs_vnodeops.h" #include "xfs_trace.h"
fs/xfs/xfs_super.c +0 -1
@@ -41,7 +41,6 @@#include "xfs_attr.h" #include "xfs_buf_item.h" #include "xfs_utils.h" -#include "xfs_vnodeops.h" #include "xfs_log_priv.h" #include "xfs_trans_priv.h" #include "xfs_filestream.h"
fs/xfs/xfs_vnodeops.c deleted +0 -1874
739 lines not on this page · raw message
fs/xfs/xfs_vnodeops.h deleted +0 -56
56 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Part of the diff is not shown here. View the raw message.
Re: [PATCH 19/27] xfs: consolidate xfs_vnodeops.c into xfs_inode_ops.c
I can't say I really like the _ops naming, but so far I can't really can't come up with a much better name. I also think that most of xfs_vnodeops.c really should go into xfs_iops.c as it's fairly Linux specific and should just be merged with the actual entry points.
Also once the big code move around starts xfs_rename.c really should die and rename should be treated the same as the other namespace operations.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 19/27] xfs: consolidate xfs_vnodeops.c into xfs_inode_ops.c
Quoted 2 lines · Christoph Hellwig
I can't say I really like the
_opsnaming, but so far I can't really can't come up with a much better name.
Neither could I :(
Quoted 3 lines
I also think that most of
xfs_vnodeops.creally should go intoxfs_iops.cas it's fairly Linux specific and should just be merged with the actual entry points.
Yes, that's definitely a good end goal (merging with entry points), but what I'm trying to do now is create a solid obvious demarcation line between kernel-only and shared source files. The current code goes:
xfs_iops.c -> xfs_inode.c (shared with libxfs) -> xfs_vnodeops.c (kernel only) -> xfs_rename.c (kernel only) -> xfs_util.c (kernel only)
And there's a tricky maze of paths through those files for different locking operations, inode allocation, and so on. The real issue is that the code paths hop between shared and kernel only files, so what I'm wanting to end up with for 3.11 is a linear progression through the source files like this:
xfs_iops.c -> xfs_inode_ops.c -> xfs_inode.c -> xfs_ialloc.c
i.e:
kernel only -> kernel only -> shared with libxfs
Once there's a clear boundary in the kernel code, merging/simplifying stuff on either side of the boundary is easy to do, but it's a secondary step. I'd consider this something for the 3.12 cycle, not the upcoming 3.11 cycle.
FWIW, I seriously considering introducing a fs/xfs/libxfs/ subdir for the kernel build to make this a very obvious boundary and place all the shared headers in include/linux/uapi/xfs. This would make is extremely obvious what code is shared with userspace, and make future kernel/user srouce code syncs quite simple....
Quoted 3 lines
Also once the big code move around starts
xfs_rename.creally should die and rename should be treated the same as the other namespace operations.
Yup, I haven't got to xfs_rename.c and xfs_utils.c yet - I want them to go away, too. :) I'm just going to pull them directly into xfs_inode_ops.c to give a consistent structure for 3.11.
FWIW, now that I have the shared files in almost perfect sync, it makes it much easier to make the change in the kernel tree, take the patch, apply a couple of sed filters to it and then apply it directly to the xfsprogs tree. I only have to do the work once now, and so it's much faster to restructure the code now.
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 19/27] xfs: consolidate xfs_vnodeops.c into xfs_inode_ops.c
Quoted 8 lines · Dave Chinner
i.e:
kernel only -> kernel only -> shared with libxfsOnce there's a clear boundary in the kernel code, merging/simplifying stuff on either side of the boundary is easy to do, but it's a secondary step. I'd consider this something for the 3.12 cycle, not the upcoming 3.11 cycle.
Much better.
Btw, especially in inode land we should probably share even less code with userspace. Besides my old patches to kill the struct xfs_inode abuse in repair phase 7 there isn't too much use of it left.
The db code uses inodes as temporary objects in the attrset code which looks everything but efficient, and the mkfs and repair code use it to create new files/directories. Not quite sure bringing in all the kernel code there makes so much sense given that we have other infrastructure for a lot of these in userspace anyway.
Quoted 5 lines
FWIW, now that I have the shared files in almost perfect sync, it makes it much easier to make the change in the kernel tree, take the patch, apply a couple of sed filters to it and then apply it directly to the xfsprogs tree. I only have to do the work once now, and so it's much faster to restructure the code now.
I'm very happy to see this as I'd been aiming at it for a while.
Any chance you can add a script to pull in kernel changes automatically while you're at it?
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 19/27] xfs: consolidate xfs_vnodeops.c into xfs_inode_ops.c
Quoted 10 lines · Christoph Hellwig
Quoted 8 lines · Dave Chinner
i.e:
kernel only -> kernel only -> shared with libxfsOnce there's a clear boundary in the kernel code, merging/simplifying stuff on either side of the boundary is easy to do, but it's a secondary step. I'd consider this something for the 3.12 cycle, not the upcoming 3.11 cycle.
Quoted 5 lines
Much better.
Btw, especially in inode land we should probably share even less code with userspace. Besides my old patches to kill the struct
xfs_inodeabuse in repair phase 7 there isn't too much use of it left.
Yup - we only need to shared the format defintions, the buffer operations and the inode fork macros. That's explicity all that is shared after my current patchset.
FWIW, my current patchset does this to the xfsprogs/include directory:
43 files changed, 1541 insertions(+), 3527 deletions(-)
So that will give you an idea of how much __KERNEL__ crap there is...
Quoted 5 lines
The db code uses inodes as temporary objects in the attrset code which looks everything but efficient, and the mkfs and repair code use it to create new files/directories. Not quite sure bringing in all the kernel code there makes so much sense given that we have other infrastructure for a lot of these in userspace anyway.
There's plenty that can be done there, but I think the direction we need to take db in is to be closer to libxfs than it's own special little snowflake. We need to do this for the IO subsystem to add CRC validation/calculation support, so re-using anything that libxfs already provides seems sane to me...
Quoted 10 lines
Quoted 5 lines
FWIW, now that I have the shared files in almost perfect sync, it makes it much easier to make the change in the kernel tree, take the patch, apply a couple of sed filters to it and then apply it directly to the xfsprogs tree. I only have to do the work once now, and so it's much faster to restructure the code now.
I'm very happy to see this as I'd been aiming at it for a while.
Any chance you can add a script to pull in kernel changes automatically while you're at it?
It's not quite there yet, but getting close. I'm not sure we can get to automating it without having the same libxfs/ structure in the kernel code - it's not straight forward to identify which hunks of a patch are relevant to userspace...
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 20/27 xfs: move xfs_getbmap to xfs_extent_ops.c
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
While xfs_getbmap() walks the extent tree and formats it for userspace, it's not really a core function of the block mapping API. It is a user of the interface, and one that is kernel only functionality. xfs_bmap.c is shared with libxfs, so to minimise the differences between userspace and kernel files, move the getbmap functionality to xfs_extent_ops.c. This provides a nice separation between the core functionality and implementation of kernel interfaces.
--- fs/xfs/xfs_bmap.c | 281 ---------------------------------------------- fs/xfs/xfs_bmap.h | 5 - fs/xfs/xfs_extent_ops.c | 283 +++++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_extent_ops.h | 6 + fs/xfs/xfs_iops.c | 1 + 5 files changed, 290 insertions(+), 286 deletions(-)
fs/xfs/xfs_bmap.c +0 -281
@@ -5790,287 +5790,6 @@ error0: }/* -* returns 1 for success, 0 if we failed to map the extent. -*/ -STATIC int -xfs_getbmapx_fix_eof_hole ( -xfs_inode_t *ip,/* xfs incore inode pointer */ -struct getbmapx *out,/* output structure */ -int prealloced,/* this is a file with -* preallocated data space */ -__int64_t end,/* last block requested */ -xfs_fsblock_t startblock) -{ -__int64_t fixlen; -xfs_mount_t *mp;/* file system mount point */ -xfs_ifork_t *ifp;/* inode fork pointer */ -xfs_extnum_t lastx;/* last extent pointer */ -xfs_fileoff_t fileblock; - -if (startblock ==HOLESTARTBLOCK ) { - mp = ip->i_mount; - out->bmv_block =-1 ; - fixlen =XFS_FSB_TO_BB (mp,XFS_B_TO_FSB (mp,XFS_ISIZE (ip))); - fixlen -= out->bmv_offset; -if (prealloced && out->bmv_offset + out->bmv_length == end) { -/* Came to hole at EOF. Trim it. */ -if (fixlen <=0 ) -return 0 ; - out->bmv_length = fixlen; - } - }else { -if (startblock ==DELAYSTARTBLOCK ) - out->bmv_block =-2 ; -else - out->bmv_block =xfs_fsb_to_db (ip, startblock); - fileblock =XFS_BB_TO_FSB (ip->i_mount, out->bmv_offset); - ifp =XFS_IFORK_PTR (ip,XFS_DATA_FORK ); -if (xfs_iext_bno_to_ext (ifp, fileblock, &lastx) && - (lastx == (ifp->if_bytes / (uint )sizeof (xfs_bmbt_rec_t))-1 )) - out->bmv_oflags |=BMV_OF_LAST ; - } - -return 1 ; -} - -/* -* Get inode's extents as described in bmv, and format for output. -* Calls formatter to fill the user's buffer until all extents -* are mapped, until the passed-in bmv->bmv_count slots have -* been filled, or until the formatter short-circuits the loop, -* if it is tracking filled-in extents on its own. -*/ -int /* error code */ -xfs_getbmap ( -xfs_inode_t *ip, -struct getbmapx *bmv,/* user bmap structure */ -xfs_bmap_format_t formatter,/* format to user */ -void *arg)/* formatter arg */ -{ -__int64_t bmvend;/* last block requested */ -int error =0 ;/* return value */ -__int64_t fixlen;/* length for -1 case */ -int i;/* extent number */ -int lock;/* lock state */ -xfs_bmbt_irec_t *map;/* buffer for user's data */ -xfs_mount_t *mp;/* file system mount point */ -int nex;/* # of user extents can do */ -int nexleft;/* # of user extents left */ -int subnex;/* # of bmapi's can do */ -int nmap;/* number of map entries */ -struct getbmapx *out;/* output structure */ -int whichfork;/* data or attr fork */ -int prealloced;/* this is a file with -* preallocated data space */ -int iflags;/* interface flags */ -int bmapi_flags;/* flags for xfs_bmapi */ -int cur_ext =0 ; - - mp = ip->i_mount; - iflags = bmv->bmv_iflags; - whichfork = iflags &BMV_IF_ATTRFORK ?XFS_ATTR_FORK :XFS_DATA_FORK ; - -if (whichfork ==XFS_ATTR_FORK ) { -if (XFS_IFORK_Q (ip)) { -if (ip->i_d.di_aformat !=XFS_DINODE_FMT_EXTENTS && - ip->i_d.di_aformat !=XFS_DINODE_FMT_BTREE && - ip->i_d.di_aformat !=XFS_DINODE_FMT_LOCAL ) -return XFS_ERROR (EINVAL ); - }else if (unlikely ( - ip->i_d.di_aformat !=0 && - ip->i_d.di_aformat !=XFS_DINODE_FMT_EXTENTS )) { -XFS_ERROR_REPORT ("xfs_getbmap" ,XFS_ERRLEVEL_LOW , - ip->i_mount); -return XFS_ERROR (EFSCORRUPTED ); - } - - prealloced =0 ; - fixlen =1LL <<32 ; - }else { -if (ip->i_d.di_format !=XFS_DINODE_FMT_EXTENTS && - ip->i_d.di_format !=XFS_DINODE_FMT_BTREE && - ip->i_d.di_format !=XFS_DINODE_FMT_LOCAL ) -return XFS_ERROR (EINVAL ); - -if (xfs_get_extsz_hint (ip) || - ip->i_d.di_flags & (XFS_DIFLAG_PREALLOC |XFS_DIFLAG_APPEND )){ - prealloced =1 ; - fixlen = mp->m_super->s_maxbytes; - }else { - prealloced =0 ; - fixlen =XFS_ISIZE (ip); - } - } - -if (bmv->bmv_length ==-1 ) { - fixlen =XFS_FSB_TO_BB (mp,XFS_B_TO_FSB (mp, fixlen)); - bmv->bmv_length = -max_t (__int64_t, fixlen - bmv->bmv_offset,0 ); - }else if (bmv->bmv_length ==0 ) { - bmv->bmv_entries =0 ; -return 0 ; - }else if (bmv->bmv_length <0 ) { -return XFS_ERROR (EINVAL ); - } - - nex = bmv->bmv_count -1 ; -if (nex <=0 ) -return XFS_ERROR (EINVAL ); - bmvend = bmv->bmv_offset + bmv->bmv_length; - - -if (bmv->bmv_count >ULONG_MAX /sizeof (struct getbmapx )) -return XFS_ERROR (ENOMEM ); - out =kmem_zalloc (bmv->bmv_count *sizeof (struct getbmapx ),KM_MAYFAIL ); -if (!out) { - out =kmem_zalloc_large (bmv->bmv_count * -sizeof (struct getbmapx )); -if (!out) -return XFS_ERROR (ENOMEM ); - } - -xfs_ilock (ip,XFS_IOLOCK_SHARED ); -if (whichfork ==XFS_DATA_FORK && !(iflags &BMV_IF_DELALLOC )) { -if (ip->i_delayed_blks ||XFS_ISIZE (ip) > ip->i_d.di_size) { - error = -filemap_write_and_wait (VFS_I (ip)->i_mapping); -if (error) - goto out_unlock_iolock; - } -/* -* even after flushing the inode, there can still be delalloc -* blocks on the inode beyond EOF due to speculative -* preallocation. These are not removed until the release -* function is called or the inode is inactivated. Hence we -* cannot assert here that ip->i_delayed_blks == 0. -*/ - } - - lock =xfs_ilock_map_shared (ip); - -/* -* Don't let nex be bigger than the number of extents -* we can have assuming alternating holes and real extents. -*/ -if (nex >XFS_IFORK_NEXTENTS (ip, whichfork) *2 +1 ) - nex =XFS_IFORK_NEXTENTS (ip, whichfork) *2 +1 ; - - bmapi_flags =xfs_bmapi_aflag (whichfork); -if (!(iflags &BMV_IF_PREALLOC )) - bmapi_flags |=XFS_BMAPI_IGSTATE ; - -/* -* Allocate enough space to handle "subnex" maps at a time. -*/ - error =ENOMEM ; - subnex =16 ; - map =kmem_alloc (subnex *sizeof (*map),KM_MAYFAIL |KM_NOFS ); -if (!map) - goto out_unlock_ilock; - - bmv->bmv_entries =0 ; - -if (XFS_IFORK_NEXTENTS (ip, whichfork) ==0 && - (whichfork ==XFS_ATTR_FORK || !(iflags &BMV_IF_DELALLOC ))) { - error =0 ; - goto out_free_map; - } - - nexleft = nex; - -do { - nmap = (nexleft > subnex) ? subnex : nexleft; - error =xfs_bmapi_read (ip,XFS_BB_TO_FSBT (mp, bmv->bmv_offset), -XFS_BB_TO_FSB (mp, bmv->bmv_length), - map, &nmap, bmapi_flags); -if (error) - goto out_free_map; -ASSERT (nmap <= subnex); - -for (i =0 ; i < nmap && nexleft && bmv->bmv_length; i++) { - out[cur_ext].bmv_oflags =0 ; -if (map[i].br_state ==XFS_EXT_UNWRITTEN ) - out[cur_ext].bmv_oflags |=BMV_OF_PREALLOC ; -else if (map[i].br_startblock ==DELAYSTARTBLOCK ) - out[cur_ext].bmv_oflags |=BMV_OF_DELALLOC ; - out[cur_ext].bmv_offset = -XFS_FSB_TO_BB (mp, map[i].br_startoff); - out[cur_ext].bmv_length = -XFS_FSB_TO_BB (mp, map[i].br_blockcount); - out[cur_ext].bmv_unused1 =0 ; - out[cur_ext].bmv_unused2 =0 ; - -/* -* delayed allocation extents that start beyond EOF can -* occur due to speculative EOF allocation when the -* delalloc extent is larger than the largest freespace -* extent at conversion time. These extents cannot be -* converted by data writeback, so can exist here even -* if we are not supposed to be finding delalloc -* extents. -*/ -if (map[i].br_startblock ==DELAYSTARTBLOCK && - map[i].br_startoff <=XFS_B_TO_FSB (mp,XFS_ISIZE (ip))) -ASSERT ((iflags &BMV_IF_DELALLOC ) !=0 ); - -if (map[i].br_startblock ==HOLESTARTBLOCK && - whichfork ==XFS_ATTR_FORK ) { -/* came to the end of attribute fork */ - out[cur_ext].bmv_oflags |=BMV_OF_LAST ; - goto out_free_map; - } - -if (!xfs_getbmapx_fix_eof_hole (ip, &out[cur_ext], - prealloced, bmvend, - map[i].br_startblock)) - goto out_free_map; - - bmv->bmv_offset = - out[cur_ext].bmv_offset + - out[cur_ext].bmv_length; - bmv->bmv_length = -max_t (__int64_t,0 , bmvend - bmv->bmv_offset); - -/* -* In case we don't want to return the hole, -* don't increase cur_ext so that we can reuse -* it in the next loop. -*/ -if ((iflags &BMV_IF_NO_HOLES ) && - map[i].br_startblock ==HOLESTARTBLOCK ) { -memset (&out[cur_ext],0 ,sizeof (out[cur_ext])); -continue ; - } - - nexleft--; - bmv->bmv_entries++; - cur_ext++; - } - }while (nmap && nexleft && bmv->bmv_length); - - out_free_map: -kmem_free (map); - out_unlock_ilock: -xfs_iunlock_map_shared (ip, lock); - out_unlock_iolock: -xfs_iunlock (ip,XFS_IOLOCK_SHARED ); - -for (i =0 ; i < cur_ext; i++) { -int full =0 ;/* user array is full */ - -/* format results & advance arg */ - error =formatter (&arg, &out[i], &full); -if (error || full) -break ; - } - -if (is_vmalloc_addr (out)) -kmem_free_large (out); -else -kmem_free (out); -return error; -} - -/* * dead simple method of punching delalyed allocation blocks from a range in * the inode. Walks a block at a time so will be slow, but is only executed in * rare error cases so the overhead is not critical. This will alays punch out
fs/xfs/xfs_bmap.h +0 -5
@@ -18,7 +18,6 @@#ifndef __XFS_BMAP_H__#define __XFS_BMAP_H__ -struct getbmap ;struct xfs_bmbt_irec ;struct xfs_ifork ;struct xfs_inode ;
@@ -206,13 +205,9 @@ int xfs_check_nostate_extents(struct xfs_ifork *ifp, xfs_extnum_t idx,uint xfs_default_attroffset (struct xfs_inode *ip);#ifdef __KERNEL__ -/* bmap to userspace formatter - copy to user & advance pointer */ -typedef int (*xfs_bmap_format_t )(void **,struct getbmapx *,int *);int xfs_bmap_finish (struct xfs_trans **tp,struct xfs_bmap_free *flist,int *committed); -int xfs_getbmap (struct xfs_inode *ip,struct getbmapx *bmv, -xfs_bmap_format_t formatter,void *arg);int xfs_bmap_eof (struct xfs_inode *ip,xfs_fileoff_t endoff,int whichfork,int *eof); int xfs_bmap_count_blocks(struct xfs_trans *tp, struct xfs_inode *ip,
fs/xfs/xfs_extent_ops.c +283 -0
292 lines not on this page · raw message
fs/xfs/xfs_extent_ops.h +6 -0
@@ -21,4 +21,10 @@int xfs_change_file_space (struct xfs_inode *ip,int cmd,xfs_flock64_t *bf,xfs_off_t offset,int attr_flags); +/* bmap to userspace formatter - copy to user & advance pointer */ +typedef int (*xfs_bmap_format_t )(void **,struct getbmapx *,int *); + +int xfs_getbmap (struct xfs_inode *ip,struct getbmapx *bmv, +xfs_bmap_format_t formatter,void *arg); +#endif /* _XFS_EXTENT_OPS_H */
fs/xfs/xfs_iops.c +1 -0
@@ -39,6 +39,7 @@#include "xfs_trace.h" #include "xfs_icache.h" #include "xfs_symlink.h" +#include "xfs_extent_ops.h" #include <linux/capability.h> #include <linux/xattr.h>
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 21/27 xfs: introduce xfs_sb.c for sharing with libxfs
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
xfs_mount.c is shared with userspace, but the only functions that are shared are to do with physical superblock manipulations. This means that less than 25% of the xfs_mount.c code is actually shared with userspace. Move all the superblock functions to xfs_sb.c and share that instead with libxfs.
Note that this will leave all the in-core transaction related superblock counter modifications in xfs_mount.c as none of that is shared with userspace. With a few more small changes, xfs_mount.h won't need to be shared with userspace anymore, either.
--- fs/xfs/Makefile | 3 +- fs/xfs/xfs_mount.c | 828 ++++++---------------------------------------------- fs/xfs/xfs_mount.h | 19 +- fs/xfs/xfs_sb.c | 714 ++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_sb.h | 19 ++ 5 files changed, 821 insertions(+), 762 deletions(-) create mode 100644 fs/xfs/xfs_sb.c
fs/xfs/Makefile +2 -1
@@ -49,6 +49,7 @@ xfs-y += xfs_aops.o \ xfs_iops.o \ xfs_itable.o \ xfs_message.o \ + xfs_mount.o \ xfs_mru_cache.o \ xfs_rename.o \ xfs_super.o \
@@ -78,7 +79,7 @@ xfs-y += xfs_alloc.o \ xfs_icreate_item.o \ xfs_inode.o \ xfs_log_recover.o \ - xfs_mount.o \ + xfs_sb.o \ xfs_symlink.o \ xfs_trans.o
fs/xfs/xfs_mount.c +84 -744
895 lines not on this page · raw message
fs/xfs/xfs_mount.h +2 -17
@@ -334,14 +334,6 @@ xfs_daddr_to_agbno(struct xfs_mount *mp, xfs_daddr_t d) }/* -* perag get/put wrappers for ref counting -*/ -struct xfs_perag *xfs_perag_get (struct xfs_mount *mp,xfs_agnumber_t agno); -struct xfs_perag *xfs_perag_get_tag (struct xfs_mount *mp,xfs_agnumber_t agno, -int tag); -void xfs_perag_put (struct xfs_perag *pag); - -/* * Per-cpu superblock locking functions */ #ifdef HAVE_PERCPU_SB
@@ -373,6 +365,8 @@ typedef struct xfs_mod_sb {extern int xfs_log_sbcount (xfs_mount_t *);extern __uint64_t xfs_default_resblks (xfs_mount_t *mp);extern int xfs_mountfs (xfs_mount_t *mp); +extern int xfs_initialize_perag (xfs_mount_t *mp,xfs_agnumber_t agcount, +xfs_agnumber_t *maxagi);extern void xfs_unmountfs (xfs_mount_t *);extern int xfs_mod_incore_sb (xfs_mount_t *,xfs_sb_field_t ,int64_t ,int );
@@ -391,13 +385,4 @@ extern void xfs_set_low_space_thresholds(struct xfs_mount *);#endif /* __KERNEL__ */ -extern void xfs_sb_calc_crc (struct xfs_buf *); -extern void xfs_mod_sb (struct xfs_trans *,__int64_t ); -extern int xfs_initialize_perag (struct xfs_mount *,xfs_agnumber_t , -xfs_agnumber_t *); -extern void xfs_sb_from_disk (struct xfs_sb *,struct xfs_dsb *); -extern void xfs_sb_to_disk (struct xfs_dsb *,struct xfs_sb *,__int64_t ); - -extern const struct xfs_buf_ops xfs_sb_buf_ops; -#endif /* __XFS_MOUNT_H__ */
fs/xfs/xfs_sb.c new file +714 -0
714 lines not on this page · raw message
fs/xfs/xfs_sb.h +19 -0
@@ -26,6 +26,7 @@struct xfs_buf ;struct xfs_mount ; +struct xfs_trans ;#define XFS_SB_MAGIC 0x58465342/* 'XFSB' */ #define XFS_SB_VERSION_1 1/* 5.3, 6.0.1, 6.1 */
@@ -654,4 +655,22 @@ xfs_sb_has_incompat_log_feature(#define XFS_B_TO_FSBT (mp,b) (((__uint64_t)(b)) >> (mp)->m_sb.sb_blocklog)#define XFS_B_FSB_OFFSET (mp,b) ((b) & (mp)->m_blockmask) +/* +* perag get/put wrappers for ref counting +*/ +extern struct xfs_perag *xfs_perag_get (struct xfs_mount *,xfs_agnumber_t ); +extern struct xfs_perag *xfs_perag_get_tag (struct xfs_mount *,xfs_agnumber_t , +int tag); +extern void xfs_perag_put (struct xfs_perag *pag); +extern int xfs_initialize_perag_data (struct xfs_mount *,xfs_agnumber_t ); + +extern void xfs_sb_calc_crc (struct xfs_buf *); +extern void xfs_mod_sb (struct xfs_trans *,__int64_t ); +extern void xfs_sb_mount_common (struct xfs_mount *,struct xfs_sb *); +extern void xfs_sb_from_disk (struct xfs_sb *,struct xfs_dsb *); +extern void xfs_sb_to_disk (struct xfs_dsb *,struct xfs_sb *,__int64_t ); + +extern const struct xfs_buf_ops xfs_sb_buf_ops; +extern const struct xfs_buf_ops xfs_sb_quiet_buf_ops; +#endif /* __XFS_SB_H__ */
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 22/27 xfs: move xfs_trans_reservations to xfs_trans.h
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
struct xfs_trans_reservations is the only non kernel-only definition in xfs_mount.h. Move it to xfs_trans.h so that we no longer need xfs_mount.h in the userspace code. Most places that include xfs_mount.h already include xfs_trans.h and xfs_trans.h is shared with userspace, so there are no major concerns about moving this structure there.
While in xfs-mount.h, remove the remaining two #defines that are defined for userspace - the kernel code has a separate definition of the macros so this is purely userspace code. This allows us to remove the __KERNEL__ switches from xfs_mount.h entirely.
--- fs/xfs/xfs_acl.c | 2 ++ fs/xfs/xfs_buf.c | 1 + fs/xfs/xfs_discard.c | 1 + fs/xfs/xfs_mount.h | 44 +------------------------------------------- fs/xfs/xfs_quotaops.c | 1 + fs/xfs/xfs_trans.h | 33 +++++++++++++++++++++++++++++++++ 6 files changed, 39 insertions(+), 43 deletions(-)
fs/xfs/xfs_acl.c +2 -0
@@ -21,6 +21,8 @@#include "xfs_bmap_btree.h" #include "xfs_inode.h" #include "xfs_sb.h" +#include "xfs_log.h" +#include "xfs_trans.h" #include "xfs_mount.h" #include "xfs_trace.h" #include <linux/slab.h>
fs/xfs/xfs_buf.c +1 -0
@@ -37,6 +37,7 @@#include "xfs_sb.h" #include "xfs_log.h" #include "xfs_ag.h" +#include "xfs_trans.h" #include "xfs_mount.h" #include "xfs_trace.h"
fs/xfs/xfs_discard.c +1 -0
@@ -19,6 +19,7 @@#include "xfs_sb.h" #include "xfs_log.h" #include "xfs_ag.h" +#include "xfs_trans.h" #include "xfs_mount.h" #include "xfs_quota.h" #include "xfs_trans.h"
fs/xfs/xfs_mount.h +1 -43
60 lines not on this page · raw message
fs/xfs/xfs_quotaops.c +1 -0
@@ -19,6 +19,7 @@#include "xfs_sb.h" #include "xfs_log.h" #include "xfs_ag.h" +#include "xfs_trans.h" #include "xfs_mount.h" #include "xfs_quota.h" #include "xfs_trans.h"
fs/xfs/xfs_trans.h +33 -0
@@ -208,6 +208,39 @@ struct xfs_log_item_desc {#define XFS_TRANS_SB_REXTENTS 0x00001000#define XFS_TRANS_SB_REXTSLOG 0x00002000 +/* +* structure for maintaining pre-calculated transaction reservations. +*/ +struct xfs_trans_reservations { +uint tr_write;/* extent alloc trans */ +uint tr_itruncate;/* truncate trans */ +uint tr_rename;/* rename trans */ +uint tr_link;/* link trans */ +uint tr_remove;/* unlink trans */ +uint tr_symlink;/* symlink trans */ +uint tr_create;/* create trans */ +uint tr_mkdir;/* mkdir trans */ +uint tr_ifree;/* inode free trans */ +uint tr_ichange;/* inode update trans */ +uint tr_growdata;/* fs data section grow trans */ +uint tr_swrite;/* sync write inode trans */ +uint tr_addafork;/* cvt inode to attributed trans */ +uint tr_writeid;/* write setuid/setgid file */ +uint tr_attrinval;/* attr fork buffer invalidation */ +uint tr_attrsetm;/* set/create an attribute at mount time */ +uint tr_attrsetrt;/* set/create an attribute at runtime */ +uint tr_attrrm;/* remove an attribute */ +uint tr_clearagi;/* clear bad agi unlinked ino bucket */ +uint tr_growrtalloc;/* grow realtime allocations */ +uint tr_growrtzero;/* grow realtime zeroing */ +uint tr_growrtfree;/* grow realtime freeing */ +uint tr_qm_sbchange;/* change quota flags */ +uint tr_qm_setqlim;/* adjust quota limits */ +uint tr_qm_dqalloc;/* allocate quota on disk */ +uint tr_qm_quotaoff;/* turn quota off */ +uint tr_qm_equotaoff;/* end of turn quota off */ +uint tr_sb;/* modify superblock */ +};/* * Per-extent log reservation for the allocation btree changes
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 23/27 xfs: sync minor header differences needed by userspace.
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Little things like exported functions, __KERNEL__ protections, and so on that ensure user and kernel shared headers are identical.
--- fs/xfs/xfs_attr.c | 1 + fs/xfs/xfs_attr_inactive.c | 1 + fs/xfs/xfs_attr_leaf.c | 1 + fs/xfs/xfs_attr_leaf.h | 2 ++ fs/xfs/xfs_attr_remote.c | 1 + fs/xfs/xfs_bmap.h | 2 ++ fs/xfs/xfs_btree.h | 2 -- fs/xfs/xfs_dir2_format.h | 3 +++ fs/xfs/xfs_fs.h | 17 +++++++++++++++++ fs/xfs/xfs_icreate_item.h | 4 ++++ fs/xfs/xfs_sb.h | 7 +++++++ fs/xfs/xfs_symlink.h | 3 ++- fs/xfs/xfs_trans.h | 8 +++----- fs/xfs/xfs_trans_priv.h | 3 +++ fs/xfs/xfs_types.h | 3 ++- 15 files changed, 49 insertions(+), 9 deletions(-)
fs/xfs/xfs_attr.c +1 -0
@@ -21,6 +21,7 @@#include "xfs_bit.h" #include "xfs_log.h" #include "xfs_trans.h" +#include "xfs_trans_priv.h" #include "xfs_sb.h" #include "xfs_ag.h" #include "xfs_mount.h"
fs/xfs/xfs_attr_inactive.c +1 -0
@@ -22,6 +22,7 @@#include "xfs_bit.h" #include "xfs_log.h" #include "xfs_trans.h" +#include "xfs_trans_priv.h" #include "xfs_sb.h" #include "xfs_ag.h" #include "xfs_mount.h"
fs/xfs/xfs_attr_leaf.c +1 -0
@@ -22,6 +22,7 @@#include "xfs_bit.h" #include "xfs_log.h" #include "xfs_trans.h" +#include "xfs_trans_priv.h" #include "xfs_sb.h" #include "xfs_ag.h" #include "xfs_mount.h"
fs/xfs/xfs_attr_leaf.h +2 -0
@@ -333,6 +333,8 @@ int xfs_attr3_leaf_read(struct xfs_trans *tp, struct xfs_inode *dp, struct xfs_buf **bpp);void xfs_attr3_leaf_hdr_from_disk (struct xfs_attr3_icleaf_hdr *to,struct xfs_attr_leafblock *from); +void xfs_attr3_leaf_hdr_to_disk (struct xfs_attr_leafblock *to, +struct xfs_attr3_icleaf_hdr *from);extern const struct xfs_buf_ops xfs_attr3_leaf_buf_ops;
fs/xfs/xfs_attr_remote.c +1 -0
@@ -22,6 +22,7 @@#include "xfs_bit.h" #include "xfs_log.h" #include "xfs_trans.h" +#include "xfs_trans_priv.h" #include "xfs_sb.h" #include "xfs_ag.h" #include "xfs_mount.h"
fs/xfs/xfs_bmap.h +2 -0
@@ -136,9 +136,11 @@ typedef struct xfs_bmalloca {char conv;/* overwriting unwritten extents */ char stack_switch;int flags; +#ifdef __KERNEL__struct completion *done;struct work_struct work;int result; +#endif /* __KERNEL__ */ } xfs_bmalloca_t;/*
fs/xfs/xfs_btree.h +0 -2
@@ -88,13 +88,11 @@ struct xfs_btree_block {#define XFS_BTREE_SBLOCK_CRC_LEN (XFS_BTREE_SBLOCK_LEN + 40)#define XFS_BTREE_LBLOCK_CRC_LEN (XFS_BTREE_LBLOCK_LEN + 48) -#define XFS_BTREE_SBLOCK_CRC_OFF \ offsetof(struct xfs_btree_block, bb_u.s.bb_crc)#define XFS_BTREE_LBLOCK_CRC_OFF \ offsetof(struct xfs_btree_block, bb_u.l.bb_crc) -/* * Generic key, ptr and record wrapper structures. *
fs/xfs/xfs_dir2_format.h +3 -0
@@ -495,6 +495,9 @@ struct xfs_dir3_leaf {#define XFS_DIR3_LEAF_CRC_OFF offsetof(struct xfs_dir3_leaf_hdr, info.crc) +extern void xfs_dir3_leaf_hdr_from_disk (struct xfs_dir3_icleaf_hdr *to, +struct xfs_dir2_leaf *from); +static inline int xfs_dir3_leaf_hdr_size (struct xfs_dir2_leaf *lp) {
fs/xfs/xfs_fs.h +17 -0
@@ -311,6 +311,17 @@ typedef struct xfs_bstat { } xfs_bstat_t;/* +* Project quota id helpers (previously projid was 16bit only +* and using two 16bit values to hold new 32bit projid was choosen +* to retain compatibility with "old" filesystems). +*/ +static inline __uint32_t +bstat_get_projid (struct xfs_bstat *bs) +{ +return (__uint32_t )bs->bs_projid_hi <<16 | bs->bs_projid_lo; +} + +/* * The user-level BulkStat Request interface structure. */ typedef struct xfs_fsop_bulkreq {
@@ -511,8 +522,14 @@ typedef struct xfs_handle {#define XFS_IOC_ERROR_INJECTION _IOW ('X', 116, struct xfs_error_injection)#define XFS_IOC_ERROR_CLEARALL _IOW ('X', 117, struct xfs_error_injection)/* XFS_IOC_ATTRCTL_BY_HANDLE -- deprecated 118 */ +/* XFS_IOC_FREEZE -- FIFREEZE 119 */ /* XFS_IOC_THAW -- FITHAW 120 */ +#ifndef FIFREEZE +#define XFS_IOC_FREEZE _IOWR('X', 119, int) +#define XFS_IOC_THAW _IOWR('X', 120, int) +#endif +#define XFS_IOC_FSSETDM_BY_HANDLE _IOW ('X', 121, struct xfs_fsop_setdm_handlereq)#define XFS_IOC_ATTRLIST_BY_HANDLE _IOW ('X', 122, struct xfs_fsop_attrlist_handlereq)#define XFS_IOC_ATTRMULTI_BY_HANDLE _IOW ('X', 123, struct xfs_fsop_attrmulti_handlereq)
fs/xfs/xfs_icreate_item.h +4 -0
@@ -36,6 +36,8 @@ struct xfs_icreate_log {__be32 icl_gen;/* inode generation number to use */ }; +#ifdef __KERNEL__ + /* in memory log item structure */ struct xfs_icreate_item { struct xfs_log_item ic_item;
@@ -49,4 +51,6 @@ void xfs_icreate_log(struct xfs_trans *tp, xfs_agnumber_t agno, unsigned int inode_size, xfs_agblock_t length, unsigned int generation); +#endif /* __KERNEL__ */ +#endif /* XFS_ICREATE_ITEM_H */
fs/xfs/xfs_sb.h +7 -0
@@ -555,6 +555,13 @@ static inline int xfs_sb_version_hasprojid32bit(xfs_sb_t *sbp) (sbp->sb_features2 & XFS_SB_VERSION2_PROJID32BIT)); } +static inline void xfs_sb_version_addprojid32bit (xfs_sb_t *sbp) +{ + sbp->sb_versionnum |=XFS_SB_VERSION_MOREBITSBIT ; + sbp->sb_features2 |=XFS_SB_VERSION2_PROJID32BIT ; + sbp->sb_bad_features2 |=XFS_SB_VERSION2_PROJID32BIT ; +} +static inline int xfs_sb_version_hascrc (xfs_sb_t *sbp) {return XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 ;
fs/xfs/xfs_symlink.h +2 -1
@@ -49,7 +49,8 @@ struct xfs_dsymlink_hdr { sizeof(struct xfs_dsymlink_hdr) : 0))int xfs_symlink_blocks (struct xfs_mount *mp,int pathlen); - +bool xfs_symlink_hdr_ok (struct xfs_mount *mp,xfs_ino_t ino,uint32_t offset, +uint32_t size,struct xfs_buf *bp);void xfs_symlink_local_to_remote (struct xfs_trans *tp,struct xfs_buf *bp,struct xfs_inode *ip,struct xfs_ifork *ifp);
fs/xfs/xfs_trans.h +3 -5
@@ -57,7 +57,8 @@ typedef struct xfs_trans_header { { XFS_LI_INODE, "XFS_LI_INODE" }, \ { XFS_LI_BUF, "XFS_LI_BUF" }, \ { XFS_LI_DQUOT, "XFS_LI_DQUOT" }, \ - { XFS_LI_QUOTAOFF, "XFS_LI_QUOTAOFF" } + { XFS_LI_QUOTAOFF, "XFS_LI_QUOTAOFF" }, \ + { XFS_LI_ICREATE, "XFS_LI_ICREATE" }/* * Transaction types. Used to distinguish types of buffers.
@@ -291,7 +292,7 @@ struct xfs_trans_reservations {#define XFS_ADDAFORK_LOG_RES (mp) ((mp)->m_reservations.tr_addafork)#define XFS_ATTRINVAL_LOG_RES (mp) ((mp)->m_reservations.tr_attrinval)#define XFS_ATTRSETM_LOG_RES (mp) ((mp)->m_reservations.tr_attrsetm) -#define XFS_ATTRSETRT_LOG_RES (mp) ((mp)->m_reservations.tr_attrsetrt) +#define XFS_ATTRSETRT_LOG_RES (mp) ((mp)->m_reservations.tr_attrsetrt)#define XFS_ATTRRM_LOG_RES (mp) ((mp)->m_reservations.tr_attrrm)#define XFS_CLEAR_AGI_BUCKET_LOG_RES (mp) ((mp)->m_reservations.tr_clearagi)#define XFS_QM_SBCHANGE_LOG_RES (mp) ((mp)->m_reservations.tr_qm_sbchange)
@@ -568,7 +569,4 @@ extern kmem_zone_t *xfs_log_item_desc_zone;#endif /* __KERNEL__ */ -void xfs_trans_init (struct xfs_mount *); -int xfs_trans_roll (struct xfs_trans **,struct xfs_inode *); -#endif /* __XFS_TRANS_H__ */
fs/xfs/xfs_trans_priv.h +3 -0
@@ -25,6 +25,9 @@ struct xfs_trans;struct xfs_ail ;struct xfs_log_vec ; + +void xfs_trans_init (struct xfs_mount *); +int xfs_trans_roll (struct xfs_trans **,struct xfs_inode *);void xfs_trans_add_item (struct xfs_trans *,struct xfs_log_item *);void xfs_trans_del_item (struct xfs_log_item *); void xfs_trans_free_items(struct xfs_trans *tp, xfs_lsn_t commit_lsn,
fs/xfs/xfs_types.h +2 -1
@@ -32,7 +32,6 @@ typedef unsigned int __uint32_t;typedef signed long long int __int64_t ;typedef unsigned long long int __uint64_t ; -typedef __uint32_t prid_t ;/* project ID */ typedef __uint32_t inst_t ;/* an instruction */ typedef __s64 xfs_off_t ;/* <file offset> type */
@@ -55,6 +54,8 @@ typedef __uint64_t __psunsigned_t;#endif /* __KERNEL__ */ +typedef __uint32_t prid_t ;/* project ID */ +typedef __uint32_t xfs_agblock_t ;/* blockno in alloc. group */ typedef __uint32_t xfs_agino_t ;/* inode # within allocation grp */ typedef __uint32_t xfs_extlen_t ;/* extent length in blocks */
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 24/27 xfs: move xfs_bmap_punch_delalloc() to xfs_aops.c
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
It is only used in that file, and delayed allocation is only used in the kernel. Hence it has to be removed from xfs_bmap.c in userspace, so to minimise the differences between kernel and userspace, move this function out of xfs_bmap.c.
--- fs/xfs/xfs_aops.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++-- fs/xfs/xfs_bmap.c | 75 ------------------------------------------------- fs/xfs/xfs_bmap.h | 2 -- 3 files changed, 78 insertions(+), 79 deletions(-)
fs/xfs/xfs_aops.c +78 -2
@@ -848,6 +848,82 @@ xfs_vm_invalidatepage(block_invalidatepage (page, offset); } + +/* +* dead simple method of punching delayed allocation blocks from a range in +* the inode. Walks a block at a time so will be slow, but is only executed in +* rare error cases so the overhead is not critical. This will alays punch out +* both the start and end blocks, even if the ranges only partially overlap +* them, so it is up to the caller to ensure that partial blocks are not +* passed in. +*/ +STATIC int +xfs_aops_punch_delalloc_range ( +struct xfs_inode *ip, +xfs_fileoff_t start_fsb, +xfs_fileoff_t length) +{ +xfs_fileoff_t remaining = length; +int error =0 ; + +ASSERT (xfs_isilocked (ip,XFS_ILOCK_EXCL )); + +do { +int done; +xfs_bmbt_irec_t imap; +int nimaps =1 ; +xfs_fsblock_t firstblock; +xfs_bmap_free_t flist; + +/* +* Map the range first and check that it is a delalloc extent +* before trying to unmap the range. Otherwise we will be +* trying to remove a real extent (which requires a +* transaction) or a hole, which is probably a bad idea... +*/ + error =xfs_bmapi_read (ip, start_fsb,1 , &imap, &nimaps, +XFS_BMAPI_ENTIRE ); + +if (error) { +/* something screwed, just bail */ +if (!XFS_FORCED_SHUTDOWN (ip->i_mount)) { +xfs_alert (ip->i_mount, +"Failed delalloc mapping lookup ino %lld fsb %lld." , + ip->i_ino, start_fsb); + } +break ; + } +if (!nimaps) { +/* nothing there */ + goto next_block; + } +if (imap.br_startblock !=DELAYSTARTBLOCK ) { +/* been converted, ignore */ + goto next_block; + } +WARN_ON (imap.br_blockcount ==0 ); + +/* +* Note: while we initialise the firstblock/flist pair, they +* should never be used because blocks should never be +* allocated or freed for a delalloc extent and hence we need +* don't cancel or finish them after the xfs_bunmapi() call. +*/ +xfs_bmap_init (&flist, &firstblock); + error =xfs_bunmapi (NULL , ip, start_fsb,1 ,0 ,1 , &firstblock, + &flist, &done); +if (error) +break ; + +ASSERT (!flist.xbf_count && !flist.xbf_first); +next_block: + start_fsb++; + remaining--; + }while (remaining >0 ); + +return error; +} +/* * If the page has delalloc buffers on it, we need to punch them out before we * invalidate the page. If we don't, we leave a stale delalloc mapping on the
@@ -893,7 +969,7 @@ xfs_aops_discard_page( goto next_buffer; start_fsb =XFS_B_TO_FSBT (ip->i_mount, offset); - error =xfs_bmap_punch_delalloc_range (ip, start_fsb,1 ); + error =xfs_aops_punch_delalloc_range (ip, start_fsb,1 );if (error) {/* something screwed, just bail */ if (!XFS_FORCED_SHUTDOWN (ip->i_mount)) {
@@ -1493,7 +1569,7 @@ xfs_vm_kill_delalloc_range(return ;xfs_ilock (ip,XFS_ILOCK_EXCL ); - error =xfs_bmap_punch_delalloc_range (ip, start_fsb, + error =xfs_aops_punch_delalloc_range (ip, start_fsb, end_fsb - start_fsb);if (error) {/* something screwed, just bail */
fs/xfs/xfs_bmap.c +0 -75
78 lines not on this page · raw message
fs/xfs/xfs_bmap.h +0 -2
@@ -214,8 +214,6 @@ int xfs_bmap_eof(struct xfs_inode *ip, xfs_fileoff_t endoff, int whichfork, int *eof);int xfs_bmap_count_blocks (struct xfs_trans *tp,struct xfs_inode *ip,int whichfork,int *count); -int xfs_bmap_punch_delalloc_range (struct xfs_inode *ip, -xfs_fileoff_t start_fsb,xfs_fileoff_t length);xfs_daddr_t xfs_fsb_to_db (struct xfs_inode *ip,xfs_fsblock_t fsb);
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 24/27] xfs: move xfs_bmap_punch_delalloc() to xfs_aops.c
Quoted 6 lines · Dave Chinner
From: Dave Chinner <[email protected]>
It is only used in that file, and delayed allocation is only used in the kernel. Hence it has to be removed from
xfs_bmap.cin userspace, so to minimise the differences between kernel and userspace, move this function out ofxfs_bmap.c.
Why not call it just xfs_punch_delalloc_range?
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 24/27] xfs: move xfs_bmap_punch_delalloc() to xfs_aops.c
Quoted 9 lines · Christoph Hellwig
Quoted 6 lines · Dave Chinner
From: Dave Chinner <[email protected]>
It is only used in that file, and delayed allocation is only used in the kernel. Hence it has to be removed from
xfs_bmap.cin userspace, so to minimise the differences between kernel and userspace, move this function out ofxfs_bmap.c.Why not call it just
xfs_punch_delalloc_range?
Sure, will do.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 25/27 xfs: split out transaction reservation code
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The transaction reservation size calculations is used by both kernel and userspace, but most of the transaction code in xfs_trans.c is kernel specific. Split all the transaction reservation code out into it's own files to make shareing with userspace simpler.
--- fs/xfs/Makefile | 3 +- fs/xfs/xfs_mount.h | 2 +- fs/xfs/xfs_trans.c | 654 +------------------------------------------ fs/xfs/xfs_trans.h | 114 +------- fs/xfs/xfs_trans_resv.c | 705 +++++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_trans_resv.h | 135 +++++++++ 6 files changed, 846 insertions(+), 767 deletions(-) create mode 100644 fs/xfs/xfs_trans_resv.c create mode 100644 fs/xfs/xfs_trans_resv.h
fs/xfs/Makefile +2 -1
@@ -53,6 +53,7 @@ xfs-y += xfs_aops.o \ xfs_mru_cache.o \ xfs_rename.o \ xfs_super.o \ + xfs_trans.o \ xfs_utils.o \ xfs_xattr.o \ kmem.o \
@@ -81,7 +82,7 @@ xfs-y += xfs_alloc.o \ xfs_log_recover.o \ xfs_sb.o \ xfs_symlink.o \ - xfs_trans.o + xfs_trans_resv.o # low-level transaction/log code xfs-y += xfs_log.o \
fs/xfs/xfs_mount.h +1 -1
@@ -134,7 +134,7 @@ typedef struct xfs_mount {int m_ialloc_blks;/* blocks in inode allocation */ int m_inoalign_mask;/* mask sb_inoalignmt if used */ uint m_qflags;/* quota status flags */ -struct xfs_trans_reservations m_reservations;/* precomputed res values */ +struct xfs_trans_resv m_reservations;/* precomputed res values */ __uint64_t m_maxicount;/* maximum inode count */ __uint64_t m_resblks;/* total reserved blocks */ __uint64_t m_resblks_avail;/* available reserved blocks */
fs/xfs/xfs_trans.c +1 -653
666 lines not on this page · raw message
fs/xfs/xfs_trans.h +2 -112
126 lines not on this page · raw message
fs/xfs/xfs_trans_resv.c new file +705 -0
705 lines not on this page · raw message
fs/xfs/xfs_trans_resv.h new file +135 -0
135 lines not on this page · raw message
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 26/27 xfs: minor cleanups
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
These come from syncing the shared userspace and kernel code. Small whitespace and trivial cleanups.
--- fs/xfs/xfs_attr_leaf.c | 12 ------------ fs/xfs/xfs_attr_remote.c | 8 +------- fs/xfs/xfs_bmap_btree.c | 4 +--- fs/xfs/xfs_inode.c | 4 ++-- 4 files changed, 4 insertions(+), 24 deletions(-)
fs/xfs/xfs_attr_leaf.c +0 -12
@@ -79,16 +79,6 @@ STATIC int xfs_attr3_leaf_figure_balance(xfs_da_state_t *state, int *number_usedbytes_in_blk1);/* -* Routines used for shrinking the Btree. -*/ -STATIC int xfs_attr3_node_inactive(xfs_trans_t **trans, xfs_inode_t *dp, -struct xfs_buf *bp,int level); -STATIC int xfs_attr3_leaf_inactive(xfs_trans_t **trans, xfs_inode_t *dp, -struct xfs_buf *bp); -STATIC int xfs_attr3_leaf_freextent(xfs_trans_t **trans, xfs_inode_t *dp, -xfs_dablk_t blkno,int blkcnt); - -/* * Utility routines. */ STATIC void xfs_attr3_leaf_moveents(struct xfs_attr_leafblock *src_leaf,
@@ -1307,7 +1297,6 @@ xfs_attr3_leaf_compact( ichdr_dst->freemap[0 ].size = ichdr_dst->firstused - ichdr_dst->freemap[0 ].base; -/* write the header back to initialise the underlying buffer */ xfs_attr3_leaf_hdr_to_disk (leaf_dst, ichdr_dst);
@@ -2712,4 +2701,3 @@ xfs_attr3_leaf_flipflags(return error; } -
fs/xfs/xfs_attr_remote.c +1 -7
@@ -250,7 +250,7 @@ xfs_attr_rmtval_copyout(int hdr_size =0 ;int byte_cnt =XFS_ATTR3_RMT_BUF_SPACE (mp,XFS_LBSIZE (mp)); - byte_cnt =min_t (int, *valuelen, byte_cnt); + byte_cnt =min (*valuelen, byte_cnt); if (xfs_sb_version_hascrc(&mp->m_sb)) { if (!xfs_attr3_rmt_hdr_ok(mp, src, ino, *offset,
@@ -544,11 +544,6 @@ xfs_attr_rmtval_remove(/* * Roll through the "value", invalidating the attribute value's blocks. -* Note that args->rmtblkcnt is the minimum number of data blocks we'll -* see for a CRC enabled remote attribute. Each extent will have a -* header, and so we may have more blocks than we realise here. If we -* fail to map the blocks correctly, we'll have problems with the buffer -* lookups. */ lblkno = args->rmtblkno; blkcnt = args->rmtblkcnt;
@@ -629,4 +624,3 @@ xfs_attr_rmtval_remove( }return (0 ); } -
fs/xfs/xfs_bmap_btree.c +1 -3
@@ -722,7 +722,7 @@ xfs_bmbt_key_diff( cur->bc_rec.b.br_startoff; } -static int +static bool xfs_bmbt_verify (struct xfs_buf *bp) {
@@ -775,7 +775,6 @@ xfs_bmbt_verify(return false;return true; - } static void
@@ -789,7 +788,6 @@ xfs_bmbt_read_verify( bp->b_target->bt_mount, bp->b_addr);xfs_buf_ioerror (bp,EFSCORRUPTED ); } - } static void
fs/xfs/xfs_inode.c +2 -2
@@ -1192,8 +1192,8 @@ xfs_iextents_copy( }/* Translate to on disk format */ -put_unaligned (cpu_to_be64 (ep->l0), &dp->l0); -put_unaligned (cpu_to_be64 (ep->l1), &dp->l1); +put_unaligned_be64 (ep->l0, &dp->l0); +put_unaligned_be64 (ep->l1, &dp->l1); dp++; copied++; }
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 27/27 xfs: fix issues that cause userspace warnings
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Some of the code shared with userspace causes compilation warnings from things turned off in the kernel code, such as differences in variable signedness. Fix those issues.
--- fs/xfs/xfs_attr_remote.c | 8 ++++---- fs/xfs/xfs_bmap.c | 3 --- fs/xfs/xfs_da_btree.c | 6 +++--- fs/xfs/xfs_dir2_node.c | 2 ++ fs/xfs/xfs_ialloc.c | 2 +- fs/xfs/xfs_rtalloc.c | 4 ++-- 6 files changed, 12 insertions(+), 13 deletions(-)
fs/xfs/xfs_attr_remote.c +4 -4
@@ -238,7 +238,7 @@ xfs_attr_rmtval_copyout(xfs_ino_t ino, int *offset, int *valuelen, - char **dst) + __uint8_t **dst) { char *src = bp->b_addr;xfs_daddr_t bno = bp->b_bn;
@@ -285,7 +285,7 @@ xfs_attr_rmtval_copyin(xfs_ino_t ino, int *offset, int *valuelen, - char **src) + __uint8_t **src) { char *dst = bp->b_addr;xfs_daddr_t bno = bp->b_bn;
@@ -338,7 +338,7 @@ xfs_attr_rmtval_get(struct xfs_mount *mp = args->dp->i_mount;struct xfs_buf *bp;xfs_dablk_t lblkno = args->rmtblkno; -char *dst = args->value; +__uint8_t *dst = args->value;int valuelen = args->valuelen;int nmap;int error;
@@ -402,7 +402,7 @@ xfs_attr_rmtval_set(struct xfs_bmbt_irec map;xfs_dablk_t lblkno;xfs_fileoff_t lfileoff =0 ; -char *src = args->value; +__uint8_t *src = args->value;int blkcnt;int valuelen;int nmap;
fs/xfs/xfs_bmap.c +0 -3
@@ -4647,12 +4647,9 @@ __xfs_bmapi_allocate(struct xfs_ifork *ifp =XFS_IFORK_PTR (bma->ip, whichfork);int tmp_logflags =0 ;int error; -int rt;ASSERT (bma->length >0 ); - rt = (whichfork ==XFS_DATA_FORK ) &&XFS_IS_REALTIME_INODE (bma->ip); -/* * For the wasdelay case, we could also just allocate the stuff asked * for in this bmap call but that wouldn't be as good.
fs/xfs/xfs_da_btree.c +3 -3
@@ -399,7 +399,7 @@ xfs_da3_split(struct xfs_da_intnode *node;struct xfs_buf *bp;int max; -int action; +int action =0 ;int error;int i;
@@ -2454,9 +2454,9 @@ static intxfs_buf_map_from_irec ( struct xfs_mount *mp, struct xfs_buf_map **mapp, - unsigned int *nmaps, + int *nmaps, struct xfs_bmbt_irec *irecs, - unsigned int nirecs) + int nirecs) { struct xfs_buf_map *map;int i;
fs/xfs/xfs_dir2_node.c +2 -0
@@ -313,11 +313,13 @@ xfs_dir2_free_log_header(struct xfs_trans *tp, struct xfs_buf *bp) { +#ifdef DEBUG xfs_dir2_free_t *free; /* freespace structure */ free = bp->b_addr;ASSERT (free->hdr.magic ==cpu_to_be32 (XFS_DIR2_FREE_MAGIC ) || free->hdr.magic ==cpu_to_be32 (XFS_DIR3_FREE_MAGIC )); +#endif xfs_trans_log_buf (tp, bp,0 ,xfs_dir3_free_hdr_size (tp->t_mountp) -1 ); }
fs/xfs/xfs_ialloc.c +1 -1
@@ -1342,7 +1342,7 @@ xfs_imap(xfs_agblock_t cluster_agbno;/* first block in inode cluster */ int error;/* error code */ int offset;/* index of inode in its buffer */ -int offset_agbno;/* blks from chunk start to inode */ +xfs_agino_t offset_agbno;/* blks from chunk start to inode */ ASSERT (ino !=NULLFSINO );
fs/xfs/xfs_rtalloc.c +2 -2
@@ -736,8 +736,8 @@ xfs_rtallocate_range( {xfs_rtblock_t end;/* end of the allocated extent */ int error;/* error value */ -xfs_rtblock_t postblock;/* first block allocated > end */ -xfs_rtblock_t preblock;/* first block allocated < start */ +xfs_rtblock_t postblock =0 ;/* first block allocated > end */ +xfs_rtblock_t preblock =0 ;/* first block allocated < start */ end = start + len -1 ;/*
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 27/27] xfs: fix issues that cause userspace warnings
Quoted 16 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Some of the code shared with userspace causes compilation warnings from things turned off in the kernel code, such as differences in variable signedness. Fix those issues.
Signed-off-by Dave Chinner <[email protected]>--- fs/xfs/xfs_attr_remote.c | 8 ++++---- fs/xfs/xfs_bmap.c | 3 --- fs/xfs/xfs_da_btree.c | 6 +++--- fs/xfs/xfs_dir2_node.c | 2 ++ fs/xfs/xfs_ialloc.c | 2 +- fs/xfs/xfs_rtalloc.c | 4 ++-- 6 files changed, 12 insertions(+), 13 deletions(-)
...
fs/xfs/xfs_ialloc.c xfs_imap( · line 1345
Quoted 11 lines
fs/xfs/xfs_ialloc.c +1
-1@@ -1342,7 +1342,7 @@ xfs_imap(xfs_agblock_t cluster_agbno;/* first block in inode cluster */ int error;/* error code */ int offset;/* index of inode in its buffer */ -int offset_agbno;/* blks from chunk start to inode */ +xfs_agino_t offset_agbno;/* blks from chunk start to inode */
xfs_agblock_t ?
Brian
Quoted 8 lines
fs/xfs/xfs_ialloc.c +0
-0ASSERT (ino !=NULLFSINO );fs/xfs/xfs_rtalloc.c +0
-0
fs/xfs/xfs_rtalloc.c xfs_rtallocate_range( · line 743
Quoted 10 lines
fs/xfs/xfs_rtalloc.c +2
-2@@ -736,8 +736,8 @@ xfs_rtallocate_range( {xfs_rtblock_t end;/* end of the allocated extent */ int error;/* error value */ -xfs_rtblock_t postblock;/* first block allocated > end */ -xfs_rtblock_t preblock;/* first block allocated < start */ +xfs_rtblock_t postblock =0 ;/* first block allocated > end */ +xfs_rtblock_t preblock =0 ;/* first block allocated < start */ end = start + len -1 ;/*
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 27/27] xfs: fix issues that cause userspace warnings
Quoted 19 lines · Brian Foster
Quoted 16 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Some of the code shared with userspace causes compilation warnings from things turned off in the kernel code, such as differences in variable signedness. Fix those issues.
Signed-off-by Dave Chinner <[email protected]>--- fs/xfs/xfs_attr_remote.c | 8 ++++---- fs/xfs/xfs_bmap.c | 3 --- fs/xfs/xfs_da_btree.c | 6 +++--- fs/xfs/xfs_dir2_node.c | 2 ++ fs/xfs/xfs_ialloc.c | 2 +- fs/xfs/xfs_rtalloc.c | 4 ++-- 6 files changed, 12 insertions(+), 13 deletions(-)...
Quoted 1 line
Quoted 12 lines
fs/xfs/xfs_ialloc.c xfs_imap( · line 1345
Quoted 10 lines
fs/xfs/xfs_ialloc.c +1
-1@@ -1342,7 +1342,7 @@ xfs_imap(xfs_agblock_t cluster_agbno;/* first block in inode cluster */ int error;/* error code */ int offset;/* index of inode in its buffer */ -int offset_agbno;/* blks from chunk start to inode */ +xfs_agino_t offset_agbno;/* blks from chunk start to inode */
xfs_agblock_t?
Good catch. Brainfart - inode allocation code, must be an agino :P
Cheers,
Dave
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 8 lines · Dave Chinner
Hi folks,
This is an update of my current patch queue for the 3.11 release cycle. This series starts on top of the patch series I posted for 3.10-rc6, and builds upon the series previously posted last week:
Just a heads up, I applied this to tot and hit a few minor build errors:
fs/xfs/xfs_dir2_readdir.c:40:1: error: static declaration of ‘xfs_dir2_sf_getdents’ follows non-static declaration In file included from fs/xfs/xfs_dir2_readdir.c:34:0:fs/xfs/xfs_dir2_priv.h:127:12: note: previous declaration of ‘xfs_dir2_sf_getdents’ was here fs/xfs/xfs_dir2_readdir.c:143:1: error: static declaration of ‘xfs_dir2_block_getdents’ follows non-static declaration In file included from fs/xfs/xfs_dir2_readdir.c:34:0:fs/xfs/xfs_dir2_priv.h:32:12: note: previous declaration of ‘xfs_dir2_block_getdents’ was here fs/xfs/xfs_dir2_readdir.c:455:1: error: static declaration of ‘xfs_dir2_leaf_getdents’ follows non-static declaration In file included from fs/xfs/xfs_dir2_readdir.c:34:0:fs/xfs/xfs_dir2_priv.h:68:12: note: previous declaration of ‘xfs_dir2_leaf_getdents’ was here
In each case, it looks like patch 14/27 (xfs: move getdents code into it's own file) moved the associated function and added a STATIC to the function definition. Given the title of the patch, I removed the STATIC's and moved on to this one:
fs/xfs/xfs_dir2_data.c:39:1: error: static declaration of ‘xfs_dir2_data_freefind’ follows non-static declaration In file included from fs/xfs/xfs_dir2_data.c:31:0:fs/xfs/xfs_dir2.h:125:35: note: previous declaration of ‘xfs_dir2_data_freefind’ was here
That one appears to be due to 15/27 (xfs: reshuffle dir2 definitions around for userspace) adding a header declaration to a static function.
diff appended for reference.
Brian
--- 8< ---
fs/xfs/xfs_dir2.h +0 -0
@@ -122,9 +122,6 @@ extern void xfs_dir2_data_use_free(struct xfs_trans
*tp, struct xfs_buf *bp,
struct xfs_dir2_data_unused *dup, xfs_dir2_data_aoff_t offset, xfs_dir2_data_aoff_t len, int *needlogp, int *needscanp);
-extern struct xfs_dir2_data_free *xfs_dir2_data_freefind(
- struct xfs_dir2_data_hdr *hdr, struct xfs_dir2_data_unused *dup);
-
extern const struct xfs_buf_ops xfs_dir3_block_buf_ops; extern const struct xfs_buf_ops xfs_dir3_leafn_buf_ops; extern const struct xfs_buf_ops xfs_dir3_leaf1_buf_ops;
fs/xfs/xfs_dir2_readdir.c +3 -3
@@ -36,7 +36,7 @@#include "xfs_trace.h" #include "xfs_bmap.h" -STATIC int +int xfs_dir2_sf_getdents( xfs_inode_t *dp, /* incore directory inode */ void *dirent,
@@ -139,7 +139,7 @@ xfs_dir2_sf_getdents(/* * Readdir for block directories. */ -STATIC int +int xfs_dir2_block_getdents( xfs_inode_t *dp, /* incore inode */ void *dirent,
@@ -451,7 +451,7 @@ out:* Getdents (readdir) for leaf and node directories. * This reads the data blocks only, so is the same for both forms. */ -STATIC int +int xfs_dir2_leaf_getdents( xfs_inode_t *dp, /* incore directory inode */ void *dirent,
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 39 lines · Brian Foster
Quoted 8 lines · Dave Chinner
Hi folks,
This is an update of my current patch queue for the 3.11 release cycle. This series starts on top of the patch series I posted for 3.10-rc6, and builds upon the series previously posted last week:
Just a heads up, I applied this to tot and hit a few minor build errors:
fs/xfs/xfs_dir2_readdir.c:40:1: error: static declaration of ‘xfs_dir2_sf_getdents’ follows non-static declaration In file included fromfs/xfs/xfs_dir2_readdir.c:34:0:fs/xfs/xfs_dir2_priv.h:127:12: note: previous declaration of ‘xfs_dir2_sf_getdents’ was herefs/xfs/xfs_dir2_readdir.c:143:1: error: static declaration of ‘xfs_dir2_block_getdents’ follows non-static declaration In file included fromfs/xfs/xfs_dir2_readdir.c:34:0:fs/xfs/xfs_dir2_priv.h:32:12: note: previous declaration of ‘xfs_dir2_block_getdents’ was herefs/xfs/xfs_dir2_readdir.c:455:1: error: static declaration of ‘xfs_dir2_leaf_getdents’ follows non-static declaration In file included fromfs/xfs/xfs_dir2_readdir.c:34:0:fs/xfs/xfs_dir2_priv.h:68:12: note: previous declaration of ‘xfs_dir2_leaf_getdents’ was hereIn each case, it looks like patch 14/27 (xfs: move getdents code into it's own file) moved the associated function and added a STATIC to the function definition. Given the title of the patch, I removed the STATIC's and moved on to this one:
fs/xfs/xfs_dir2_data.c:39:1: error: static declaration of ‘xfs_dir2_data_freefind’ follows non-static declaration In file included fromfs/xfs/xfs_dir2_data.c:31:0:fs/xfs/xfs_dir2.h:125:35: note: previous declaration of ‘xfs_dir2_data_freefind’ was here
Quoted 4 lines
That one appears to be due to 15/27 (xfs: reshuffle dir2 definitions around for userspace) adding a header declaration to a static function.
diff appended for reference.
Oh, I haven't build a non-debug version of the kernel. My bad. I'll fix it up.
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Hey Dave,
Quoted 1 line · Dave Chinner
Thoughts, comments, flames?
Do you have any performance numbers recorded for the block queue plugging for bulkstat and the new inode create transaction?
-Ben
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 7 lines · Ben Myers
Hey Dave,
Quoted 1 line · Dave Chinner
Thoughts, comments, flames?
Do you have any performance numbers recorded for the block queue plugging for bulkstat and the new inode create transaction?
The new inode create transaction doesn't change performance on my test rigs. It significantly reduces log traffic under heavey create workloads (up to 50% lower). However, given the reduction is only from 60MB/s down to 30MB/s at 110,000 inodes/s being created, log performance is not a performance limiting factor on any of my test rigs.
That said, the reason for the change is not so much for immediate improvements in inode create performance. Want to allocate a stripe width of inodes at a time? The new transaction can do that atomically....
Ordered buffers allow all sorts of interesting things to be done - do you want to add an ext3/4 style data=ordered mode? We can do that with ordered buffers. Synchronous writes of remote attribute data? Ordered buffers can be used to make that async and driven by AIL flushing.
Want to use intent-based logging for operations rather than physical object logging? Ordered log items and metadata stamped with the last modification LSN are necessary, and with this icreate transaction we end up with all the pieces we need to do this....
And for bulkstat, performance differences were documented in this email where I found the problem:
http://oss.sgi.com/pipermail/xfs/2013-June/026922.html
It took a mulithreaded bulkstat from being IO bound at 450,000 inodes/s @ 220MB/s and 27,000 IOPS to being CPU bound at 750,000 inodes/s @ 350MB/s and 14000 IOPS.
And given that it increased IO sizes from 8k to 16k for 256 byte inodes and to 32k for 512 byte inodes, that is going to increase performance on any busy filesystem simply through the fact that bulkstat IOPS overhead goes down by a factor of 2/4/8/16 depending on inode size.....
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs