xfs: patch queue for 3.11
Subsystems (2)
cover xfs: patch queue for 3.11
Hi Folks,
This is my patch queue for 3.11 as it stands right now.
The first 27 patches have been posted previously, and I've addressed these comments directly:
- non-debug static function prblems (Brian)
- agblock_t in xfs-ialloc.c (Brian)
- xfs-dir2_format.h changes reverted, now included before xfs_dir2.h (Christoph)
- rename xfs_aops_punch_delalloc_range() (Christoph)
The next set of patches then build on this and implement the first part of where the discussions went - the removal of __KERNEL__ from all the XFS code. This generally takes the form of:
- split on-disk format definitions into a separate header
- include the header in the original it came from
- share the new header file with userspace
- repeat until all definitions are split out and the only thing is left in the orignal header is #includes and ifdef __KERNEL__ sections.
- remove the ifdef __KERNEL__, as this header file is no longer shared with userspace.
The same process is done for the .c files, resulting in .c files that contain only kernel code or only code shared with libxfs in userspace.
This has resulted in some less than optimal code locality, mostly to do with xfs_inode_ops.c. The code is kernel only, and it's in that file because it all related to inode operatianos. However, some are internal core operations, some are interfaces that the VFS inode operations just wrap around, and some are related more closely to inode allocation than anything else. Hence more thought and effort needs to be put into factoring and merging this kernel code back into the most appropriate places, and that is work for a future release.
The final part of the patchset is a rebase of Jeff Liu's log size validation patch set. This calculates the minimum size of the log that we should have to guarantee that we don't end up with transactions being too large for the log. This is an issue because mkfs currently doesn't take into account the log stripe unit padding that is necessary when calculating the log size, and this can drive the size of transaction over the maximum size the log can safely support.
This code will warn on existing filesystems at mount time if the log is smaller than the minimum safe size, and for CRC enabled filesystems it will abort immediately as it is expected that you are using a mkfs binary that has this problem fixed.
Overall, there is a lot of code movement in the patch set. The tail of the diffstat looks like:
113 files changed, 14734 insertions(+), 13221 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_bmap_util.c
create mode 100644 fs/xfs/xfs_bmap_util.h
create mode 100644 fs/xfs/xfs_buf_item_format.h
delete mode 100644 fs/xfs/xfs_dfrag.c
delete mode 100644 fs/xfs/xfs_dfrag.h
create mode 100644 fs/xfs/xfs_dir2_readdir.c
create mode 100644 fs/xfs/xfs_dquot_format.h
create mode 100644 fs/xfs/xfs_extent_ops.c
rename fs/xfs/{xfs_utils.h => xfs_extent_ops.h} (55%)
create mode 100644 fs/xfs/xfs_extfree_item_format.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_icreate_item_format.h
create mode 100644 fs/xfs/xfs_inode_buf.c
create mode 100644 fs/xfs/xfs_inode_buf.h
create mode 100644 fs/xfs/xfs_inode_fork.c
create mode 100644 fs/xfs/xfs_inode_fork.h
create mode 100644 fs/xfs/xfs_inode_item_format.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_log_format.h
create mode 100644 fs/xfs/xfs_log_rlimit.c
create mode 100644 fs/xfs/xfs_quota_defs.h
delete mode 100644 fs/xfs/xfs_rename.c
create mode 100644 fs/xfs/xfs_rtalloc_defs.h
create mode 100644 fs/xfs/xfs_sb.c
create mode 100644 fs/xfs/xfs_symlink_remote.c
create mode 100644 fs/xfs/xfs_symlink_remote.h
create mode 100644 fs/xfs/xfs_trans_format.h
create mode 100644 fs/xfs/xfs_trans_resv.c
create mode 100644 fs/xfs/xfs_trans_resv.h
delete mode 100644 fs/xfs/xfs_utils.c
delete mode 100644 fs/xfs/xfs_vnodeops.c
delete mode 100644 fs/xfs/xfs_vnodeops.hWhich should give you an idea of the number of new files that have been added to split out shared userspace code, and hence an idea of how much ofthe diffstat is just moving stuff around. FWIW, this kills about 2000 lines of __KERNEL__ code in header files that is currently exported to userspace. You can see why I'm thinking a kernel fs/xfs/libxfs subdir might be a good idea. :)
Comments, flames, etc all welcome.
Cheers,
Dave.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 1/60 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 | 317 ++++++++++++++++++++++++------------- 1 file changed, 209 insertions(+), 108 deletions(-)
Documentation/filesystems/xfs.txt +209 -108
@@ -18,6 +18,8 @@ Mount Options ============= When mounting an XFS filesystem, the following options are accepted. +For boolean mount options, the names with the (*) suffix is the +default behaviour. allocsize=size Sets the buffered I/O end-of-file preallocation size when
@@ -25,97 +27,128 @@ 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. - attr2/noattr2 - The options enable/disable (default is disabled for backward - compatibility on-disk) an "opportunistic" improvement to be - made in the way inline extended attributes are stored on-disk. - When the new form is used for the first time (by setting or - removing extended attributes) the on-disk superblock feature - bit field will be updated to reflect this format being in use. + 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 an "opportunistic" improvement to + be made in the way inline extended attributes are stored + on-disk. When the new form is used for the first time when + attr2 is selected (either when setting or removing extended + attributes) the on-disk superblock feature bit field will be + updated to reflect this format being in use. + + The default behaviour is determined by the on-disk feature + bit indicating that attr2 behaviour is active. If either + mount option it set, then that becomes the new default used + by the filesystem. 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. - - dmapi - Enable the DMAPI (Data Management API) event callouts. - Use with the "mtpt" option. - - 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. - - ihashsize=value - In memory inode hashes have been removed, so this option has - no function as of August 2007. Option is deprecated. - - 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. - - 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. + 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. + + 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 + 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 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. When noikeep is + specified, empty inode clusters are returned to the free + space pool. 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. - - largeio/nolargeio + inode64 (*) + 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. + + 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. + + inode32 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. If applications are in use which do + not handle inode numbers bigger than 32 bits, the inode32 + option should be specified. + + + 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. - If neither of these two options are specified, then filesystem - will behave as if "nolargeio" was specified. + 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. 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. The logbsize option below + controls the size of each buffer and so is also relevent to + this case. 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 + logbsize 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 +157,11 @@ 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 +172,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 +194,64 @@ 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. 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. + + Typically the only time these mount options are necessary if + after an underlying RAID device has had it's geometry + modified, such as adding a new disk to a RAID5 lun and + reshaping it. 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 +263,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. 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 +333,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/60] xfs: update mount options documentation
Quoted 50 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.
Signed-off-by Dave Chinner<[email protected]>--- Documentation/filesystems/xfs.txt | 317 ++++++++++++++++++++++++------------- 1 file changed, 209 insertions(+), 108 deletions(-)Documentation/filesystems/xfs.txt +16
-7@@ -18,6 +18,8 @@ Mount Options ============= When mounting an XFS filesystem, the following options are accepted. +For boolean mount options, the names with the (*) suffix is the +default behaviour. allocsize=size Sets the buffered I/O end-of-file preallocation size when@@ -25,97 +27,128 @@ 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. - attr2/noattr2 - The options enable/disable (default is disabled for backward - compatibility on-disk) an "opportunistic" improvement to be - made in the way inline extended attributes are stored on-disk. - When the new form is used for the first time (by setting or - removing extended attributes) the on-disk superblock feature - bit field will be updated to reflect this format being in use. + 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 an "opportunistic" improvement to + be made in the way inline extended attributes are stored + on-disk. When the new form is used for the first time when + attr2 is selected (either when setting or removing extended + attributes) the on-disk superblock feature bit field will be
Documentation/filesystems/xfs.txt When mounting an XFS filesystem, the following options are accepted. · line 53
Quoted 10 lines
Documentation/filesystems/xfs.txt +6
-0+ updated to reflect this format being in use. + + The default behaviour is determined by the on-disk feature + bit indicating that attr2 behaviour is active. If either + mount option it set, then that becomes the new default used + by the filesystem. CRC enabled filesystems always use the attr2 format, and so will reject the noattr2 mount option if it is set.
Thanks for doing this.
allocsize and attr/noattr seem a bit too run-on for me, *but* we all have our writing style; mine is terrible so you can ignore the below if you want. The "(?)" are added if the noattr2 command is also added.
Rest looks good to me and consider it:
allocsize=size
Sets the buffered I/O end-of-file preallocation size when doing delayed allocation writeout. The default size is 64KiB is and valid values for this option are page size (typically 4KiB) through to 1GiB, inclusive, in power-of-2 increments.
The default behaviour is to use the 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 the "opportunistic" improvement in the way inline extended attributes are stored on-disk. When the new attribute storage form is used for the first time (that usuage may be either when setting or removing extended attributes) after selecting (?one of ?) the attr2 (? or noattr2?) option(?s), the on-disk superblock feature bit field will be
updated
to reflect this is the format to be used.
The default behaviour is determined by the on-disk feature bit indicating that attr2 behaviour is active. If either mount option it set, then that becomes the new default used by the filesystem.
CRC enabled filesystems always use the attr2 format, and so will reject the noattr2 mount option if it is set.
--Mark.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 2/60 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
Re: [PATCH 02/60] xfs: add pluging for bulkstat readahead
Quoted 14 lines · Dave Chinner
From: 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.
Quoted 7 lines
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.
Signed-off-by Dave Chinner<[email protected]>---
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 3/60 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
Re: [PATCH 03/60] xfs: plug directory buffer readahead
Quoted 11 lines · Dave Chinner
From: 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.
Signed-off-by Dave Chinner<[email protected]>---
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 4/60 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) <XFS_FSB_TO_B (mp, 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) <XFS_FSB_TO_B (mp, 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/60] xfs: don't use speculative prealloc for small files
Quoted 39 lines · Dave Chinner
From: 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 usingfadvise(DONT_NEED). The result was that the data was getting written back before the speculative prealloc had been trimmed from memory by theclose(), 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 tomp->m_writeio_blocksuntil 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.
Quoted 8 lines
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.
Signed-off-by Dave Chinner <[email protected]>---
Looks good.
Quoted 25 lines
fs/xfs/xfs_iomap.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)fs/xfs/xfs_iomap.c +9
-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) <XFS_FSB_TO_B (mp, mp->m_writeio_blocks)) +return 0 ; + +/* * If there are any real blocks past eof, then don't * do any speculative allocation. */
fs/xfs/xfs_iomap.c xfs_iomap_eof_prealloc_initial_size( · line 363
Quoted 10 lines
fs/xfs/xfs_iomap.c +4
-0@@ -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) <XFS_FSB_TO_B (mp, 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
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 04/60] xfs: don't use speculative prealloc for small files
In reply to Dave ChinnerQuoted 39 lines · Dave Chinner
From: 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 usingfadvise(DONT_NEED). The result was that the data was getting written back before the speculative prealloc had been trimmed from memory by theclose(), 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 tomp->m_writeio_blocksuntil 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.
Quoted 8 lines
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.
Signed-off-by Dave Chinner<[email protected]>---
I agree with Brian, it looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 5/60 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
Re: [PATCH 05/60] xfs: don't do IO when creating an new inode
Quoted 15 lines · Dave Chinner
From: 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.
Quoted 2 lines
Signed-off-by Dave Chinner<[email protected]>---
Looks good.
As a side note, the comment in xfs_inode.h for the i_d:xfs_icdinode_t i_d; /* most of ondisk inode */
In Linux 3.10, it is no longer just most.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 6/60 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
Re: [PATCH 06/60] xfs: xfs_ifree doesn't need to modify the inode buffer
Quoted 10 lines · Dave Chinner
From: 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. Hencexfs_ifree()does not need to touch the inode backing buffer anymore.
Quoted 3 lines
Signed-off-by Dave Chinner<[email protected]>--- fs/xfs/xfs_inode.c | 32 ++++----------------------------
looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 7/60 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
Re: [PATCH 07/60] xfs: Introduce ordered log vector support
Quoted 36 lines · Dave Chinner
From: 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.
Signed-off-by Dave Chinner<[email protected]>--- 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 +0
-0
...
fs/xfs/xfs_log.c xlog_write( · line 2243
Quoted 7 lines
fs/xfs/xfs_log.c +1
-2@@ -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)) {
Be paranoid and make sure the log vector with no vectors owner is really a "ordered" entry?
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 8/60 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
Re: [PATCH 08/60] xfs: Introduce an ordered buffer item
Quoted 21 lines · Dave Chinner
If 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.
Quoted 7 lines
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.
Signed-off-by Dave Chinner<[email protected]>---
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 9/60 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
Re: [PATCH 09/60] xfs: Inode create log items
Quoted 14 lines · Dave Chinner
fs/xfs/xfs_icreate_item.h new file +14
-0+/* +* on disk log item structure +* +* Log recovery assumes the first two entries are the type and size and they fit +* in 32 bits. Also in host order (ugh) so they have to be 32 bit aligned so +* decoding can be done correctly. +*/ +struct xfs_icreate_log { +__uint16_t icl_type;/* type of log format structure */ +__uint16_t icl_size;/* size of log format structure */ +__be32 icl_ag;/* ag being allocated in */ +__be32 icl_agbno;/* start block of inode range */ +__be32 icl_count;/* number of inodes to initialise */ +__be32 icl_isize;/* size of inodes */
fs/xfs/xfs_icreate_item.h line 44
Quoted 10 lines
fs/xfs/xfs_icreate_item.h new file +10
-0+__be32 icl_length;/* length of extent to initialise */ +__be32 icl_gen;/* inode generation number to use */ +}; + +/* in memory log item structure */ +struct xfs_icreate_item { +struct xfs_log_item ic_item; +struct xfs_icreate_log ic_format; +}; +
Just a nit: I assume the name was getting a bit long, but having _format in the name tells the structure purpose. I know, I know, the xfs_icreate_item uses format in the "ic_format" variable name.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 10/60 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
Re: [PATCH 10/60] xfs: Inode create transaction reservations
Quoted 10 lines · Dave Chinner
Define 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.
Signed-off-by Dave Chinner<[email protected]>---
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 11/60 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
Re: [PATCH 11/60] xfs: Inode create item recovery
Quoted 11 lines · Dave Chinner
When 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.
Signed-off-by Dave Chinner<[email protected]>---
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 12/60 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
Re: [PATCH 12/60] xfs: Use inode create transaction
Quoted 11 lines · Dave Chinner
Replace 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.
Signed-off-by Dave Chinner<[email protected]>---
Looks good. Nice feature.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 13/60 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/60 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 | 8 +- fs/xfs/xfs_dir2_readdir.c | 660 +++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_dir2_sf.c | 99 ------- 7 files changed, 664 insertions(+), 629 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 -6
@@ -32,9 +32,9 @@ 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);extern int xfs_dir2_block_lookup (struct xfs_da_args *args);extern int xfs_dir2_block_removename (struct xfs_da_args *args);extern int xfs_dir2_block_replace (struct xfs_da_args *args);
@@ -91,8 +91,6 @@ extern void xfs_dir3_leaf_compact(struct xfs_da_args *args,extern void xfs_dir3_leaf_compact_x1 (struct xfs_dir3_icleaf_hdr *leafhdr,struct xfs_dir2_leaf_entry *ents,int *indexp,int *lowstalep,int *highstalep,int *lowlogp,int *highlogp); -extern int xfs_dir2_leaf_getdents (struct xfs_inode *dp,void *dirent, -size_t bufsize,xfs_off_t *offset,filldir_t filldir);extern int xfs_dir3_leaf_get_buf (struct xfs_da_args *args,xfs_dir2_db_t bno,struct xfs_buf **bpp,__uint16_t magic); extern void xfs_dir3_leaf_log_ents(struct xfs_trans *tp, struct xfs_buf *bp,
@@ -153,8 +151,6 @@ extern int xfs_dir2_block_to_sf(struct xfs_da_args *args, struct xfs_buf *bp, int size, xfs_dir2_sf_hdr_t *sfhp);extern int xfs_dir2_sf_addname (struct xfs_da_args *args);extern int xfs_dir2_sf_create (struct xfs_da_args *args,xfs_ino_t pino); -extern int xfs_dir2_sf_getdents (struct xfs_inode *dp,void *dirent, -xfs_off_t *offset,filldir_t filldir);extern int xfs_dir2_sf_lookup (struct xfs_da_args *args);extern int xfs_dir2_sf_removename (struct xfs_da_args *args);extern int xfs_dir2_sf_replace (struct xfs_da_args *args);
fs/xfs/xfs_dir2_readdir.c new file +660 -0
660 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/60 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_bmap.c | 3 ++- fs/xfs/xfs_da_btree.c | 2 +- fs/xfs/xfs_dir2.c | 2 +- fs/xfs/xfs_dir2.h | 51 +++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_dir2_block.c | 2 +- fs/xfs/xfs_dir2_data.c | 6 ++---- 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_readdir.c | 1 + fs/xfs/xfs_dir2_sf.c | 6 +++--- fs/xfs/xfs_export.c | 4 +++- fs/xfs/xfs_file.c | 2 +- fs/xfs/xfs_icreate_item.c | 12 ----------- fs/xfs/xfs_log_recover.c | 2 +- fs/xfs/xfs_mount.c | 4 +++- fs/xfs/xfs_rename.c | 3 ++- fs/xfs/xfs_rtalloc.c | 1 - fs/xfs/xfs_super.c | 3 ++- fs/xfs/xfs_symlink.c | 3 ++- fs/xfs/xfs_utils.c | 4 +++- fs/xfs/xfs_vnodeops.c | 3 ++- 22 files changed, 83 insertions(+), 64 deletions(-)
fs/xfs/xfs_bmap.c +2 -1
@@ -24,9 +24,10 @@#include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h" -#include "xfs_dir2.h" #include "xfs_mount.h" #include "xfs_da_btree.h" +#include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_bmap_btree.h" #include "xfs_alloc_btree.h" #include "xfs_ialloc_btree.h"
fs/xfs/xfs_da_btree.c +1 -1
@@ -27,8 +27,8 @@#include "xfs_mount.h" #include "xfs_da_btree.h" #include "xfs_bmap_btree.h" -#include "xfs_dir2.h" #include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_dir2_priv.h" #include "xfs_dinode.h" #include "xfs_inode.h"
fs/xfs/xfs_dir2.c +1 -1
@@ -31,8 +31,8 @@#include "xfs_inode.h" #include "xfs_inode_item.h" #include "xfs_bmap.h" -#include "xfs_dir2.h" #include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_dir2_priv.h" #include "xfs_error.h" #include "xfs_vnodeops.h"
fs/xfs/xfs_dir2.h +51 -0
61 lines not on this page · raw message
fs/xfs/xfs_dir2_block.c +1 -1
@@ -31,8 +31,8 @@#include "xfs_inode_item.h" #include "xfs_bmap.h" #include "xfs_buf_item.h" -#include "xfs_dir2.h" #include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_dir2_priv.h" #include "xfs_error.h" #include "xfs_trace.h"
fs/xfs/xfs_dir2_data.c +2 -4
@@ -29,14 +29,12 @@#include "xfs_dinode.h" #include "xfs_inode.h" #include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_dir2_priv.h" #include "xfs_error.h" #include "xfs_buf_item.h" #include "xfs_cksum.h" -STATIC xfs_dir2_data_free_t * -xfs_dir2_data_freefind (xfs_dir2_data_hdr_t *hdr, xfs_dir2_data_unused_t *dup); -/* * Check the consistency of the data block. * The input can also be a block-format directory.
@@ -325,7 +323,7 @@ xfs_dir3_data_readahead(* Given a data block and an unused entry from that block, * return the bestfree entry if any that corresponds to it. */ -STATIC xfs_dir2_data_free_t * +xfs_dir2_data_free_t *xfs_dir2_data_freefind (xfs_dir2_data_hdr_t *hdr,/* data block */ xfs_dir2_data_unused_t *dup)/* data unused entry */
fs/xfs/xfs_dir2_leaf.c +1 -0
@@ -31,6 +31,7 @@#include "xfs_inode.h" #include "xfs_bmap.h" #include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_dir2_priv.h" #include "xfs_error.h" #include "xfs_trace.h"
fs/xfs/xfs_dir2_node.c +1 -0
@@ -30,6 +30,7 @@#include "xfs_inode.h" #include "xfs_bmap.h" #include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_dir2_priv.h" #include "xfs_error.h" #include "xfs_trace.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);
@@ -48,39 +42,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,
@@ -142,9 +114,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_readdir.c +1 -0
@@ -30,6 +30,7 @@#include "xfs_dinode.h" #include "xfs_inode.h" #include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_dir2_priv.h" #include "xfs_error.h" #include "xfs_trace.h"
fs/xfs/xfs_dir2_sf.c +3 -3
@@ -29,8 +29,8 @@#include "xfs_inode.h" #include "xfs_inode_item.h" #include "xfs_error.h" -#include "xfs_dir2.h" #include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_dir2_priv.h" #include "xfs_trace.h"
@@ -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_export.c +3 -1
@@ -21,8 +21,10 @@#include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h" -#include "xfs_dir2.h" #include "xfs_mount.h" +#include "xfs_da_btree.h" +#include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_export.h" #include "xfs_vnodeops.h" #include "xfs_bmap_btree.h"
fs/xfs/xfs_file.c +1 -1
@@ -32,7 +32,7 @@#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_icreate_item.c +0 -12
@@ -20,23 +20,11 @@#include "xfs_types.h" #include "xfs_bit.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" -#include "xfs_buf_item.h" #include "xfs_sb.h" #include "xfs_ag.h" -#include "xfs_dir2.h" #include "xfs_mount.h" #include "xfs_trans_priv.h" -#include "xfs_bmap_btree.h" -#include "xfs_alloc_btree.h" -#include "xfs_ialloc_btree.h" -#include "xfs_attr_sf.h" -#include "xfs_dinode.h" -#include "xfs_inode.h" -#include "xfs_inode_item.h" -#include "xfs_btree.h" -#include "xfs_ialloc.h" #include "xfs_error.h" #include "xfs_icreate_item.h"
fs/xfs/xfs_log_recover.c +1 -1
@@ -51,7 +51,7 @@#include "xfs_symlink.h" #include "xfs_da_btree.h" #include "xfs_dir2_format.h" -#include "xfs_dir2_priv.h" +#include "xfs_dir2.h" #include "xfs_attr_leaf.h" #include "xfs_attr_remote.h"
fs/xfs/xfs_mount.c +3 -1
@@ -25,8 +25,10 @@#include "xfs_trans_priv.h" #include "xfs_sb.h" #include "xfs_ag.h" -#include "xfs_dir2.h" #include "xfs_mount.h" +#include "xfs_da_btree.h" +#include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_bmap_btree.h" #include "xfs_alloc_btree.h" #include "xfs_ialloc_btree.h"
fs/xfs/xfs_rename.c +2 -1
@@ -22,9 +22,10 @@#include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h" -#include "xfs_dir2.h" #include "xfs_mount.h" #include "xfs_da_btree.h" +#include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_bmap_btree.h" #include "xfs_dinode.h" #include "xfs_inode.h"
fs/xfs/xfs_rtalloc.c +0 -1
@@ -23,7 +23,6 @@#include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h" -#include "xfs_dir2.h" #include "xfs_mount.h" #include "xfs_bmap_btree.h" #include "xfs_dinode.h"
fs/xfs/xfs_super.c +2 -1
@@ -22,7 +22,6 @@#include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h" -#include "xfs_dir2.h" #include "xfs_alloc.h" #include "xfs_quota.h" #include "xfs_mount.h"
@@ -46,6 +45,8 @@#include "xfs_trans_priv.h" #include "xfs_filestream.h" #include "xfs_da_btree.h" +#include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_extfree_item.h" #include "xfs_mru_cache.h" #include "xfs_inode_item.h"
fs/xfs/xfs_symlink.c +2 -1
@@ -24,9 +24,10 @@#include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h" -#include "xfs_dir2.h" #include "xfs_mount.h" #include "xfs_da_btree.h" +#include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_bmap_btree.h" #include "xfs_ialloc_btree.h" #include "xfs_dinode.h"
fs/xfs/xfs_utils.c +3 -1
@@ -22,8 +22,10 @@#include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h" -#include "xfs_dir2.h" #include "xfs_mount.h" +#include "xfs_da_btree.h" +#include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_bmap_btree.h" #include "xfs_dinode.h" #include "xfs_inode.h"
fs/xfs/xfs_vnodeops.c +2 -1
@@ -25,9 +25,10 @@#include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h" -#include "xfs_dir2.h" #include "xfs_mount.h" #include "xfs_da_btree.h" +#include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_bmap_btree.h" #include "xfs_ialloc_btree.h" #include "xfs_dinode.h"
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 16/60 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/60 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/60 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.
PATCH 19/60 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 | 772 +++++++++++++++++++ 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 | 1147 ++++++++++++++++++++++++++++- 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 | 1875 ----------------------------------------------- fs/xfs/xfs_vnodeops.h | 56 -- fs/xfs/xfs_xattr.c | 1 - 27 files changed, 1996 insertions(+), 1988 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
@@ -47,7 +47,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.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
@@ -67,6 +67,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
@@ -26,7 +26,6 @@#include "xfs_dir2_format.h" #include "xfs_dir2.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 +772 -0
772 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,12 +29,12 @@#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_format.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 +1110 -37
1,206 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
@@ -35,7 +35,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
@@ -40,7 +40,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 -1875
736 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.
PATCH 20/60 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
@@ -5791,287 +5791,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/60 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 | 716 +++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_sb.h | 19 ++ 5 files changed, 823 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 +716 -0
716 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/60 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/60 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
@@ -519,6 +519,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/60 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_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_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_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
PATCH 25/60 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/60 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/60 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
@@ -4648,12 +4648,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_agblock_t offset_agbno;/* blks from chunk start to inode */ ASSERT (ino !=NULLFSINO );
fs/xfs/xfs_rtalloc.c +2 -2
@@ -735,8 +735,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
PATCH 28/60 xfs: consolidate xfs_rename.c
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Move the rename code to xfs_inode_ops.c to continue consolidating all the kernel xfs_inode operations in the one place.
--- fs/xfs/Makefile | 1 - fs/xfs/xfs_inode_ops.c | 306 ++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_rename.c | 346 ------------------------------------------------ 3 files changed, 306 insertions(+), 347 deletions(-) delete mode 100644 fs/xfs/xfs_rename.c
fs/xfs/Makefile +0 -1
@@ -51,7 +51,6 @@ xfs-y += xfs_aops.o \ xfs_message.o \ xfs_mount.o \ xfs_mru_cache.o \ - xfs_rename.o \ xfs_super.o \ xfs_trans.o \ xfs_utils.o \
fs/xfs/xfs_inode_ops.c +306 -0
309 lines not on this page · raw message
fs/xfs/xfs_rename.c deleted +0 -346
346 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 29/60 xfs: consolidate xfs_utils.c
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
There are a few small helper functions in xfs_util, all related to xfs_inode modifications. Move them all to xfs_inode_ops.c so all xfs_inode operations are consiolidated in the one place.
--- fs/xfs/Makefile | 1 - fs/xfs/xfs_error.c | 1 - fs/xfs/xfs_extent_ops.c | 1 - fs/xfs/xfs_filestream.c | 1 - fs/xfs/xfs_inode.c | 1 - fs/xfs/xfs_inode_ops.c | 279 +++++++++++++++++++++++++++++++++++++++- fs/xfs/xfs_inode_ops.h | 7 + fs/xfs/xfs_ioctl.c | 1 - fs/xfs/xfs_iomap.c | 1 - fs/xfs/xfs_iops.c | 1 - fs/xfs/xfs_log_recover.c | 1 - fs/xfs/xfs_mount.c | 1 - fs/xfs/xfs_qm.c | 1 - fs/xfs/xfs_qm_syscalls.c | 1 - fs/xfs/xfs_rtalloc.c | 1 - fs/xfs/xfs_super.c | 1 - fs/xfs/xfs_symlink.c | 1 - fs/xfs/xfs_utils.c | 316 ---------------------------------------------- fs/xfs/xfs_utils.h | 27 ---- 19 files changed, 285 insertions(+), 359 deletions(-) delete mode 100644 fs/xfs/xfs_utils.c delete mode 100644 fs/xfs/xfs_utils.h
fs/xfs/Makefile +0 -1
@@ -53,7 +53,6 @@ xfs-y += xfs_aops.o \ xfs_mru_cache.o \ xfs_super.o \ xfs_trans.o \ - xfs_utils.o \ xfs_xattr.o \ kmem.o \ uuid.o
fs/xfs/xfs_error.c +0 -1
@@ -26,7 +26,6 @@#include "xfs_bmap_btree.h" #include "xfs_dinode.h" #include "xfs_inode.h" -#include "xfs_utils.h" #include "xfs_error.h" #ifdef DEBUG
fs/xfs/xfs_extent_ops.c +0 -1
@@ -42,7 +42,6 @@#include "xfs_attr.h" #include "xfs_error.h" #include "xfs_quota.h" -#include "xfs_utils.h" #include "xfs_rtalloc.h" #include "xfs_trans_space.h" #include "xfs_log_priv.h"
fs/xfs/xfs_filestream.c +0 -1
@@ -27,7 +27,6 @@#include "xfs_mount.h" #include "xfs_bmap.h" #include "xfs_alloc.h" -#include "xfs_utils.h" #include "xfs_mru_cache.h" #include "xfs_filestream.h" #include "xfs_trace.h"
fs/xfs/xfs_inode.c +0 -1
@@ -40,7 +40,6 @@#include "xfs_ialloc.h" #include "xfs_bmap.h" #include "xfs_error.h" -#include "xfs_utils.h" #include "xfs_quota.h" #include "xfs_filestream.h" #include "xfs_cksum.h"
fs/xfs/xfs_inode_ops.c +278 -1
291 lines not on this page · raw message
fs/xfs/xfs_inode_ops.h +7 -0
@@ -368,4 +368,11 @@ do { \iput (VFS_I (ip)); \ } while (0) +int xfs_dir_ialloc(struct xfs_trans **, struct xfs_inode *, umode_t, + xfs_nlink_t, xfs_dev_t, prid_t, int, + struct xfs_inode **, int *); +int xfs_droplink (struct xfs_trans *,struct xfs_inode *); +int xfs_bumplink (struct xfs_trans *,struct xfs_inode *); +void xfs_bump_ino_vers2 (struct xfs_trans *,struct xfs_inode *); +#endif /* __XFS_INODE_OPS_H__ */
fs/xfs/xfs_ioctl.c +0 -1
@@ -33,7 +33,6 @@#include "xfs_attr.h" #include "xfs_bmap.h" #include "xfs_buf_item.h" -#include "xfs_utils.h" #include "xfs_dfrag.h" #include "xfs_fsops.h" #include "xfs_discard.h"
fs/xfs/xfs_iomap.c +0 -1
@@ -38,7 +38,6 @@#include "xfs_attr.h" #include "xfs_buf_item.h" #include "xfs_trans_space.h" -#include "xfs_utils.h" #include "xfs_iomap.h" #include "xfs_trace.h" #include "xfs_icache.h"
fs/xfs/xfs_iops.c +0 -1
@@ -34,7 +34,6 @@#include "xfs_itable.h" #include "xfs_attr.h" #include "xfs_buf_item.h" -#include "xfs_utils.h" #include "xfs_inode_item.h" #include "xfs_trace.h" #include "xfs_icache.h"
fs/xfs/xfs_log_recover.c +0 -1
@@ -41,7 +41,6 @@#include "xfs_extfree_item.h" #include "xfs_trans_priv.h" #include "xfs_quota.h" -#include "xfs_utils.h" #include "xfs_cksum.h" #include "xfs_trace.h" #include "xfs_icache.h"
fs/xfs/xfs_mount.c +0 -1
@@ -42,7 +42,6 @@#include "xfs_error.h" #include "xfs_quota.h" #include "xfs_fsops.h" -#include "xfs_utils.h" #include "xfs_trace.h" #include "xfs_icache.h" #include "xfs_cksum.h"
fs/xfs/xfs_qm.c +0 -1
@@ -37,7 +37,6 @@#include "xfs_attr.h" #include "xfs_buf_item.h" #include "xfs_trans_space.h" -#include "xfs_utils.h" #include "xfs_qm.h" #include "xfs_trace.h" #include "xfs_icache.h"
fs/xfs/xfs_qm_syscalls.c +0 -1
@@ -37,7 +37,6 @@#include "xfs_error.h" #include "xfs_attr.h" #include "xfs_buf_item.h" -#include "xfs_utils.h" #include "xfs_qm.h" #include "xfs_trace.h" #include "xfs_icache.h"
fs/xfs/xfs_rtalloc.c +0 -1
@@ -34,7 +34,6 @@#include "xfs_error.h" #include "xfs_inode_item.h" #include "xfs_trans_space.h" -#include "xfs_utils.h" #include "xfs_trace.h" #include "xfs_buf.h" #include "xfs_icache.h"
fs/xfs/xfs_super.c +0 -1
@@ -39,7 +39,6 @@#include "xfs_fsops.h" #include "xfs_attr.h" #include "xfs_buf_item.h" -#include "xfs_utils.h" #include "xfs_log_priv.h" #include "xfs_trans_priv.h" #include "xfs_filestream.h"
fs/xfs/xfs_symlink.c +0 -1
@@ -39,7 +39,6 @@#include "xfs_bmap.h" #include "xfs_error.h" #include "xfs_quota.h" -#include "xfs_utils.h" #include "xfs_trans_space.h" #include "xfs_log_priv.h" #include "xfs_trace.h"
fs/xfs/xfs_utils.c deleted +0 -316
316 lines not on this page · raw message
fs/xfs/xfs_utils.h deleted +0 -27
@@ -1,27 +0,0 @@ -/* -* Copyright (c) 2000-2002,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_UTILS_H__ -#define __XFS_UTILS_H__ - -extern int xfs_dir_ialloc (xfs_trans_t **,xfs_inode_t *,umode_t ,xfs_nlink_t , -xfs_dev_t ,prid_t ,int ,xfs_inode_t **,int *); -extern int xfs_droplink (xfs_trans_t *,xfs_inode_t *); -extern int xfs_bumplink (xfs_trans_t *,xfs_inode_t *); -extern void xfs_bump_ino_vers2 (xfs_trans_t *,xfs_inode_t *); - -#endif /* __XFS_UTILS_H__ */
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 29/60] xfs: consolidate xfs_utils.c
Quoted 8 lines
+/*
+ * Allocates a new inode from disk and return a pointer to the
+ * incore copy. This routine will internally commit the current
+ * transaction and allocate a new one if the Space Manager needed
+ * to do an allocation to replenish the inode free-list.
+ *
+ * This routine is designed to be called fromxfs_createand
+ *xfs_create_dir.
xfs_create_dir is long gone. I suspect it's best to just kill that sentence.
fs/xfs/xfs_inode_ops.c xfs_ialloc( · line 1089
Quoted 7 lines
fs/xfs/xfs_inode_ops.c +7
-0+/* +* Decrement the link count on an inode & log the change. +* If this causes the link count to go to zero, initiate the +* logging activity required to truncate a file. +*/ +int /* error */ +xfs_droplink(
Can be static now.
fs/xfs/xfs_inode_ops.c xfs_ialloc( · line 1153
Quoted 5 lines
fs/xfs/xfs_inode_ops.c +5
-0+/* +* Increment the link count on an inode & log the change. +*/ +int +xfs_bumplink(
Same here.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 30/60 xfs: split out inode log item format definition
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Th elog item format definitions are shared with userspace. split the out of header files that contain kernel only defintions to make it simple to shared them.
--- fs/xfs/xfs_inode.h | 63 +------------ fs/xfs/xfs_inode_item.h | 115 +---------------------- fs/xfs/xfs_inode_item_format.h | 198 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 202 insertions(+), 174 deletions(-) create mode 100644 fs/xfs/xfs_inode_item_format.h
fs/xfs/xfs_inode.h +1 -62
@@ -115,67 +115,7 @@ struct xfs_imap {* chain off the mount structure by xfs_sync calls. */ -typedef struct xfs_ictimestamp { -__int32_t t_sec;/* timestamp seconds */ -__int32_t t_nsec;/* timestamp nanoseconds */ -}xfs_ictimestamp_t ; - -/* -* NOTE: This structure must be kept identical to struct xfs_dinode -* in xfs_dinode.h except for the endianness annotations. -*/ -typedef struct xfs_icdinode { -__uint16_t di_magic;/* inode magic # = XFS_DINODE_MAGIC */ -__uint16_t di_mode;/* mode and type of file */ -__int8_t di_version;/* inode version */ -__int8_t di_format;/* format of di_c data */ -__uint16_t di_onlink;/* old number of links to file */ -__uint32_t di_uid;/* owner's user id */ -__uint32_t di_gid;/* owner's group id */ -__uint32_t di_nlink;/* number of links to file */ -__uint16_t di_projid_lo;/* lower part of owner's project id */ -__uint16_t di_projid_hi;/* higher part of owner's project id */ -__uint8_t di_pad[6 ];/* unused, zeroed space */ -__uint16_t di_flushiter;/* incremented on flush */ -xfs_ictimestamp_t di_atime;/* time last accessed */ -xfs_ictimestamp_t di_mtime;/* time last modified */ -xfs_ictimestamp_t di_ctime;/* time created/inode modified */ -xfs_fsize_t di_size;/* number of bytes in file */ -xfs_drfsbno_t di_nblocks;/* # of direct & btree blocks used */ -xfs_extlen_t di_extsize;/* basic/minimum extent size for file */ -xfs_extnum_t di_nextents;/* number of extents in data fork */ -xfs_aextnum_t di_anextents;/* number of extents in attribute fork*/ -__uint8_t di_forkoff;/* attr fork offs, <<3 for 64b align */ -__int8_t di_aformat;/* format of attr fork's data */ -__uint32_t di_dmevmask;/* DMIG event mask */ -__uint16_t di_dmstate;/* DMIG state info */ -__uint16_t di_flags;/* random flags, XFS_DIFLAG_... */ -__uint32_t di_gen;/* generation number */ - -/* di_next_unlinked is the only non-core field in the old dinode */ -xfs_agino_t di_next_unlinked;/* agi unlinked list ptr */ - -/* start of the extended dinode, writable fields */ -__uint32_t di_crc;/* CRC of the inode */ -__uint64_t di_changecount;/* number of attribute changes */ -xfs_lsn_t di_lsn;/* flush sequence */ -__uint64_t di_flags2;/* more random flags */ -__uint8_t di_pad2[16 ];/* more padding for future expansion */ - -/* fields only written to during inode creation */ -xfs_ictimestamp_t di_crtime;/* time created */ -xfs_ino_t di_ino;/* inode number */ -uuid_t di_uuid;/* UUID of the filesystem */ - -/* structure must be padded to 64 bit alignment */ -}xfs_icdinode_t ; - -static inline uint xfs_icdinode_size (int version) -{ -if (version ==3 ) -return sizeof (struct xfs_icdinode ); -return offsetof(struct xfs_icdinode , di_next_unlinked); -} +#include "xfs_inode_item_format.h" /* * Flags for xfs_ichgtime().
@@ -300,7 +240,6 @@ void xfs_inobp_check(struct xfs_mount *, struct xfs_buf *);extern struct kmem_zone *xfs_ifork_zone;extern struct kmem_zone *xfs_inode_zone; -extern struct kmem_zone *xfs_ili_zone;extern const struct xfs_buf_ops xfs_inode_buf_ops;#endif /* __XFS_INODE_H__ */
fs/xfs/xfs_inode_item.h +3 -112
139 lines not on this page · raw message
fs/xfs/xfs_inode_item_format.h new file +198 -0
198 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 31/60 xfs: split out buf log item format definitions
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
--- fs/xfs/xfs_buf_item.h | 100 ++----------------------------------- fs/xfs/xfs_buf_item_format.h | 111 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+), 96 deletions(-) create mode 100644 fs/xfs/xfs_buf_item_format.h
fs/xfs/xfs_buf_item.h +4 -96
@@ -18,101 +18,11 @@#ifndef __XFS_BUF_ITEM_H__#define __XFS_BUF_ITEM_H__ -extern kmem_zone_t *xfs_buf_item_zone; - -/* -* This flag indicates that the buffer contains on disk inodes -* and requires special recovery handling. -*/ -#define XFS_BLF_INODE_BUF (1<<0) -/* -* This flag indicates that the buffer should not be replayed -* during recovery because its blocks are being freed. -*/ -#define XFS_BLF_CANCEL (1<<1) - -/* -* This flag indicates that the buffer contains on disk -* user or group dquots and may require special recovery handling. -*/ -#define XFS_BLF_UDQUOT_BUF (1<<2) -#define XFS_BLF_PDQUOT_BUF (1<<3) -#define XFS_BLF_GDQUOT_BUF (1<<4) - -#define XFS_BLF_CHUNK 128 -#define XFS_BLF_SHIFT 7 -#define BIT_TO_WORD_SHIFT 5 -#define NBWORD (NBBY * sizeof(unsigned int)) - -/* -* This is the structure used to lay out a buf log item in the -* log. The data map describes which 128 byte chunks of the buffer -* have been logged. -*/ -#define XFS_BLF_DATAMAP_SIZE ((XFS_MAX_BLOCKSIZE / XFS_BLF_CHUNK) / NBWORD) - -typedef struct xfs_buf_log_format { -unsigned short blf_type;/* buf log item type indicator */ -unsigned short blf_size;/* size of this item */ -ushort blf_flags;/* misc state */ -ushort blf_len;/* number of blocks in this buf */ -__int64_t blf_blkno;/* starting blkno of this buf */ -unsigned int blf_map_size;/* used size of data bitmap in words */ -unsigned int blf_data_map[XFS_BLF_DATAMAP_SIZE ];/* dirty bitmap */ -}xfs_buf_log_format_t ; - -/* -* All buffers now need to tell recovery where the magic number -* is so that it can verify and calculate the CRCs on the buffer correctly -* once the changes have been replayed into the buffer. -* -* The type value is held in the upper 5 bits of the blf_flags field, which is -* an unsigned 16 bit field. Hence we need to shift it 11 bits up and down. -*/ -#define XFS_BLFT_BITS 5 -#define XFS_BLFT_SHIFT 11 -#define XFS_BLFT_MASK (((1 << XFS_BLFT_BITS) - 1) << XFS_BLFT_SHIFT) +#include "xfs_buf_item_format.h" -enum xfs_blft { -XFS_BLFT_UNKNOWN_BUF =0 , -XFS_BLFT_UDQUOT_BUF , -XFS_BLFT_PDQUOT_BUF , -XFS_BLFT_GDQUOT_BUF , -XFS_BLFT_BTREE_BUF , -XFS_BLFT_AGF_BUF , -XFS_BLFT_AGFL_BUF , -XFS_BLFT_AGI_BUF , -XFS_BLFT_DINO_BUF , -XFS_BLFT_SYMLINK_BUF , -XFS_BLFT_DIR_BLOCK_BUF , -XFS_BLFT_DIR_DATA_BUF , -XFS_BLFT_DIR_FREE_BUF , -XFS_BLFT_DIR_LEAF1_BUF , -XFS_BLFT_DIR_LEAFN_BUF , -XFS_BLFT_DA_NODE_BUF , -XFS_BLFT_ATTR_LEAF_BUF , -XFS_BLFT_ATTR_RMT_BUF , -XFS_BLFT_SB_BUF , -XFS_BLFT_MAX_BUF = (1 <<XFS_BLFT_BITS ), -}; +/* kernel only definitions */ -static inline void -xfs_blft_to_flags (struct xfs_buf_log_format *blf,enum xfs_blft type) -{ -ASSERT (type >XFS_BLFT_UNKNOWN_BUF && type <XFS_BLFT_MAX_BUF ); - blf->blf_flags &= ~XFS_BLFT_MASK ; - blf->blf_flags |= ((type <<XFS_BLFT_SHIFT ) &XFS_BLFT_MASK ); -} - -static inline __uint16_t -xfs_blft_from_flags (struct xfs_buf_log_format *blf) -{ -return (blf->blf_flags &XFS_BLFT_MASK ) >>XFS_BLFT_SHIFT ; -} - -/* -* buf log item flags -*/ +/* buf log item flags */ #define XFS_BLI_HOLD 0x01#define XFS_BLI_DIRTY 0x02#define XFS_BLI_STALE 0x04
@@ -133,8 +43,6 @@ xfs_blft_from_flags(struct xfs_buf_log_format *blf) { XFS_BLI_ORDERED, "ORDERED" } -#ifdef __KERNEL__ -struct xfs_buf ;struct xfs_mount ;struct xfs_buf_log_item ;
@@ -169,6 +77,6 @@ void xfs_trans_buf_set_type(struct xfs_trans *, struct xfs_buf *, enum xfs_blft);void xfs_trans_buf_copy_type (struct xfs_buf *dst_bp,struct xfs_buf *src_bp); -#endif /* __KERNEL__ */ +extern kmem_zone_t *xfs_buf_item_zone;#endif /* __XFS_BUF_ITEM_H__ */
fs/xfs/xfs_buf_item_format.h new file +111 -0
111 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 32/60 xfs: move inode fork definitions to a new header file
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The inode fork definitions are a combination of on-disk format definition and in-memory tracking and manipulation. They are both shared with userspace, so move them all into their own file so sharing is easy to do and track. This removes all inode fork related information from xfs_inode.h.
Do the same for the all the C code that currently resides in xfs_inode.c for the same reason.
--- fs/xfs/Makefile | 1 + fs/xfs/xfs_inode.c | 1877 +-------------------------------------------- fs/xfs/xfs_inode.h | 148 +--- fs/xfs/xfs_inode_fork.c | 1921 +++++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_inode_fork.h | 169 +++++ fs/xfs/xfs_inode_ops.h | 6 + 6 files changed, 2101 insertions(+), 2021 deletions(-) create mode 100644 fs/xfs/xfs_inode_fork.c create mode 100644 fs/xfs/xfs_inode_fork.h
fs/xfs/Makefile +1 -0
@@ -77,6 +77,7 @@ xfs-y += xfs_alloc.o \ xfs_ialloc_btree.o \ xfs_icreate_item.o \ xfs_inode.o \ + xfs_inode_fork.o \ xfs_log_recover.o \ xfs_sb.o \ xfs_symlink.o \
fs/xfs/xfs_inode.c +3 -1874
1,910 lines not on this page · raw message
fs/xfs/xfs_inode.h +1 -147
178 lines not on this page · raw message
fs/xfs/xfs_inode_fork.c new file +1921 -0
905 lines not on this page · raw message
fs/xfs/xfs_inode_fork.h new file +169 -0
169 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.
PATCH 33/60 xfs: move unrealted definitions out of xfs_inode.h
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
--- fs/xfs/xfs_ialloc.c | 1 + fs/xfs/xfs_icache.h | 7 +++++++ fs/xfs/xfs_inode.h | 38 -------------------------------------- fs/xfs/xfs_trans.h | 7 +++++++ 4 files changed, 15 insertions(+), 38 deletions(-)
fs/xfs/xfs_ialloc.c +1 -0
@@ -39,6 +39,7 @@#include "xfs_cksum.h" #include "xfs_buf_item.h" #include "xfs_icreate_item.h" +#include "xfs_icache.h" /*
fs/xfs/xfs_icache.h +7 -0
@@ -24,6 +24,13 @@ struct xfs_perag;#define SYNC_WAIT 0x0001/* wait for i/o to complete */ #define SYNC_TRYLOCK 0x0002/* only try to lock inodes */ +/* +* Flags for xfs_iget() +*/ +#define XFS_IGET_CREATE 0x1 +#define XFS_IGET_UNTRUSTED 0x2 +#define XFS_IGET_DONTCACHE 0x4 +int xfs_iget (struct xfs_mount *mp,struct xfs_trans *tp,xfs_ino_t ino,uint flags,uint lock_flags,xfs_inode_t **ipp);
fs/xfs/xfs_inode.h +0 -38
@@ -32,53 +32,15 @@ struct xfs_imap {ushort im_boffset;/* inode offset in block in bytes */ }; -/* -* This is the xfs in-core inode structure. -* Most of the on-disk inode is embedded in the i_d field. -* -* The extent pointers/inline file space, however, are managed -* separately. The memory for this information is pointed to by -* the if_u1 unions depending on the type of the data. -* This is used to linearize the array of extents for fast in-core -* access. This is used until the file's number of extents -* surpasses XFS_MAX_INCORE_EXTENTS, at which point all extent pointers -* are accessed through the buffer cache. -* -* Other state kept in the in-core inode is used for identification, -* locking, transactional updating, etc of the inode. -* -* Generally, we do not want to hold the i_rlock while holding the -* i_ilock. Hierarchy is i_iolock followed by i_rlock. -* -* xfs_iptr_t contains all the inode fields up to and including the -* i_mnext and i_mprev fields, it is used as a marker in the inode -* chain off the mount structure by xfs_sync calls. -*/ -#include "xfs_inode_fork.h" #include "xfs_inode_item_format.h" -/* -* Flags for xfs_ichgtime(). -*/ -#define XFS_ICHGTIME_MOD 0x1/* data fork modification timestamp */ -#define XFS_ICHGTIME_CHG 0x2/* inode field change timestamp */ -#define XFS_ICHGTIME_CREATE 0x4/* inode create timestamp */ - -#ifdef __KERNEL__#include "xfs_inode_ops.h" #endif /* __KERNEL__ */ -/* -* Flags for xfs_iget() -*/ -#define XFS_IGET_CREATE 0x1 -#define XFS_IGET_UNTRUSTED 0x2 -#define XFS_IGET_DONTCACHE 0x4 -int xfs_imap_to_bp (struct xfs_mount *,struct xfs_trans *,struct xfs_imap *,struct xfs_dinode **,struct xfs_buf **,uint ,uint );
fs/xfs/xfs_trans.h +7 -0
@@ -227,6 +227,13 @@ struct xfs_log_item_desc {#define XFS_ATTR_BTREE_REF 1#define XFS_DQUOT_REF 1 +/* +* Flags for xfs_trans_ichgtime(). +*/ +#define XFS_ICHGTIME_MOD 0x1/* data fork modification timestamp */ +#define XFS_ICHGTIME_CHG 0x2/* inode field change timestamp */ +#define XFS_ICHGTIME_CREATE 0x4/* inode create timestamp */ +#ifdef __KERNEL__struct xfs_buf ;
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 34/60 xfs: introduce xfs_inode_buf.c for inode buffer operations
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The only thing remaining in xfs_inode.[ch] are the operations that read, write or verify physical inodes in their underlying buffers. Move all this code to xfs_inode_buf.[ch] and so we can stop sharing xfs_inode.[ch] with userspace.
--- fs/xfs/Makefile | 1 + fs/xfs/xfs_inode.c | 412 -------------------------------------------- fs/xfs/xfs_inode.h | 29 +--- fs/xfs/xfs_inode_buf.c | 444 ++++++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_inode_buf.h | 52 ++++++ 5 files changed, 498 insertions(+), 440 deletions(-) create mode 100644 fs/xfs/xfs_inode_buf.c create mode 100644 fs/xfs/xfs_inode_buf.h
fs/xfs/Makefile +1 -0
@@ -78,6 +78,7 @@ xfs-y += xfs_alloc.o \ xfs_icreate_item.o \ xfs_inode.o \ xfs_inode_fork.o \ + xfs_inode_buf.o \ xfs_log_recover.o \ xfs_sb.o \ xfs_symlink.o \
fs/xfs/xfs_inode.c +0 -412
415 lines not on this page · raw message
fs/xfs/xfs_inode.h +1 -28
@@ -18,20 +18,10 @@#ifndef __XFS_INODE_H__#define __XFS_INODE_H__ -struct posix_acl ;struct xfs_dinode ;struct xfs_inode ; -/* -* Inode location information. Stored in the inode and passed to -* xfs_imap_to_bp() to get a buffer and dinode for a given inode. -*/ -struct xfs_imap { -xfs_daddr_t im_blkno;/* starting BB of inode chunk */ -ushort im_len;/* length in BBs of inode chunk */ -ushort im_boffset;/* inode offset in block in bytes */ -}; - +#include "xfs_inode_buf.h" #include "xfs_inode_fork.h" #include "xfs_inode_item_format.h"
@@ -41,21 +31,4 @@ struct xfs_imap {#endif /* __KERNEL__ */ -int xfs_imap_to_bp (struct xfs_mount *,struct xfs_trans *, -struct xfs_imap *,struct xfs_dinode **, -struct xfs_buf **,uint ,uint ); -int xfs_iread (struct xfs_mount *,struct xfs_trans *, -struct xfs_inode *,uint ); -void xfs_dinode_calc_crc (struct xfs_mount *,struct xfs_dinode *); -void xfs_dinode_to_disk (struct xfs_dinode *, -struct xfs_icdinode *); - -#if defined(DEBUG ) -void xfs_inobp_check (struct xfs_mount *,struct xfs_buf *); -#else -#define xfs_inobp_check (mp, bp) -#endif /* DEBUG */ - -extern const struct xfs_buf_ops xfs_inode_buf_ops; -#endif /* __XFS_INODE_H__ */
fs/xfs/xfs_inode_buf.c new file +444 -0
444 lines not on this page · raw message
fs/xfs/xfs_inode_buf.h new file +52 -0
52 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 35/60 xfs: start repopulating xfs_inode.[ch] with kernel code
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Now that xfs_inode.[ch] is no long shared with userspace, we can start repopulating them with core kernel inode code such as locking functions and the kernel struct xfs_inode definitions. From this point onwards, xfs_inode.[ch] is purely for in-kernel inode specific infrastructure. High level kernel only operations will slowly migrate and merge with xfs_iops.c, so xfs_inode.[ch] really only should gather core functions that are shared by other kernel-only code.
--- fs/xfs/xfs_inode.c | 434 ++++++++++++++++++++++++++++++++++++++++++++++-- fs/xfs/xfs_inode.h | 134 ++++++++++++++- fs/xfs/xfs_inode_ops.c | 415 --------------------------------------------- fs/xfs/xfs_inode_ops.h | 64 ------- 4 files changed, 545 insertions(+), 502 deletions(-)
fs/xfs/xfs_inode.c +416 -18
@@ -15,36 +15,434 @@* along with this program; if not, write the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include <linux/log2.h> -#include "xfs.h" #include "xfs_fs.h" #include "xfs_types.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" -#include "xfs_trans_priv.h" #include "xfs_sb.h" #include "xfs_ag.h" #include "xfs_mount.h" #include "xfs_bmap_btree.h" -#include "xfs_alloc_btree.h" -#include "xfs_ialloc_btree.h" -#include "xfs_attr_sf.h" #include "xfs_dinode.h" #include "xfs_inode.h" -#include "xfs_buf_item.h" -#include "xfs_inode_item.h" -#include "xfs_btree.h" -#include "xfs_alloc.h" -#include "xfs_ialloc.h" -#include "xfs_bmap.h" -#include "xfs_error.h" -#include "xfs_quota.h" -#include "xfs_filestream.h" -#include "xfs_cksum.h" #include "xfs_trace.h" -#include "xfs_icache.h" + +/* Kernel only core inode infrastructure */ kmem_zone_t *xfs_inode_zone; +/* +* This is a wrapper routine around the xfs_ilock() routine used to centralize +* some grungy code. It is used in places that wish to lock the inode solely +* for reading the extents. The reason these places can't just call +* xfs_ilock(SHARED) is that the inode lock also guards to bringing in of the +* extents from disk for a file in b-tree format. If the inode is in b-tree +* format, then we need to lock the inode exclusively until the extents are read +* in. Locking it exclusively all the time would limit our parallelism +* unnecessarily, though. What we do instead is check to see if the extents +* have been read in yet, and only lock the inode exclusively if they have not. +* +* The function returns a value which should be given to the corresponding +* xfs_iunlock_map_shared(). This value is the mode in which the lock was +* actually taken. +*/ +uint +xfs_ilock_map_shared ( +xfs_inode_t *ip) +{ +uint lock_mode; + +if ((ip->i_d.di_format ==XFS_DINODE_FMT_BTREE ) && + ((ip->i_df.if_flags &XFS_IFEXTENTS ) ==0 )) { + lock_mode =XFS_ILOCK_EXCL ; + }else { + lock_mode =XFS_ILOCK_SHARED ; + } + +xfs_ilock (ip, lock_mode); + +return lock_mode; +} + +/* +* This is simply the unlock routine to go with xfs_ilock_map_shared(). +* All it does is call xfs_iunlock() with the given lock_mode. +*/ +void +xfs_iunlock_map_shared ( +xfs_inode_t *ip, +unsigned int lock_mode) +{ +xfs_iunlock (ip, lock_mode); +} + +/* +* The xfs inode contains 2 locks: a multi-reader lock called the +* i_iolock and a multi-reader lock called the i_lock. This routine +* allows either or both of the locks to be obtained. +* +* The 2 locks should always be ordered so that the IO lock is +* obtained first in order to prevent deadlock. +* +* ip -- the inode being locked +* lock_flags -- this parameter indicates the inode's locks +* to be locked. It can be: +* XFS_IOLOCK_SHARED, +* XFS_IOLOCK_EXCL, +* XFS_ILOCK_SHARED, +* XFS_ILOCK_EXCL, +* XFS_IOLOCK_SHARED | XFS_ILOCK_SHARED, +* XFS_IOLOCK_SHARED | XFS_ILOCK_EXCL, +* XFS_IOLOCK_EXCL | XFS_ILOCK_SHARED, +* XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL +*/ +void +xfs_ilock ( +xfs_inode_t *ip, +uint lock_flags) +{ +trace_xfs_ilock (ip, lock_flags, _RET_IP_); + +/* +* You can't set both SHARED and EXCL for the same lock, +* and only XFS_IOLOCK_SHARED, XFS_IOLOCK_EXCL, XFS_ILOCK_SHARED, +* and XFS_ILOCK_EXCL are valid values to set in lock_flags. +*/ +ASSERT ((lock_flags & (XFS_IOLOCK_SHARED |XFS_IOLOCK_EXCL )) != + (XFS_IOLOCK_SHARED |XFS_IOLOCK_EXCL )); +ASSERT ((lock_flags & (XFS_ILOCK_SHARED |XFS_ILOCK_EXCL )) != + (XFS_ILOCK_SHARED |XFS_ILOCK_EXCL )); +ASSERT ((lock_flags & ~(XFS_LOCK_MASK |XFS_LOCK_DEP_MASK )) ==0 ); + +if (lock_flags &XFS_IOLOCK_EXCL ) +mrupdate_nested (&ip->i_iolock,XFS_IOLOCK_DEP (lock_flags)); +else if (lock_flags &XFS_IOLOCK_SHARED ) +mraccess_nested (&ip->i_iolock,XFS_IOLOCK_DEP (lock_flags)); + +if (lock_flags &XFS_ILOCK_EXCL ) +mrupdate_nested (&ip->i_lock,XFS_ILOCK_DEP (lock_flags)); +else if (lock_flags &XFS_ILOCK_SHARED ) +mraccess_nested (&ip->i_lock,XFS_ILOCK_DEP (lock_flags)); +} + +/* +* This is just like xfs_ilock(), except that the caller +* is guaranteed not to sleep. It returns 1 if it gets +* the requested locks and 0 otherwise. If the IO lock is +* obtained but the inode lock cannot be, then the IO lock +* is dropped before returning. +* +* ip -- the inode being locked +* lock_flags -- this parameter indicates the inode's locks to be +* to be locked. See the comment for xfs_ilock() for a list +* of valid values. +*/ +int +xfs_ilock_nowait ( +xfs_inode_t *ip, +uint lock_flags) +{ +trace_xfs_ilock_nowait (ip, lock_flags, _RET_IP_); + +/* +* You can't set both SHARED and EXCL for the same lock, +* and only XFS_IOLOCK_SHARED, XFS_IOLOCK_EXCL, XFS_ILOCK_SHARED, +* and XFS_ILOCK_EXCL are valid values to set in lock_flags. +*/ +ASSERT ((lock_flags & (XFS_IOLOCK_SHARED |XFS_IOLOCK_EXCL )) != + (XFS_IOLOCK_SHARED |XFS_IOLOCK_EXCL )); +ASSERT ((lock_flags & (XFS_ILOCK_SHARED |XFS_ILOCK_EXCL )) != + (XFS_ILOCK_SHARED |XFS_ILOCK_EXCL )); +ASSERT ((lock_flags & ~(XFS_LOCK_MASK |XFS_LOCK_DEP_MASK )) ==0 ); + +if (lock_flags &XFS_IOLOCK_EXCL ) { +if (!mrtryupdate (&ip->i_iolock)) + goto out; + }else if (lock_flags &XFS_IOLOCK_SHARED ) { +if (!mrtryaccess (&ip->i_iolock)) + goto out; + } +if (lock_flags &XFS_ILOCK_EXCL ) { +if (!mrtryupdate (&ip->i_lock)) + goto out_undo_iolock; + }else if (lock_flags &XFS_ILOCK_SHARED ) { +if (!mrtryaccess (&ip->i_lock)) + goto out_undo_iolock; + } +return 1 ; + + out_undo_iolock: +if (lock_flags &XFS_IOLOCK_EXCL ) +mrunlock_excl (&ip->i_iolock); +else if (lock_flags &XFS_IOLOCK_SHARED ) +mrunlock_shared (&ip->i_iolock); + out: +return 0 ; +} + +/* +* xfs_iunlock() is used to drop the inode locks acquired with +* xfs_ilock() and xfs_ilock_nowait(). The caller must pass +* in the flags given to xfs_ilock() or xfs_ilock_nowait() so +* that we know which locks to drop. +* +* ip -- the inode being unlocked +* lock_flags -- this parameter indicates the inode's locks to be +* to be unlocked. See the comment for xfs_ilock() for a list +* of valid values for this parameter. +* +*/ +void +xfs_iunlock ( +xfs_inode_t *ip, +uint lock_flags) +{ +/* +* You can't set both SHARED and EXCL for the same lock, +* and only XFS_IOLOCK_SHARED, XFS_IOLOCK_EXCL, XFS_ILOCK_SHARED, +* and XFS_ILOCK_EXCL are valid values to set in lock_flags. +*/ +ASSERT ((lock_flags & (XFS_IOLOCK_SHARED |XFS_IOLOCK_EXCL )) != + (XFS_IOLOCK_SHARED |XFS_IOLOCK_EXCL )); +ASSERT ((lock_flags & (XFS_ILOCK_SHARED |XFS_ILOCK_EXCL )) != + (XFS_ILOCK_SHARED |XFS_ILOCK_EXCL )); +ASSERT ((lock_flags & ~(XFS_LOCK_MASK |XFS_LOCK_DEP_MASK )) ==0 ); +ASSERT (lock_flags !=0 ); + +if (lock_flags &XFS_IOLOCK_EXCL ) +mrunlock_excl (&ip->i_iolock); +else if (lock_flags &XFS_IOLOCK_SHARED ) +mrunlock_shared (&ip->i_iolock); + +if (lock_flags &XFS_ILOCK_EXCL ) +mrunlock_excl (&ip->i_lock); +else if (lock_flags &XFS_ILOCK_SHARED ) +mrunlock_shared (&ip->i_lock); + +trace_xfs_iunlock (ip, lock_flags, _RET_IP_); +} + +/* +* give up write locks. the i/o lock cannot be held nested +* if it is being demoted. +*/ +void +xfs_ilock_demote ( +xfs_inode_t *ip, +uint lock_flags) +{ +ASSERT (lock_flags & (XFS_IOLOCK_EXCL |XFS_ILOCK_EXCL )); +ASSERT ((lock_flags & ~(XFS_IOLOCK_EXCL |XFS_ILOCK_EXCL )) ==0 ); + +if (lock_flags &XFS_ILOCK_EXCL ) +mrdemote (&ip->i_lock); +if (lock_flags &XFS_IOLOCK_EXCL ) +mrdemote (&ip->i_iolock); + +trace_xfs_ilock_demote (ip, lock_flags, _RET_IP_); +} + +#if defined(DEBUG ) || defined(XFS_WARN ) +int +xfs_isilocked ( +xfs_inode_t *ip, +uint lock_flags) +{ +if (lock_flags & (XFS_ILOCK_EXCL |XFS_ILOCK_SHARED )) { +if (!(lock_flags &XFS_ILOCK_SHARED )) +return !!ip->i_lock.mr_writer; +return rwsem_is_locked (&ip->i_lock.mr_lock); + } + +if (lock_flags & (XFS_IOLOCK_EXCL |XFS_IOLOCK_SHARED )) { +if (!(lock_flags &XFS_IOLOCK_SHARED )) +return !!ip->i_iolock.mr_writer; +return rwsem_is_locked (&ip->i_iolock.mr_lock); + } + +ASSERT (0 ); +return 0 ; +} +#endif + +#ifdef DEBUG +int xfs_locked_n; +int xfs_small_retries; +int xfs_middle_retries; +int xfs_lots_retries; +int xfs_lock_delays; +#endif + +/* +* Bump the subclass so xfs_lock_inodes() acquires each lock with +* a different value +*/ +static inline int +xfs_lock_inumorder (int lock_mode,int subclass) +{ +if (lock_mode & (XFS_IOLOCK_SHARED |XFS_IOLOCK_EXCL )) + lock_mode |= (subclass +XFS_LOCK_INUMORDER ) <<XFS_IOLOCK_SHIFT ; +if (lock_mode & (XFS_ILOCK_SHARED |XFS_ILOCK_EXCL )) + lock_mode |= (subclass +XFS_LOCK_INUMORDER ) <<XFS_ILOCK_SHIFT ; + +return lock_mode; +} + +/* +* The following routine will lock n inodes in exclusive mode. +* We assume the caller calls us with the inodes in i_ino order. +* +* We need to detect deadlock where an inode that we lock +* is in the AIL and we start waiting for another inode that is locked +* by a thread in a long running transaction (such as truncate). This can +* result in deadlock since the long running trans might need to wait +* for the inode we just locked in order to push the tail and free space +* in the log. +*/ +void +xfs_lock_inodes ( +xfs_inode_t **ips, +int inodes, +uint lock_mode) +{ +int attempts =0 , i, j, try_lock; +xfs_log_item_t *lp; + +ASSERT (ips && (inodes >=2 ));/* we need at least two */ + + try_lock =0 ; + i =0 ; + +again: +for (; i < inodes; i++) { +ASSERT (ips[i]); + +if (i && (ips[i] == ips[i-1 ]))/* Already locked */ +continue ; + +/* +* If try_lock is not set yet, make sure all locked inodes +* are not in the AIL. +* If any are, set try_lock to be used later. +*/ + +if (!try_lock) { +for (j = (i -1 ); j >=0 && !try_lock; j--) { + lp = (xfs_log_item_t *)ips[j]->i_itemp; +if (lp && (lp->li_flags &XFS_LI_IN_AIL )) { + try_lock++; + } + } + } + +/* +* If any of the previous locks we have locked is in the AIL, +* we must TRY to get the second and subsequent locks. If +* we can't get any, we must release all we have +* and try again. +*/ + +if (try_lock) { +/* try_lock must be 0 if i is 0. */ +/* +* try_lock means we have an inode locked +* that is in the AIL. +*/ +ASSERT (i !=0 ); +if (!xfs_ilock_nowait (ips[i],xfs_lock_inumorder (lock_mode, i))) { + attempts++; + +/* +* Unlock all previous guys and try again. +* xfs_iunlock will try to push the tail +* if the inode is in the AIL. +*/ + +for (j = i -1 ; j >=0 ; j--) { + +/* +* Check to see if we've already +* unlocked this one. +* Not the first one going back, +* and the inode ptr is the same. +*/ +if ((j != (i -1 )) && ips[j] == + ips[j+1 ]) +continue ; + +xfs_iunlock (ips[j], lock_mode); + } + +if ((attempts %5 ) ==0 ) { +delay (1 );/* Don't just spin the CPU */ +#ifdef DEBUG + xfs_lock_delays++; +#endif + } + i =0 ; + try_lock =0 ; + goto again; + } + }else { +xfs_ilock (ips[i],xfs_lock_inumorder (lock_mode, i)); + } + } + +#ifdef DEBUG +if (attempts) { +if (attempts <5 ) xfs_small_retries++; +else if (attempts <100 ) xfs_middle_retries++; +else xfs_lots_retries++; + }else { + xfs_locked_n++; + } +#endif +} + +/* +* xfs_lock_two_inodes() can only be used to lock one type of lock +* at a time - the iolock or the ilock, but not both at once. If +* we lock both at once, lockdep will report false positives saying +* we have violated locking orders. +*/ +void +xfs_lock_two_inodes ( +xfs_inode_t *ip0, +xfs_inode_t *ip1, +uint lock_mode) +{ +xfs_inode_t *temp; +int attempts =0 ; +xfs_log_item_t *lp; + +if (lock_mode & (XFS_IOLOCK_SHARED |XFS_IOLOCK_EXCL )) +ASSERT ((lock_mode & (XFS_ILOCK_SHARED |XFS_ILOCK_EXCL )) ==0 ); +ASSERT (ip0->i_ino != ip1->i_ino); + +if (ip0->i_ino > ip1->i_ino) { + temp = ip0; + ip0 = ip1; + ip1 = temp; + } + + again: +xfs_ilock (ip0,xfs_lock_inumorder (lock_mode,0 )); + +/* +* If the first lock we have locked is in the AIL, we must TRY to get +* the second lock. If we can't get it, we must release the first one +* and try again. +*/ + lp = (xfs_log_item_t *)ip0->i_itemp; +if (lp && (lp->li_flags &XFS_LI_IN_AIL )) { +if (!xfs_ilock_nowait (ip1,xfs_lock_inumorder (lock_mode,1 ))) { +xfs_iunlock (ip0, lock_mode); +if ((++attempts %5 ) ==0 ) +delay (1 );/* Don't just spin the CPU */ + goto again; + } + }else { +xfs_ilock (ip1,xfs_lock_inumorder (lock_mode,1 )); + } +}
fs/xfs/xfs_inode.h +129 -5
146 lines not on this page · raw message
fs/xfs/xfs_inode_ops.c +0 -415
421 lines not on this page · raw message
fs/xfs/xfs_inode_ops.h +0 -64
86 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 36/60 xfs: move swap extent code to xfs_extent_ops
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Swapping extents is clearly an extent operaiton, and it is not shared with userspace. Move the code to xfs_extent_ops.[ch], and the userspace ioctl structure definition to xfs_fs.h where most of the other ioctl structure definitions are. The means xfs_dfrag.h is no longer needed in userspace.
--- fs/xfs/Makefile | 1 - fs/xfs/xfs_dfrag.c | 456 ----------------------------------------------- fs/xfs/xfs_dfrag.h | 53 ------ fs/xfs/xfs_extent_ops.c | 416 ++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_extent_ops.h | 2 + fs/xfs/xfs_fs.h | 15 ++ fs/xfs/xfs_ioctl.c | 1 - fs/xfs/xfs_ioctl32.c | 2 +- 8 files changed, 434 insertions(+), 512 deletions(-) delete mode 100644 fs/xfs/xfs_dfrag.c delete mode 100644 fs/xfs/xfs_dfrag.h
fs/xfs/Makefile +0 -1
@@ -31,7 +31,6 @@ xfs-y += xfs_aops.o \ xfs_attr_list.o \ xfs_bit.o \ xfs_buf.o \ - xfs_dfrag.o \ xfs_dir2_readdir.o \ xfs_discard.o \ xfs_error.o \
fs/xfs/xfs_dfrag.c deleted +0 -456
456 lines not on this page · raw message
fs/xfs/xfs_dfrag.h deleted +0 -53
53 lines not on this page · raw message
fs/xfs/xfs_extent_ops.c +416 -0
419 lines not on this page · raw message
fs/xfs/xfs_extent_ops.h +2 -0
@@ -27,4 +27,6 @@ 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); +int xfs_swapext (struct xfs_swapext *sx); +#endif /* _XFS_EXTENT_OPS_H */
fs/xfs/xfs_fs.h +15 -0
@@ -461,6 +461,21 @@ typedef struct xfs_handle { + (handle).ha_fid.fid_len)/* +* Structure passed to XFS_IOC_SWAPEXT +*/ +typedef struct xfs_swapext +{ +__int64_t sx_version;/* version */ +#define XFS_SX_VERSION 0 +__int64_t sx_fdtarget;/* fd of target file */ +__int64_t sx_fdtmp;/* fd of tmp file */ +xfs_off_t sx_offset;/* offset into file */ +xfs_off_t sx_length;/* leng from offset */ +char sx_pad[16 ];/* pad space, unused */ +xfs_bstat_t sx_stat;/* stat of target b4 copy */ +}xfs_swapext_t ; + +/* * Flags for going down operation */ #define XFS_FSOP_GOING_FLAGS_DEFAULT 0x0/* going down */
fs/xfs/xfs_ioctl.c +0 -1
@@ -33,7 +33,6 @@#include "xfs_attr.h" #include "xfs_bmap.h" #include "xfs_buf_item.h" -#include "xfs_dfrag.h" #include "xfs_fsops.h" #include "xfs_discard.h" #include "xfs_quota.h"
fs/xfs/xfs_ioctl32.c +1 -1
@@ -33,7 +33,6 @@#include "xfs_inode.h" #include "xfs_itable.h" #include "xfs_error.h" -#include "xfs_dfrag.h" #include "xfs_fsops.h" #include "xfs_alloc.h" #include "xfs_rtalloc.h"
@@ -41,6 +40,7 @@#include "xfs_ioctl.h" #include "xfs_ioctl32.h" #include "xfs_trace.h" +#include "xfs_extent_ops.h" #define _NATIVE_IOC (cmd, type) \ _IOC(_IOC_DIR(cmd), _IOC_TYPE(cmd), _IOC_NR(cmd), sizeof(type))
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 37/60 xfs: split out inode log item format definition
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The EFI/EFD item format definitions are shared with userspace. Split the out of header files that contain kernel only defintions to make it simple to shared them.
--- fs/xfs/xfs_extfree_item.h | 90 ++------------------------------- fs/xfs/xfs_extfree_item_format.h | 101 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+), 86 deletions(-) create mode 100644 fs/xfs/xfs_extfree_item_format.h
fs/xfs/xfs_extfree_item.h +4 -86
@@ -18,92 +18,12 @@#ifndef __XFS_EXTFREE_ITEM_H__#define __XFS_EXTFREE_ITEM_H__ -struct xfs_mount ; -struct kmem_zone ; - -typedef struct xfs_extent { -xfs_dfsbno_t ext_start; -xfs_extlen_t ext_len; -}xfs_extent_t ; - -/* -* Since an xfs_extent_t has types (start:64, len: 32) -* there are different alignments on 32 bit and 64 bit kernels. -* So we provide the different variants for use by a -* conversion routine. -*/ - -typedef struct xfs_extent_32 { -__uint64_t ext_start; -__uint32_t ext_len; -} __attribute__((packed))xfs_extent_32_t ; - -typedef struct xfs_extent_64 { -__uint64_t ext_start; -__uint32_t ext_len; -__uint32_t ext_pad; -}xfs_extent_64_t ; - -/* -* This is the structure used to lay out an efi log item in the -* log. The efi_extents field is a variable size array whose -* size is given by efi_nextents. -*/ -typedef struct xfs_efi_log_format { -__uint16_t efi_type;/* efi log item type */ -__uint16_t efi_size;/* size of this item */ -__uint32_t efi_nextents;/* # extents to free */ -__uint64_t efi_id;/* efi identifier */ -xfs_extent_t efi_extents[1 ];/* array of extents to free */ -}xfs_efi_log_format_t ; +#include "xfs_extfree_item_format.h" -typedef struct xfs_efi_log_format_32 { -__uint16_t efi_type;/* efi log item type */ -__uint16_t efi_size;/* size of this item */ -__uint32_t efi_nextents;/* # extents to free */ -__uint64_t efi_id;/* efi identifier */ -xfs_extent_32_t efi_extents[1 ];/* array of extents to free */ -} __attribute__((packed))xfs_efi_log_format_32_t ; +/* kernel only EFI/EFD definitions */ -typedef struct xfs_efi_log_format_64 { -__uint16_t efi_type;/* efi log item type */ -__uint16_t efi_size;/* size of this item */ -__uint32_t efi_nextents;/* # extents to free */ -__uint64_t efi_id;/* efi identifier */ -xfs_extent_64_t efi_extents[1 ];/* array of extents to free */ -}xfs_efi_log_format_64_t ; - -/* -* This is the structure used to lay out an efd log item in the -* log. The efd_extents array is a variable size array whose -* size is given by efd_nextents; -*/ -typedef struct xfs_efd_log_format { -__uint16_t efd_type;/* efd log item type */ -__uint16_t efd_size;/* size of this item */ -__uint32_t efd_nextents;/* # of extents freed */ -__uint64_t efd_efi_id;/* id of corresponding efi */ -xfs_extent_t efd_extents[1 ];/* array of extents freed */ -}xfs_efd_log_format_t ; - -typedef struct xfs_efd_log_format_32 { -__uint16_t efd_type;/* efd log item type */ -__uint16_t efd_size;/* size of this item */ -__uint32_t efd_nextents;/* # of extents freed */ -__uint64_t efd_efi_id;/* id of corresponding efi */ -xfs_extent_32_t efd_extents[1 ];/* array of extents freed */ -} __attribute__((packed))xfs_efd_log_format_32_t ; - -typedef struct xfs_efd_log_format_64 { -__uint16_t efd_type;/* efd log item type */ -__uint16_t efd_size;/* size of this item */ -__uint32_t efd_nextents;/* # of extents freed */ -__uint64_t efd_efi_id;/* id of corresponding efi */ -xfs_extent_64_t efd_extents[1 ];/* array of extents freed */ -}xfs_efd_log_format_64_t ; - - -#ifdef __KERNEL__ +struct xfs_mount ; +struct kmem_zone ;/* * Max number of extents in fast allocation path.
@@ -160,6 +80,4 @@ int xfs_efi_copy_format(xfs_log_iovec_t *buf, xfs_efi_log_format_t *dst_efi_fmt);void xfs_efi_item_free (xfs_efi_log_item_t *); -#endif /* __KERNEL__ */ -#endif /* __XFS_EXTFREE_ITEM_H__ */
fs/xfs/xfs_extfree_item_format.h new file +101 -0
101 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 38/60 xfs: separate dquot on disk format definitions out of xfs_quota.h
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The on disk format definitions of the on-disk dquot, log formats and quota off log formats are all intertwined with other definitions for quotas. Separate them out into their own header file so they can easily be shared with userspace.
--- fs/xfs/xfs_dquot_format.h | 132 +++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_quota.h | 114 +-------------------------------------- 2 files changed, 134 insertions(+), 112 deletions(-) create mode 100644 fs/xfs/xfs_dquot_format.h
fs/xfs/xfs_dquot_format.h new file +132 -0
@@ -0,0 +1,132 @@ +/* +* 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_DQUOT_FORMAT_H__ +#define __XFS_DQUOT_FORMAT_H__ + +/* +* The ondisk form of a dquot structure. +*/ +#define XFS_DQUOT_MAGIC 0x4451/* 'DQ' */ +#define XFS_DQUOT_VERSION (u_int8_t)0x01/* latest version number */ + +/* +* uid_t and gid_t are hard-coded to 32 bits in the inode. +* Hence, an 'id' in a dquot is 32 bits.. +*/ +typedef __uint32_t xfs_dqid_t ; + +/* +* This is the main portion of the on-disk representation of quota +* information for a user. This is the q_core of the xfs_dquot_t that +* is kept in kernel memory. We pad this with some more expansion room +* to construct the on disk structure. +*/ +typedef struct xfs_disk_dquot { +__be16 d_magic;/* dquot magic = XFS_DQUOT_MAGIC */ +__u8 d_version;/* dquot version */ +__u8 d_flags;/* XFS_DQ_USER/PROJ/GROUP */ +__be32 d_id;/* user,project,group id */ +__be64 d_blk_hardlimit;/* absolute limit on disk blks */ +__be64 d_blk_softlimit;/* preferred limit on disk blks */ +__be64 d_ino_hardlimit;/* maximum # allocated inodes */ +__be64 d_ino_softlimit;/* preferred inode limit */ +__be64 d_bcount;/* disk blocks owned by the user */ +__be64 d_icount;/* inodes owned by the user */ +__be32 d_itimer;/* zero if within inode limits if not, +this is when we refuse service */ +__be32 d_btimer;/* similar to above; for disk blocks */ +__be16 d_iwarns;/* warnings issued wrt num inodes */ +__be16 d_bwarns;/* warnings issued wrt disk blocks */ +__be32 d_pad0;/* 64 bit align */ +__be64 d_rtb_hardlimit;/* absolute limit on realtime blks */ +__be64 d_rtb_softlimit;/* preferred limit on RT disk blks */ +__be64 d_rtbcount;/* realtime blocks owned */ +__be32 d_rtbtimer;/* similar to above; for RT disk blocks */ +__be16 d_rtbwarns;/* warnings issued wrt RT disk blocks */ +__be16 d_pad; +}xfs_disk_dquot_t ; + +/* +* This is what goes on disk. This is separated from the xfs_disk_dquot because +* carrying the unnecessary padding would be a waste of memory. +*/ +typedef struct xfs_dqblk { +xfs_disk_dquot_t dd_diskdq;/* portion that lives incore as well */ +char dd_fill[4 ];/* filling for posterity */ + +/* +* These two are only present on filesystems with the CRC bits set. +*/ +__be32 dd_crc;/* checksum */ +__be64 dd_lsn;/* last modification in log */ +uuid_t dd_uuid;/* location information */ +}xfs_dqblk_t ; + +#define XFS_DQUOT_CRC_OFF offsetof(struct xfs_dqblk, dd_crc) + +/* +* These are the structures used to lay out dquots and quotaoff +* records on the log. Quite similar to those of inodes. +*/ + +/* +* log format struct for dquots. +* The first two fields must be the type and size fitting into +* 32 bits : log_recovery code assumes that. +*/ +typedef struct xfs_dq_logformat { +__uint16_t qlf_type;/* dquot log item type */ +__uint16_t qlf_size;/* size of this item */ +xfs_dqid_t qlf_id;/* usr/grp/proj id : 32 bits */ +__int64_t qlf_blkno;/* blkno of dquot buffer */ +__int32_t qlf_len;/* len of dquot buffer */ +__uint32_t qlf_boffset;/* off of dquot in buffer */ +}xfs_dq_logformat_t ; + +/* +* log format struct for QUOTAOFF records. +* The first two fields must be the type and size fitting into +* 32 bits : log_recovery code assumes that. +* We write two LI_QUOTAOFF logitems per quotaoff, the last one keeps a pointer +* to the first and ensures that the first logitem is taken out of the AIL +* only when the last one is securely committed. +*/ +typedef struct xfs_qoff_logformat { +unsigned short qf_type;/* quotaoff log item type */ +unsigned short qf_size;/* size of this item */ +unsigned int qf_flags;/* USR and/or GRP */ +char qf_pad[12 ];/* padding for future */ +}xfs_qoff_logformat_t ; + +/* +* Disk quotas status in m_qflags, sb_qflags and xfs_qoff_logformat. 16 bits. +*/ +#define XFS_UQUOTA_ACCT 0x0001/* user quota accounting ON */ +#define XFS_UQUOTA_ENFD 0x0002/* user quota limits enforced */ +#define XFS_UQUOTA_CHKD 0x0004/* quotacheck run on usr quotas */ +#define XFS_PQUOTA_ACCT 0x0008/* project quota accounting ON */ +#define XFS_OQUOTA_ENFD 0x0010/* other (grp/prj) quota limits enforced */ +#define XFS_OQUOTA_CHKD 0x0020/* quotacheck run on other (grp/prj) quotas */ +#define XFS_GQUOTA_ACCT 0x0040/* group quota accounting ON */ + +#define XFS_ALL_QUOTA_ACCT \ + (XFS_UQUOTA_ACCT | XFS_GQUOTA_ACCT | XFS_PQUOTA_ACCT) +#define XFS_ALL_QUOTA_ENFD (XFS_UQUOTA_ENFD | XFS_OQUOTA_ENFD) +#define XFS_ALL_QUOTA_CHKD (XFS_UQUOTA_CHKD | XFS_OQUOTA_CHKD) + +#endif /* __XFS_DQUOT_FORMAT_H__ */
fs/xfs/xfs_quota.h +2 -112
136 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 39/60 xfs: separate icreate log format definitions from xfs_icreate_item.h
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The on disk log format definitions for the icreate log item are intertwined with the kernel-only in-memory log item definitions. Separate the log format definitions out into their own header file so they can easily be shared with userspace.
--- fs/xfs/xfs_icreate_item.h | 22 +-------------------- fs/xfs/xfs_icreate_item_format.h | 39 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 21 deletions(-) create mode 100644 fs/xfs/xfs_icreate_item_format.h
fs/xfs/xfs_icreate_item.h +1 -21
@@ -18,25 +18,7 @@#ifndef XFS_ICREATE_ITEM_H #define XFS_ICREATE_ITEM_H 1 -/* -* on disk log item structure -* -* Log recovery assumes the first two entries are the type and size and they fit -* in 32 bits. Also in host order (ugh) so they have to be 32 bit aligned so -* decoding can be done correctly. -*/ -struct xfs_icreate_log { -__uint16_t icl_type;/* type of log format structure */ -__uint16_t icl_size;/* size of log format structure */ -__be32 icl_ag;/* ag being allocated in */ -__be32 icl_agbno;/* start block of inode range */ -__be32 icl_count;/* number of inodes to initialise */ -__be32 icl_isize;/* size of inodes */ -__be32 icl_length;/* length of extent to initialise */ -__be32 icl_gen;/* inode generation number to use */ -}; - -#ifdef __KERNEL__ +#include "xfs_icreate_item_format.h" /* in memory log item structure */ struct xfs_icreate_item {
@@ -51,6 +33,4 @@ 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_icreate_item_format.h new file +39 -0
@@ -0,0 +1,39 @@ +/* +* Copyright (c) 2008-2010, Dave Chinner +* 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_ICREATE_ITEM_FORMAT_H__ +#define __XFS_ICREATE_ITEM_FORMAT_H__ 1 + +/* +* on disk log item structure +* +* Log recovery assumes the first two entries are the type and size and they fit +* in 32 bits. Also in host order (ugh) so they have to be 32 bit aligned so +* decoding can be done correctly. +*/ +struct xfs_icreate_log { +__uint16_t icl_type;/* type of log format structure */ +__uint16_t icl_size;/* size of log format structure */ +__be32 icl_ag;/* ag being allocated in */ +__be32 icl_agbno;/* start block of inode range */ +__be32 icl_count;/* number of inodes to initialise */ +__be32 icl_isize;/* size of inodes */ +__be32 icl_length;/* length of extent to initialise */ +__be32 icl_gen;/* inode generation number to use */ +}; + +#endif /* __XFS_ICREATE_ITEM_FORMAT_H__ */
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 40/60 xfs: don't special case shared superblock mounts
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Neither kernel or userspace support shared read-only mounts, so don't beother special casing the support check to be different between kernel and userspace. The same check canbe used as neither like it...
--- fs/xfs/xfs_sb.h | 7 ------- 1 file changed, 7 deletions(-)
fs/xfs/xfs_sb.h +0 -7
@@ -355,15 +355,8 @@ static inline int xfs_sb_good_version(xfs_sb_t *sbp) (sbp->sb_features2 & ~XFS_SB_VERSION2_OKREALBITS)))return 0 ; -#ifdef __KERNEL__if (sbp->sb_shared_vn >XFS_SB_MAX_SHARED_VN )return 0 ; -#else -if ((sbp->sb_versionnum &XFS_SB_VERSION_SHAREDBIT ) && - sbp->sb_shared_vn >XFS_SB_MAX_SHARED_VN ) -return 0 ; -#endif -return 1 ; }if (XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 )
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 41/60 xfs: kill __KERNEL__ check for debug code in allocation code
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Userspace running debug builds is relatively rare, so there's need to special case the allocation algorithm code coverage debug switch. As it is, userspace defines random numbers to 0, so invert the logic of the switch so it is effectively a no-op in userspace. This kills another couple of __KERNEL__ users.
--- fs/xfs/xfs_alloc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/xfs/xfs_alloc.c +3 -3
@@ -878,7 +878,7 @@ xfs_alloc_ag_vextent_near(xfs_agblock_t ltnew;/* useful start bno of left side */ xfs_extlen_t rlen;/* length of returned extent */ int forced =0 ; -#if defined(DEBUG ) && defined(__KERNEL__) +#ifdef DEBUG /* * Randomly don't execute the first algorithm. */
@@ -938,8 +938,8 @@ restart:xfs_extlen_t blen=0 ;xfs_agblock_t bnew=0 ; -#if defined(DEBUG ) && defined(__KERNEL__) -if (!dofirst) +#ifdef DEBUG +if (dofirst)break ;#endif /*
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 42/60 xfs: split out on-disk transaction definitions
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
There's a bunch of definitions in xfs_trans.h that define on-disk formats - transaction headers taht get written into the log, log item type definitions, etc. Split out everything into a separate file so that all which remains in xfs_trans.h are kernel only definitions.
Also, remove the duplicate magic number definitions for XFS_TRANS_HEADER_MAGIC...
--- fs/xfs/xfs_trans.c | 4 +- fs/xfs/xfs_trans.h | 217 +--------------------------------------- fs/xfs/xfs_trans_format.h | 240 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 243 insertions(+), 218 deletions(-) create mode 100644 fs/xfs/xfs_trans_format.h
fs/xfs/xfs_trans.c +2 -2
@@ -92,7 +92,7 @@ _xfs_trans_alloc(atomic_inc (&mp->m_active_trans); tp =kmem_zone_zalloc (xfs_trans_zone, memflags); - tp->t_magic =XFS_TRANS_MAGIC ; + tp->t_magic =XFS_TRANS_HEADER_MAGIC ; tp->t_type = type; tp->t_mountp = mp;INIT_LIST_HEAD (&tp->t_items);
@@ -137,7 +137,7 @@ xfs_trans_dup(/* * Initialize the new transaction structure. */ - ntp->t_magic =XFS_TRANS_MAGIC ; + ntp->t_magic =XFS_TRANS_HEADER_MAGIC ; ntp->t_type = tp->t_type; ntp->t_mountp = tp->t_mountp;INIT_LIST_HEAD (&ntp->t_items);
fs/xfs/xfs_trans.h +1 -216
227 lines not on this page · raw message
fs/xfs/xfs_trans_format.h new file +240 -0
240 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 43/60 xfs: remove __KERNEL__ from debug code
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
There is no reason the remaining kernel-only debug code needs to remain kernel-only. Kill the __KERNEL__ part of the defines, and let userspace handle the debug code appropriately.
--- fs/xfs/xfs_bmap.h | 2 +- fs/xfs/xfs_dir2_data.c | 4 ++-- fs/xfs/xfs_rtalloc.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
fs/xfs/xfs_bmap.h +1 -1
@@ -163,7 +163,7 @@ typedef struct xfs_bmalloca { { BMAP_RIGHT_FILLING, "RF" }, \ { BMAP_ATTRFORK, "ATTR" } -#if defined(__KERNEL) && defined(DEBUG ) +#ifdef DEBUG void xfs_bmap_trace_exlist (struct xfs_inode *ip,xfs_extnum_t cnt,int whichfork,unsigned long caller_ip);#define XFS_BMAP_TRACE_EXLIST (ip,c,w) \
fs/xfs/xfs_dir2_data.c +2 -2
@@ -331,7 +331,7 @@ xfs_dir2_data_freefind(xfs_dir2_data_free_t *dfp;/* bestfree entry */ xfs_dir2_data_aoff_t off;/* offset value needed */ struct xfs_dir2_data_free *bf; -#if defined(DEBUG ) && defined(__KERNEL__) +#ifdef DEBUG int matched;/* matched the value */ int seenzero;/* saw a 0 bestfree entry */ #endif
@@ -339,7 +339,7 @@ xfs_dir2_data_freefind( off = (xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr); bf =xfs_dir3_data_bestfree_p (hdr); -#if defined(DEBUG ) && defined(__KERNEL__) +#ifdef DEBUG /* * Validate some consistency in the bestfree table. * Check order, non-overlapping entries, and if we find the
fs/xfs/xfs_rtalloc.c +1 -1
@@ -2146,7 +2146,7 @@ xfs_rtfree_extent(ASSERT (mp->m_rbmip->i_itemp !=NULL );ASSERT (xfs_isilocked (mp->m_rbmip,XFS_ILOCK_EXCL )); -#if defined(__KERNEL__) && defined(DEBUG ) +#ifdef DEBUG /* * Check to see that this whole range is currently allocated. */
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 44/60 xfs: remove __KERNEL__ check from xfs_dir2_leaf.c
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
It's actually an ifndef section, which means it is only included in userspace. however, it's deep within the libxfs code, so it's unlikely that the condition checked in userspace can actually occur (search an empty leaf) through the libxfs interfaces. i.e. if it can happen in usrspace, it can happen in the kernel, so remove it from userspace too....
--- fs/xfs/xfs_dir2_leaf.c | 4 ---- 1 file changed, 4 deletions(-)
fs/xfs/xfs_dir2_leaf.c +0 -4
@@ -1587,10 +1587,6 @@ xfs_dir2_leaf_search_hash( ents =xfs_dir3_leaf_ents_p (leaf);xfs_dir3_leaf_hdr_from_disk (&leafhdr, leaf); -#ifndef __KERNEL__ -if (!leafhdr.count) -return 0 ; -#endif /* * Note, the table cannot be empty, so we have to go through the loop. * Binary search the leaf entries looking for our hash value.
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 45/60 xfs: xfs_filestreams.h doesn't need __KERNEL__
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Because it is only used within the kernel.
--- fs/xfs/xfs_filestream.h | 4 ---- 1 file changed, 4 deletions(-)
fs/xfs/xfs_filestream.h +0 -4
@@ -18,8 +18,6 @@#ifndef __XFS_FILESTREAM_H__#define __XFS_FILESTREAM_H__ -#ifdef __KERNEL__ -struct xfs_mount ;struct xfs_inode ;struct xfs_perag ;
@@ -69,6 +67,4 @@ xfs_inode_is_filestream( (ip->i_d.di_flags & XFS_DIFLAG_FILESTREAM); } -#endif /* __KERNEL__ */ -#endif /* __XFS_FILESTREAM_H__ */
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 46/60 xfs: split out the remote symlink handling
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The remote symlink format definition and manipulation needs to be shared with userspace, but the in-kernel interfaces do not. Split the remote symlink format handling out into xfs_symlink_remote.[ch] fo it can easily be shared with userspace.
--- fs/xfs/Makefile | 3 +- fs/xfs/xfs_symlink.c | 174 +------------------------------------ fs/xfs/xfs_symlink.h | 41 +-------- fs/xfs/xfs_symlink_remote.c | 200 +++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_symlink_remote.h | 60 +++++++++++++ 5 files changed, 267 insertions(+), 211 deletions(-) create mode 100644 fs/xfs/xfs_symlink_remote.c create mode 100644 fs/xfs/xfs_symlink_remote.h
fs/xfs/Makefile +2 -1
@@ -51,6 +51,7 @@ xfs-y += xfs_aops.o \ xfs_mount.o \ xfs_mru_cache.o \ xfs_super.o \ + xfs_symlink.o \ xfs_trans.o \ xfs_xattr.o \ kmem.o \
@@ -80,7 +81,7 @@ xfs-y += xfs_alloc.o \ xfs_inode_buf.o \ xfs_log_recover.o \ xfs_sb.o \ - xfs_symlink.o \ + xfs_symlink_remote.o \ xfs_trans_resv.o # low-level transaction/log code
fs/xfs/xfs_symlink.c +1 -173
196 lines not on this page · raw message
fs/xfs/xfs_symlink.h +4 -37
55 lines not on this page · raw message
fs/xfs/xfs_symlink_remote.c new file +200 -0
200 lines not on this page · raw message
fs/xfs/xfs_symlink_remote.h new file +60 -0
60 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 47/60 xfs: separate out log format definitions
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The on-disk format definitions for the log are spread randoms through a couple of header files. Consolidate it all in a single file that can be shared easily with userspace. This means that xfs_log.h and xfs_log_priv.h no longer need to be shared with userspace.
--- fs/xfs/xfs_log.h | 89 ++++++----------------- fs/xfs/xfs_log_format.h | 178 ++++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_log_priv.h | 146 ++----------------------------------- fs/xfs/xfs_log_recover.c | 2 + 4 files changed, 207 insertions(+), 208 deletions(-) create mode 100644 fs/xfs/xfs_log_format.h
fs/xfs/xfs_log.h +21 -68
@@ -18,14 +18,29 @@#ifndef __XFS_LOG_H__#define __XFS_LOG_H__ -/* get lsn fields */ -#define CYCLE_LSN (lsn) ((uint)((lsn)>>32)) -#define BLOCK_LSN (lsn) ((uint)(lsn)) +#include "xfs_log_format.h" -/* this is used in a spot where we might otherwise double-endian-flip */ -#define CYCLE_LSN_DISK (lsn) (((__be32 *)&(lsn))[0]) +struct xfs_log_vec { +struct xfs_log_vec *lv_next;/* next lv in build list */ +int lv_niovecs;/* number of iovecs in lv */ +struct xfs_log_iovec *lv_iovecp;/* iovec array */ +struct xfs_log_item *lv_item;/* owner */ +char *lv_buf;/* formatted buffer */ +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. +*/ +typedef struct xfs_log_callback { +struct xfs_log_callback *cb_next; +void (*cb_func)(void *,int ); +void *cb_arg; +}xfs_log_callback_t ; -#ifdef __KERNEL__/* * By comparing each component, we don't have to worry about extra * endian issues in treating two 32 bit numbers as one 64 bit number
@@ -59,67 +74,6 @@ static inline xfs_lsn_t _lsn_cmp(xfs_lsn_t lsn1, xfs_lsn_t lsn2)*/ #define XFS_LOG_SYNC 0x1 -#endif /* __KERNEL__ */ - - -/* Log Clients */ -#define XFS_TRANSACTION 0x69 -#define XFS_VOLUME 0x2 -#define XFS_LOG 0xaa - - -/* Region types for iovec's i_type */ -#define XLOG_REG_TYPE_BFORMAT 1 -#define XLOG_REG_TYPE_BCHUNK 2 -#define XLOG_REG_TYPE_EFI_FORMAT 3 -#define XLOG_REG_TYPE_EFD_FORMAT 4 -#define XLOG_REG_TYPE_IFORMAT 5 -#define XLOG_REG_TYPE_ICORE 6 -#define XLOG_REG_TYPE_IEXT 7 -#define XLOG_REG_TYPE_IBROOT 8 -#define XLOG_REG_TYPE_ILOCAL 9 -#define XLOG_REG_TYPE_IATTR_EXT 10 -#define XLOG_REG_TYPE_IATTR_BROOT 11 -#define XLOG_REG_TYPE_IATTR_LOCAL 12 -#define XLOG_REG_TYPE_QFORMAT 13 -#define XLOG_REG_TYPE_DQUOT 14 -#define XLOG_REG_TYPE_QUOTAOFF 15 -#define XLOG_REG_TYPE_LRHEADER 16 -#define XLOG_REG_TYPE_UNMOUNT 17 -#define XLOG_REG_TYPE_COMMIT 18 -#define XLOG_REG_TYPE_TRANSHDR 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 */ -int i_len;/* length in bytes of region */ -uint i_type;/* type of region */ -}xfs_log_iovec_t ; - -struct xfs_log_vec { -struct xfs_log_vec *lv_next;/* next lv in build list */ -int lv_niovecs;/* number of iovecs in lv */ -struct xfs_log_iovec *lv_iovecp;/* iovec array */ -struct xfs_log_item *lv_item;/* owner */ -char *lv_buf;/* formatted buffer */ -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. -*/ -typedef struct xfs_log_callback { -struct xfs_log_callback *cb_next; -void (*cb_func)(void *,int ); -void *cb_arg; -}xfs_log_callback_t ; - - -#ifdef __KERNEL__/* Log manager interfaces */ struct xfs_mount ;struct xlog_in_core ;
@@ -188,5 +142,4 @@ void xfs_log_work_queue(struct xfs_mount *mp);void xfs_log_worker (struct work_struct *work);void xfs_log_quiesce (struct xfs_mount *mp); -#endif #endif /* __XFS_LOG_H__ */
fs/xfs/xfs_log_format.h new file +178 -0
178 lines not on this page · raw message
fs/xfs/xfs_log_priv.h +6 -140
184 lines not on this page · raw message
fs/xfs/xfs_log_recover.c +2 -0
@@ -54,6 +54,8 @@#include "xfs_attr_leaf.h" #include "xfs_attr_remote.h" +#define BLK_AVG (blk1, blk2) ((blk1+blk2) >> 1) + STATIC int xlog_find_zeroed( struct xlog *,
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 48/60 xfs: move kernel specific type definitions to xfs.h
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
xfs_types.h is shared with userspace, so having kernel specific types defined in it is problematic. Move all the kernel specific defines to xfs_linux.h so we can remove the __KERNEL__ guards from xfs_types.h
--- fs/xfs/xfs_linux.h | 32 ++++++++++++++++++++++++++++++++ fs/xfs/xfs_types.h | 36 ------------------------------------ 2 files changed, 32 insertions(+), 36 deletions(-)
fs/xfs/xfs_linux.h +32 -0
@@ -32,6 +32,38 @@# define XFS_BIG_INUMS 0#endif +/* +* Kernel specific type declarations for XFS +*/ +typedef signed char __int8_t ; +typedef unsigned char __uint8_t ; +typedef signed short int __int16_t ; +typedef unsigned short int __uint16_t ; +typedef signed int __int32_t ; +typedef unsigned int __uint32_t ; +typedef signed long long int __int64_t ; +typedef unsigned long long int __uint64_t ; + +typedef __uint32_t inst_t ;/* an instruction */ + +typedef __s64 xfs_off_t ;/* <file offset> type */ +typedef unsigned long long xfs_ino_t ;/* <inode> type */ +typedef __s64 xfs_daddr_t ;/* <disk address> type */ +typedef char *xfs_caddr_t ;/* <core address> type */ +typedef __u32 xfs_dev_t ; +typedef __u32 xfs_nlink_t ; + +/* __psint_t is the same size as a pointer */ +#if (BITS_PER_LONG ==32 ) +typedef __int32_t __psint_t ; +typedef __uint32_t __psunsigned_t ; +#elif (BITS_PER_LONG ==64 ) +typedef __int64_t __psint_t ; +typedef __uint64_t __psunsigned_t ; +#else +#error BITS_PER_LONG must be 32 or 64 +#endif +#include "xfs_types.h" #include "kmem.h"
fs/xfs/xfs_types.h +0 -36
@@ -18,42 +18,6 @@#ifndef __XFS_TYPES_H__#define __XFS_TYPES_H__ -#ifdef __KERNEL__ - -/* -* Additional type declarations for XFS -*/ -typedef signed char __int8_t ; -typedef unsigned char __uint8_t ; -typedef signed short int __int16_t ; -typedef unsigned short int __uint16_t ; -typedef signed int __int32_t ; -typedef unsigned int __uint32_t ; -typedef signed long long int __int64_t ; -typedef unsigned long long int __uint64_t ; - -typedef __uint32_t inst_t ;/* an instruction */ - -typedef __s64 xfs_off_t ;/* <file offset> type */ -typedef unsigned long long xfs_ino_t ;/* <inode> type */ -typedef __s64 xfs_daddr_t ;/* <disk address> type */ -typedef char *xfs_caddr_t ;/* <core address> type */ -typedef __u32 xfs_dev_t ; -typedef __u32 xfs_nlink_t ; - -/* __psint_t is the same size as a pointer */ -#if (BITS_PER_LONG ==32 ) -typedef __int32_t __psint_t ; -typedef __uint32_t __psunsigned_t ; -#elif (BITS_PER_LONG ==64 ) -typedef __int64_t __psint_t ; -typedef __uint64_t __psunsigned_t ; -#else -#error BITS_PER_LONG must be 32 or 64 -#endif - -#endif /* __KERNEL__ */ -typedef __uint32_t prid_t ;/* project ID */ typedef __uint32_t xfs_agblock_t ;/* blockno in alloc. group */
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 49/60 xfs: make struct xfs_perag kernel only
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The struct xfs_perag has many kernel-only definitions in it, requiring a __KERNEL__ guard so userspace can use it to. Move it to xfs_mount.h so that it it kernel-only, and let userspace redefine it's own version of the structure containing only what it needs. This gets rid of another __KERNEL__ check in the XFS header files.
--- fs/xfs/xfs_acl.c | 1 + fs/xfs/xfs_ag.h | 53 ------------------------------------------- fs/xfs/xfs_mount.h | 52 ++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_symlink_remote.c | 1 + 4 files changed, 54 insertions(+), 53 deletions(-)
fs/xfs/xfs_acl.c +1 -0
@@ -20,6 +20,7 @@#include "xfs_attr.h" #include "xfs_bmap_btree.h" #include "xfs_inode.h" +#include "xfs_ag.h" #include "xfs_sb.h" #include "xfs_log.h" #include "xfs_trans.h"
fs/xfs/xfs_ag.h +0 -53
59 lines not on this page · raw message
fs/xfs/xfs_mount.h +52 -0
58 lines not on this page · raw message
fs/xfs/xfs_symlink_remote.c +1 -0
@@ -20,6 +20,7 @@#include "xfs_fs.h" #include "xfs_log.h" #include "xfs_trans.h" +#include "xfs_ag.h" #include "xfs_sb.h" #include "xfs_mount.h" #include "xfs_bmap_btree.h"
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 50/60 xfs: create xfs_bmap_util.[ch]
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
There is a bunch of code in xfs_bmap.c that is kernel specific and not shared with userspace. to minimise the difference between the kernel and userspace code, shift this unshared code to xfs_bmap_util.c, and the declarations to xfs_bmap_util.h.
The biggest issue here is xfs_bmap_finish() - userspce has it's own definition of this function, and so we need to move it out of xfs_bmap.[ch]. This means several other files need to include xfs_bmap_util.c as well.
It also introduces and interesting dance for the stack switching code in xfs_bmapi_allocate(). The stack switching/workqueue code is actually moved to xfs_bmap_util.c, so that userspace can simply use a #define in a header file to connect the dots without needing to know about the stack switch code at all.
--- fs/xfs/Makefile | 1 + fs/xfs/xfs_aops.c | 1 + fs/xfs/xfs_attr.c | 1 + fs/xfs/xfs_attr_remote.c | 1 + fs/xfs/xfs_bmap.c | 448 +------------------------------------------ fs/xfs/xfs_bmap.h | 50 ----- fs/xfs/xfs_bmap_util.c | 478 ++++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_bmap_util.h | 89 +++++++++ fs/xfs/xfs_dquot.c | 1 + fs/xfs/xfs_extent_ops.c | 1 + fs/xfs/xfs_filestream.c | 5 +- fs/xfs/xfs_inode_ops.c | 1 + fs/xfs/xfs_iomap.c | 1 + fs/xfs/xfs_rtalloc.c | 1 + fs/xfs/xfs_symlink.c | 1 + fs/xfs/xfs_trans_resv.c | 1 + 16 files changed, 590 insertions(+), 491 deletions(-) create mode 100644 fs/xfs/xfs_bmap_util.c create mode 100644 fs/xfs/xfs_bmap_util.h
fs/xfs/Makefile +1 -0
@@ -30,6 +30,7 @@ xfs-y += xfs_aops.o \ xfs_attr_inactive.o \ xfs_attr_list.o \ xfs_bit.o \ + xfs_bmap_util.o \ xfs_buf.o \ xfs_dir2_readdir.o \ xfs_discard.o \
fs/xfs/xfs_aops.c +1 -0
@@ -30,6 +30,7 @@#include "xfs_iomap.h" #include "xfs_trace.h" #include "xfs_bmap.h" +#include "xfs_bmap_util.h" #include <linux/aio.h> #include <linux/gfp.h> #include <linux/mpage.h>
fs/xfs/xfs_attr.c +1 -0
@@ -33,6 +33,7 @@#include "xfs_alloc.h" #include "xfs_inode_item.h" #include "xfs_bmap.h" +#include "xfs_bmap_util.h" #include "xfs_attr.h" #include "xfs_attr_leaf.h" #include "xfs_attr_remote.h"
fs/xfs/xfs_attr_remote.c +1 -0
@@ -34,6 +34,7 @@#include "xfs_alloc.h" #include "xfs_inode_item.h" #include "xfs_bmap.h" +#include "xfs_bmap_util.h" #include "xfs_attr.h" #include "xfs_attr_leaf.h" #include "xfs_attr_remote.h"
fs/xfs/xfs_bmap.c +9 -439
533 lines not on this page · raw message
fs/xfs/xfs_bmap.h +0 -50
60 lines not on this page · raw message
fs/xfs/xfs_bmap_util.c new file +478 -0
478 lines not on this page · raw message
fs/xfs/xfs_bmap_util.h new file +89 -0
89 lines not on this page · raw message
fs/xfs/xfs_dquot.c +1 -0
@@ -28,6 +28,7 @@#include "xfs_bmap_btree.h" #include "xfs_inode.h" #include "xfs_bmap.h" +#include "xfs_bmap_util.h" #include "xfs_rtalloc.h" #include "xfs_error.h" #include "xfs_itable.h"
fs/xfs/xfs_extent_ops.c +1 -0
@@ -38,6 +38,7 @@#include "xfs_ialloc.h" #include "xfs_alloc.h" #include "xfs_bmap.h" +#include "xfs_bmap_util.h" #include "xfs_acl.h" #include "xfs_attr.h" #include "xfs_error.h"
fs/xfs/xfs_filestream.c +3 -2
@@ -26,6 +26,7 @@#include "xfs_sb.h" #include "xfs_mount.h" #include "xfs_bmap.h" +#include "xfs_bmap_util.h" #include "xfs_alloc.h" #include "xfs_mru_cache.h" #include "xfs_filestream.h"
@@ -667,8 +668,8 @@ exit:*/ int xfs_filestream_new_ag ( -xfs_bmalloca_t *ap, -xfs_agnumber_t *agp) +struct xfs_bmalloca *ap, +xfs_agnumber_t *agp) {int flags, err;xfs_inode_t *ip, *pip =NULL ;
fs/xfs/xfs_inode_ops.c +1 -0
@@ -44,6 +44,7 @@#include "xfs_alloc.h" #include "xfs_ialloc.h" #include "xfs_bmap.h" +#include "xfs_bmap_util.h" #include "xfs_error.h" #include "xfs_quota.h" #include "xfs_filestream.h"
fs/xfs/xfs_iomap.c +1 -0
@@ -32,6 +32,7 @@#include "xfs_inode_item.h" #include "xfs_btree.h" #include "xfs_bmap.h" +#include "xfs_bmap_util.h" #include "xfs_rtalloc.h" #include "xfs_error.h" #include "xfs_itable.h"
fs/xfs/xfs_rtalloc.c +1 -0
@@ -29,6 +29,7 @@#include "xfs_inode.h" #include "xfs_alloc.h" #include "xfs_bmap.h" +#include "xfs_bmap_util.h" #include "xfs_rtalloc.h" #include "xfs_fsops.h" #include "xfs_error.h"
fs/xfs/xfs_symlink.c +1 -0
@@ -34,6 +34,7 @@#include "xfs_ialloc.h" #include "xfs_alloc.h" #include "xfs_bmap.h" +#include "xfs_bmap_util.h" #include "xfs_error.h" #include "xfs_quota.h" #include "xfs_trans_space.h"
fs/xfs/xfs_trans_resv.c +1 -0
@@ -37,6 +37,7 @@#include "xfs_alloc.h" #include "xfs_extent_busy.h" #include "xfs_bmap.h" +#include "xfs_bmap_util.h" #include "xfs_quota.h" #include "xfs_qm.h" #include "xfs_trans_priv.h"
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 51/60 xfs: introduce xfs_quota_defs.h
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
There are a lot of quota flag definitions that are shared by user and kernel space. Move them all to xfs_quota_defs.h so we can unshare xfs_quota.h and remove the __KERNEL__ regions from it.
--- fs/xfs/xfs_quota.h | 120 +-------------------------------------- fs/xfs/xfs_quota_defs.h | 143 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 146 insertions(+), 117 deletions(-) create mode 100644 fs/xfs/xfs_quota_defs.h
fs/xfs/xfs_quota.h +3 -117
@@ -19,127 +19,14 @@#define __XFS_QUOTA_H__#include "xfs_dquot_format.h" - -struct xfs_trans ; - -/* -* Even though users may not have quota limits occupying all 64-bits, -* they may need 64-bit accounting. Hence, 64-bit quota-counters, -* and quota-limits. This is a waste in the common case, but hey ... -*/ -typedef __uint64_t xfs_qcnt_t ; -typedef __uint16_t xfs_qwarncnt_t ; - -/* -* flags for q_flags field in the dquot. -*/ -#define XFS_DQ_USER 0x0001/* a user quota */ -#define XFS_DQ_PROJ 0x0002/* project quota */ -#define XFS_DQ_GROUP 0x0004/* a group quota */ -#define XFS_DQ_DIRTY 0x0008/* dquot is dirty */ -#define XFS_DQ_FREEING 0x0010/* dquot is beeing torn down */ - -#define XFS_DQ_ALLTYPES (XFS_DQ_USER|XFS_DQ_PROJ|XFS_DQ_GROUP) - -#define XFS_DQ_FLAGS \ - { XFS_DQ_USER, "USER" }, \ - { XFS_DQ_PROJ, "PROJ" }, \ - { XFS_DQ_GROUP, "GROUP" }, \ - { XFS_DQ_DIRTY, "DIRTY" }, \ - { XFS_DQ_FREEING, "FREEING" } - -/* -* In the worst case, when both user and group quotas are on, -* we can have a max of three dquots changing in a single transaction. -*/ -#define XFS_DQUOT_LOGRES (mp) (sizeof(xfs_disk_dquot_t) * 3) - -/* -* Quota Accounting/Enforcement flags -*/ - -#define XFS_IS_QUOTA_RUNNING (mp) ((mp)->m_qflags & XFS_ALL_QUOTA_ACCT) -#define XFS_IS_UQUOTA_RUNNING (mp) ((mp)->m_qflags & XFS_UQUOTA_ACCT) -#define XFS_IS_PQUOTA_RUNNING (mp) ((mp)->m_qflags & XFS_PQUOTA_ACCT) -#define XFS_IS_GQUOTA_RUNNING (mp) ((mp)->m_qflags & XFS_GQUOTA_ACCT) -#define XFS_IS_UQUOTA_ENFORCED (mp) ((mp)->m_qflags & XFS_UQUOTA_ENFD) -#define XFS_IS_OQUOTA_ENFORCED (mp) ((mp)->m_qflags & XFS_OQUOTA_ENFD) +#include "xfs_quota_defs.h" /* -* Incore only flags for quotaoff - these bits get cleared when quota(s) -* are in the process of getting turned off. These flags are in m_qflags but -* never in sb_qflags. +* Kernel only quota definitions and functions */ -#define XFS_UQUOTA_ACTIVE 0x0100/* uquotas are being turned off */ -#define XFS_PQUOTA_ACTIVE 0x0200/* pquotas are being turned off */ -#define XFS_GQUOTA_ACTIVE 0x0400/* gquotas are being turned off */ -#define XFS_ALL_QUOTA_ACTIVE \ - (XFS_UQUOTA_ACTIVE | XFS_PQUOTA_ACTIVE | XFS_GQUOTA_ACTIVE) -/* -* Checking XFS_IS_*QUOTA_ON() while holding any inode lock guarantees -* quota will be not be switched off as long as that inode lock is held. -*/ -#define XFS_IS_QUOTA_ON (mp) ((mp)->m_qflags & (XFS_UQUOTA_ACTIVE | \ - XFS_GQUOTA_ACTIVE | \ - XFS_PQUOTA_ACTIVE)) -#define XFS_IS_OQUOTA_ON (mp) ((mp)->m_qflags & (XFS_GQUOTA_ACTIVE | \ - XFS_PQUOTA_ACTIVE)) -#define XFS_IS_UQUOTA_ON (mp) ((mp)->m_qflags & XFS_UQUOTA_ACTIVE) -#define XFS_IS_GQUOTA_ON (mp) ((mp)->m_qflags & XFS_GQUOTA_ACTIVE) -#define XFS_IS_PQUOTA_ON (mp) ((mp)->m_qflags & XFS_PQUOTA_ACTIVE) - -/* -* Flags to tell various functions what to do. Not all of these are meaningful -* to a single function. None of these XFS_QMOPT_* flags are meant to have -* persistent values (ie. their values can and will change between versions) -*/ -#define XFS_QMOPT_DQALLOC 0x0000002/* alloc dquot ondisk if needed */ -#define XFS_QMOPT_UQUOTA 0x0000004/* user dquot requested */ -#define XFS_QMOPT_PQUOTA 0x0000008/* project dquot requested */ -#define XFS_QMOPT_FORCE_RES 0x0000010/* ignore quota limits */ -#define XFS_QMOPT_SBVERSION 0x0000040/* change superblock version num */ -#define XFS_QMOPT_DOWARN 0x0000400/* increase warning cnt if needed */ -#define XFS_QMOPT_DQREPAIR 0x0001000/* repair dquot if damaged */ -#define XFS_QMOPT_GQUOTA 0x0002000/* group dquot requested */ -#define XFS_QMOPT_ENOSPC 0x0004000/* enospc instead of edquot (prj) */ - -/* -* flags to xfs_trans_mod_dquot to indicate which field needs to be -* modified. -*/ -#define XFS_QMOPT_RES_REGBLKS 0x0010000 -#define XFS_QMOPT_RES_RTBLKS 0x0020000 -#define XFS_QMOPT_BCOUNT 0x0040000 -#define XFS_QMOPT_ICOUNT 0x0080000 -#define XFS_QMOPT_RTBCOUNT 0x0100000 -#define XFS_QMOPT_DELBCOUNT 0x0200000 -#define XFS_QMOPT_DELRTBCOUNT 0x0400000 -#define XFS_QMOPT_RES_INOS 0x0800000 - -/* -* flags for dqalloc. -*/ -#define XFS_QMOPT_INHERIT 0x1000000 - -/* -* flags to xfs_trans_mod_dquot. -*/ -#define XFS_TRANS_DQ_RES_BLKS XFS_QMOPT_RES_REGBLKS -#define XFS_TRANS_DQ_RES_RTBLKS XFS_QMOPT_RES_RTBLKS -#define XFS_TRANS_DQ_RES_INOS XFS_QMOPT_RES_INOS -#define XFS_TRANS_DQ_BCOUNT XFS_QMOPT_BCOUNT -#define XFS_TRANS_DQ_DELBCOUNT XFS_QMOPT_DELBCOUNT -#define XFS_TRANS_DQ_ICOUNT XFS_QMOPT_ICOUNT -#define XFS_TRANS_DQ_RTBCOUNT XFS_QMOPT_RTBCOUNT -#define XFS_TRANS_DQ_DELRTBCOUNT XFS_QMOPT_DELRTBCOUNT - - -#define XFS_QMOPT_QUOTALL \ - (XFS_QMOPT_UQUOTA | XFS_QMOPT_PQUOTA | XFS_QMOPT_GQUOTA) -#define XFS_QMOPT_RESBLK_MASK (XFS_QMOPT_RES_REGBLKS | XFS_QMOPT_RES_RTBLKS) +struct xfs_trans ; -#ifdef __KERNEL__/* * This check is done typically without holding the inode lock; * that may seem racy, but it is harmless in the context that it is used.
@@ -281,5 +168,4 @@ extern int xfs_mount_reset_sbqflags(struct xfs_mount *);extern const struct xfs_buf_ops xfs_dquot_buf_ops; -#endif /* __KERNEL__ */ #endif /* __XFS_QUOTA_H__ */
fs/xfs/xfs_quota_defs.h new file +143 -0
143 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 52/60 xfs: introduce xfs_rtalloc_defs.h
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
There are quite a few realtime device definitions shared with userspace. Move them from xfs_rtalloc.h to xfs_rt_alloc_defs.h so we don't need to share xfs_rtalloc.h with userspace anymore.
This removes the final __KERNEL__ region from the XFS kernel codebase. Yay!
--- fs/xfs/xfs_rtalloc.h | 55 +++-------------------------------- fs/xfs/xfs_rtalloc_defs.h | 70 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 51 deletions(-) create mode 100644 fs/xfs/xfs_rtalloc_defs.h
fs/xfs/xfs_rtalloc.h +4 -51
@@ -18,57 +18,12 @@#ifndef __XFS_RTALLOC_H__#define __XFS_RTALLOC_H__ -struct xfs_mount ; -struct xfs_trans ; - -/* Min and max rt extent sizes, specified in bytes */ -#define XFS_MAX_RTEXTSIZE (1024 * 1024 * 1024)/* 1GB */ -#define XFS_DFL_RTEXTSIZE (64 * 1024)/* 64kB */ -#define XFS_MIN_RTEXTSIZE (4 * 1024)/* 4kB */ - -/* -* Constants for bit manipulations. -*/ -#define XFS_NBBYLOG 3/* log2(NBBY) */ -#define XFS_WORDLOG 2/* log2(sizeof(xfs_rtword_t)) */ -#define XFS_NBWORDLOG (XFS_NBBYLOG + XFS_WORDLOG) -#define XFS_NBWORD (1 << XFS_NBWORDLOG) -#define XFS_WORDMASK ((1 << XFS_WORDLOG) - 1) - -#define XFS_BLOCKSIZE (mp) ((mp)->m_sb.sb_blocksize) -#define XFS_BLOCKMASK (mp) ((mp)->m_blockmask) -#define XFS_BLOCKWSIZE (mp) ((mp)->m_blockwsize) -#define XFS_BLOCKWMASK (mp) ((mp)->m_blockwmask) - -/* -* Summary and bit manipulation macros. -*/ -#define XFS_SUMOFFS (mp,ls,bb) ((int)((ls) * (mp)->m_sb.sb_rbmblocks + (bb))) -#define XFS_SUMOFFSTOBLOCK (mp,s) \ - (((s) * (uint)sizeof(xfs_suminfo_t)) >> (mp)->m_sb.sb_blocklog) -#define XFS_SUMPTR (mp,bp,so) \ - ((xfs_suminfo_t *)((bp)->b_addr + \ - (((so) * (uint)sizeof(xfs_suminfo_t)) & XFS_BLOCKMASK(mp)))) - -#define XFS_BITTOBLOCK (mp,bi) ((bi) >> (mp)->m_blkbit_log) -#define XFS_BLOCKTOBIT (mp,bb) ((bb) << (mp)->m_blkbit_log) -#define XFS_BITTOWORD (mp,bi) \ - ((int)(((bi) >> XFS_NBWORDLOG) & XFS_BLOCKWMASK(mp))) - -#define XFS_RTMIN (a,b) ((a) < (b) ? (a) : (b)) -#define XFS_RTMAX (a,b) ((a) > (b) ? (a) : (b)) +#include "xfs_rtalloc_defs.h" -#define XFS_RTLOBIT (w) xfs_lowbit32(w) -#define XFS_RTHIBIT (w) xfs_highbit32(w) - -#if XFS_BIG_BLKNOS -#define XFS_RTBLOCKLOG (b) xfs_highbit64(b) -#else -#define XFS_RTBLOCKLOG (b) xfs_highbit32(b) -#endif +/* kernel only definitions and functions */ - -#ifdef __KERNEL__ +struct xfs_mount ; +struct xfs_trans ;#ifdef CONFIG_XFS_RT /*
@@ -161,6 +116,4 @@ xfs_rtmount_init(# define xfs_rtunmount_inodes (m)#endif /* CONFIG_XFS_RT */ -#endif /* __KERNEL__ */ -#endif /* __XFS_RTALLOC_H__ */
fs/xfs/xfs_rtalloc_defs.h new file +70 -0
70 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 53/60 xfs: Introduce a new structure to hold transaction reservation items
In reply to Dave ChinnerFrom: Jie Liu <[email protected]>
Introduce a new structure xfs_trans_res to hold transaction reservation item info per log ticket.
We also need to improve xfs_trans_resv_calc() by initializing the log count as well as log flags for permanent log reservation.
--- fs/xfs/xfs_mount.h | 2 +- fs/xfs/xfs_trans.c | 2 +- fs/xfs/xfs_trans_resv.c | 121 ++++++++++++++++++++++++++++++++++----------- fs/xfs/xfs_trans_resv.h | 125 ++++++++++++++++++++++++++--------------------- 4 files changed, 163 insertions(+), 87 deletions(-)
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_resv m_reservations;/* precomputed res values */ +struct xfs_trans_resv m_resv;/* 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 -1
@@ -56,7 +56,7 @@ voidxfs_trans_init ( struct xfs_mount *mp) { -xfs_trans_resv_calc (mp, &mp->m_reservations); +xfs_trans_resv_calc (mp, &mp->m_resv); }/*
fs/xfs/xfs_trans_resv.c +93 -28
125 lines not on this page · raw message
fs/xfs/xfs_trans_resv.h +68 -57
142 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 54/60 xfs: Introduce tr_fsyncts to m_reservation
In reply to Dave ChinnerFrom: Jie Liu <[email protected]>
A preparation step.
For now fsync_ts transaction use the pre-calculated log reservation size of tr_swrite.
This patch introduce a new item tr_fsyncts to mp->m_reservations structure so that we can fetch the log reservation value for it in a same manner to others.
--- fs/xfs/xfs_trans_resv.c | 1 + fs/xfs/xfs_trans_resv.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-)
fs/xfs/xfs_trans_resv.c +1 -0
@@ -763,6 +763,7 @@ xfs_trans_resv_calc( resp->tr_ichange.tr_logres =xfs_calc_ichange_reservation (mp); resp->tr_growdata.tr_logres =xfs_calc_growdata_reservation (mp); resp->tr_swrite.tr_logres =xfs_calc_swrite_reservation (mp); + resp->tr_fsyncts.tr_logres =xfs_calc_swrite_reservation (mp); resp->tr_writeid.tr_logres =xfs_calc_writeid_reservation (mp); resp->tr_attrsetrt.tr_logres =xfs_calc_attrsetrt_reservation (mp); resp->tr_clearagi.tr_logres =xfs_calc_clear_agi_bucket_reservation (mp);
fs/xfs/xfs_trans_resv.h +2 -1
@@ -60,6 +60,7 @@ struct xfs_trans_resv {struct xfs_trans_res tr_qm_quotaoff;/* turn quota off */ struct xfs_trans_res tr_qm_equotaoff;/* end of turn quota off */ struct xfs_trans_res tr_sb;/* modify superblock */ +struct xfs_trans_res tr_fsyncts;/* update timestamps on fsync */ };/*
@@ -107,7 +108,7 @@ struct xfs_trans_resv {* Logging the inode timestamps on an fsync -- same as SWRITE * as long as SWRITE logs the entire inode core */ -#define XFS_FSYNC_TS_LOG_RES (mp) ((mp)->m_resv.tr_swrite.tr_logres) +#define XFS_FSYNC_TS_LOG_RES (mp) ((mp)->m_resv.tr_fsyncts.tr_logres)#define XFS_WRITEID_LOG_RES (mp) ((mp)->m_resv.tr_swrite.tr_logres)#define XFS_ADDAFORK_LOG_RES (mp) ((mp)->m_resv.tr_addafork.tr_logres)#define XFS_ATTRSETM_LOG_RES (mp) ((mp)->m_resv.tr_attrsetm.tr_logres)
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 55/60 xfs: Make writeid transaction use tr_writeid
In reply to Dave ChinnerFrom: Jie Liu <[email protected]>
tr_writeid is defined at mp->m_resv structure, however, it does not really being used when it should be..
This patch changes it to tr_writeid to fetch the correct log reservation size.
--- fs/xfs/xfs_trans_resv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_trans_resv.h +1 -1
@@ -109,7 +109,7 @@ struct xfs_trans_resv {* as long as SWRITE logs the entire inode core */ #define XFS_FSYNC_TS_LOG_RES (mp) ((mp)->m_resv.tr_fsyncts.tr_logres) -#define XFS_WRITEID_LOG_RES (mp) ((mp)->m_resv.tr_swrite.tr_logres) +#define XFS_WRITEID_LOG_RES (mp) ((mp)->m_resv.tr_writeid.tr_logres)#define XFS_ADDAFORK_LOG_RES (mp) ((mp)->m_resv.tr_addafork.tr_logres)#define XFS_ATTRSETM_LOG_RES (mp) ((mp)->m_resv.tr_attrsetm.tr_logres)#define XFS_ATTRINVAL_LOG_RES (mp) ((mp)->m_resv.tr_attrinval.tr_logres)
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 56/60 xfs: refactor xfs_trans_reserve() interface
In reply to Dave ChinnerFrom: Jie Liu <[email protected]>
With the new xfs_trans_res structure has been introduced, the log reservation size, log count as well as log flags are pre-initialized at mount time. So it's time to refine xfs_trans_reserve() interface to be more neat.
Also, introduce a new helper M_RES() to return a pointer to the mp->m_resv structure to simplify the input.
--- fs/xfs/xfs_aops.c | 2 +- fs/xfs/xfs_attr.c | 33 ++++++++-------- fs/xfs/xfs_attr_inactive.c | 5 +-- fs/xfs/xfs_bmap.c | 4 +- fs/xfs/xfs_bmap_util.c | 13 ++++--- fs/xfs/xfs_dquot.c | 6 +-- fs/xfs/xfs_extent_ops.c | 24 ++++-------- fs/xfs/xfs_fsops.c | 8 ++-- fs/xfs/xfs_inode_ops.c | 93 ++++++++++++++++++-------------------------- fs/xfs/xfs_ioctl.c | 4 +- fs/xfs/xfs_iomap.c | 18 +++------ fs/xfs/xfs_iops.c | 8 ++-- fs/xfs/xfs_log_recover.c | 5 +-- fs/xfs/xfs_mount.c | 9 ++--- fs/xfs/xfs_qm.c | 11 ++---- fs/xfs/xfs_qm_syscalls.c | 13 ++----- fs/xfs/xfs_rtalloc.c | 17 ++++---- fs/xfs/xfs_symlink.c | 10 ++--- fs/xfs/xfs_trans.c | 51 ++++++++++++------------ fs/xfs/xfs_trans.h | 3 +- fs/xfs/xfs_trans_resv.c | 7 ++-- fs/xfs/xfs_trans_resv.h | 3 ++ 22 files changed, 150 insertions(+), 197 deletions(-)
fs/xfs/xfs_aops.c +1 -1
@@ -116,7 +116,7 @@ xfs_setfilesize_trans_alloc( tp =xfs_trans_alloc (mp,XFS_TRANS_FSYNC_TS ); - error =xfs_trans_reserve (tp,0 ,XFS_FSYNC_TS_LOG_RES (mp),0 ,0 ,0 ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_fsyncts,0 ,0 );if (error) {xfs_trans_cancel (tp,0 );return error;
fs/xfs/xfs_attr.c +16 -17
@@ -226,13 +226,14 @@ xfs_attr_set_int( int valuelen, int flags) { -xfs_da_args_t args; -xfs_fsblock_t firstblock; -xfs_bmap_free_t flist; -int error, err2, committed; -xfs_mount_t *mp = dp->i_mount; -int rsvd = (flags &ATTR_ROOT ) !=0 ; -int local; +xfs_da_args_t args; +xfs_fsblock_t firstblock; +xfs_bmap_free_t flist; +int error, err2, committed; +struct xfs_mount *mp = dp->i_mount; +struct xfs_trans_res tres; +int rsvd = (flags &ATTR_ROOT ) !=0 ; +int local;/* * Attach the dquots to the inode.
@@ -292,11 +293,11 @@ xfs_attr_set_int(if (rsvd) args.trans->t_flags |=XFS_TRANS_RESERVE ; - error =xfs_trans_reserve (args.trans, args.total, -XFS_ATTRSETM_LOG_RES (mp) + -XFS_ATTRSETRT_LOG_RES (mp) * args.total, -0 ,XFS_TRANS_PERM_LOG_RES , -XFS_ATTRSET_LOG_COUNT ); + tres.tr_logres =M_RES (mp)->tr_attrsetm.tr_logres + +M_RES (mp)->tr_attrsetrt.tr_logres * args.total; + tres.tr_logcount =XFS_ATTRSET_LOG_COUNT ; + tres.tr_logflags =XFS_TRANS_PERM_LOG_RES ; + error =xfs_trans_reserve (args.trans, &tres, args.total,0 );if (error) {xfs_trans_cancel (args.trans,0 );return (error);
@@ -516,11 +517,9 @@ xfs_attr_remove_int(xfs_inode_t *dp, struct xfs_name *name, int flags)if (flags &ATTR_ROOT ) args.trans->t_flags |=XFS_TRANS_RESERVE ; -if ((error =xfs_trans_reserve (args.trans, -XFS_ATTRRM_SPACE_RES (mp), -XFS_ATTRRM_LOG_RES (mp), -0 ,XFS_TRANS_PERM_LOG_RES , -XFS_ATTRRM_LOG_COUNT ))) { + error =xfs_trans_reserve (args.trans, &M_RES (mp)->tr_attrrm, +XFS_ATTRRM_SPACE_RES (mp),0 ); +if (error) {xfs_trans_cancel (args.trans,0 );return (error); }
fs/xfs/xfs_attr_inactive.c +2 -3
@@ -412,9 +412,8 @@ xfs_attr_inactive(xfs_inode_t *dp)* the log. */ trans =xfs_trans_alloc (mp,XFS_TRANS_ATTRINVAL ); -if ((error =xfs_trans_reserve (trans,0 ,XFS_ATTRINVAL_LOG_RES (mp),0 , -XFS_TRANS_PERM_LOG_RES , -XFS_ATTRINVAL_LOG_COUNT ))) { + error =xfs_trans_reserve (trans, &M_RES (mp)->tr_attrinval,0 ,0 ); +if (error) {xfs_trans_cancel (trans,0 );return (error); }
fs/xfs/xfs_bmap.c +2 -2
@@ -1148,8 +1148,8 @@ xfs_bmap_add_attrfork( blks =XFS_ADDAFORK_SPACE_RES (mp);if (rsvd) tp->t_flags |=XFS_TRANS_RESERVE ; -if ((error =xfs_trans_reserve (tp, blks,XFS_ADDAFORK_LOG_RES (mp),0 , -XFS_TRANS_PERM_LOG_RES ,XFS_ADDAFORK_LOG_COUNT ))) + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_addafork, blks,0 ); +if (error) goto error0;xfs_ilock (ip,XFS_ILOCK_EXCL ); error = xfs_trans_reserve_quota_nblks(tp, ip, blks, 0, rsvd ?
fs/xfs/xfs_bmap_util.c +7 -6
@@ -76,8 +76,7 @@ xfs_bmap_finish(xfs_efi_log_item_t *efi;/* extent free intention */ int error;/* error return value */ xfs_bmap_free_item_t *free;/* free extent item */ -unsigned int logres;/* new log reservation */ -unsigned int logcount;/* new log count */ +struct xfs_trans_res tres;/* new log reservation */ xfs_mount_t *mp;/* filesystem mount structure */ xfs_bmap_free_item_t *next;/* next item on free list */ xfs_trans_t *ntp;/* new transaction pointer */
@@ -92,8 +91,10 @@ xfs_bmap_finish(for (free = flist->xbf_first; free; free = free->xbfi_next)xfs_trans_log_efi_extent (ntp, efi, free->xbfi_startblock, free->xbfi_blockcount); - logres = ntp->t_log_res; - logcount = ntp->t_log_count; + + tres.tr_logres = ntp->t_log_res; + tres.tr_logcount = ntp->t_log_count; + tres.tr_logflags =XFS_TRANS_PERM_LOG_RES ; ntp =xfs_trans_dup (*tp); error =xfs_trans_commit (*tp,0 ); *tp = ntp;
@@ -111,8 +112,8 @@ xfs_bmap_finish(*/ xfs_log_ticket_put (ntp->t_ticket); -if ((error =xfs_trans_reserve (ntp,0 , logres,0 ,XFS_TRANS_PERM_LOG_RES , - logcount))) + error =xfs_trans_reserve (ntp, &tres,0 ,0 ); +if (error)return error; efd =xfs_trans_get_efd (ntp, efi, flist->xbf_count);for (free = flist->xbf_first; free !=NULL ; free = next) {
fs/xfs/xfs_dquot.c +2 -4
@@ -711,10 +711,8 @@ xfs_qm_dqread(if (flags &XFS_QMOPT_DQALLOC ) { tp =xfs_trans_alloc (mp,XFS_TRANS_QM_DQALLOC ); - error =xfs_trans_reserve (tp,XFS_QM_DQALLOC_SPACE_RES (mp), -XFS_QM_DQALLOC_LOG_RES (mp),0 , -XFS_TRANS_PERM_LOG_RES , -XFS_WRITE_LOG_COUNT ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_attrsetm, +XFS_QM_DQALLOC_SPACE_RES (mp),0 );if (error) goto error1; cancelflags =XFS_TRANS_RELEASE_LOG_RES ;
fs/xfs/xfs_extent_ops.c +7 -17
@@ -163,10 +163,8 @@ xfs_alloc_file_space(* Allocate and setup the transaction. */ tp =xfs_trans_alloc (mp,XFS_TRANS_DIOSTRAT ); - error =xfs_trans_reserve (tp, resblks, -XFS_WRITE_LOG_RES (mp), resrtextents, -XFS_TRANS_PERM_LOG_RES , -XFS_WRITE_LOG_COUNT ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_write, + resblks, resrtextents);/* * Check for running out of space */
@@ -456,12 +454,7 @@ xfs_free_file_space(*/ tp =xfs_trans_alloc (mp,XFS_TRANS_DIOSTRAT ); tp->t_flags |=XFS_TRANS_RESERVE ; - error =xfs_trans_reserve (tp, - resblks, -XFS_WRITE_LOG_RES (mp), -0 , -XFS_TRANS_PERM_LOG_RES , -XFS_WRITE_LOG_COUNT ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_write, resblks,0 );/* * check for running out of space
@@ -735,10 +728,8 @@ xfs_change_file_space(* update the inode timestamp, mode, and prealloc flag bits */ tp =xfs_trans_alloc (mp,XFS_TRANS_WRITEID ); - -if ((error =xfs_trans_reserve (tp,0 ,XFS_WRITEID_LOG_RES (mp), -0 ,0 ,0 ))) { -/* ASSERT(0); */ + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_writeid,0 ,0 ); +if (error) {xfs_trans_cancel (tp,0 );return error; }
@@ -1265,9 +1256,8 @@ xfs_swap_extents(truncate_pagecache_range (VFS_I (ip),0 ,-1 ); tp =xfs_trans_alloc (mp,XFS_TRANS_SWAPEXT ); -if ((error =xfs_trans_reserve (tp,0 , -XFS_ICHANGE_LOG_RES (mp),0 , -0 ,0 ))) { + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_ichange,0 ,0 ); +if (error) {xfs_iunlock (ip,XFS_IOLOCK_EXCL );xfs_iunlock (tip,XFS_IOLOCK_EXCL );xfs_trans_cancel (tp,0 );
fs/xfs/xfs_fsops.c +4 -4
@@ -203,8 +203,9 @@ xfs_growfs_data_private( tp =xfs_trans_alloc (mp,XFS_TRANS_GROWFS ); tp->t_flags |=XFS_TRANS_RESERVE ; -if ((error =xfs_trans_reserve (tp,XFS_GROWFS_SPACE_RES (mp), -XFS_GROWDATA_LOG_RES (mp),0 ,0 ,0 ))) { + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_growdata, +XFS_GROWFS_SPACE_RES (mp),0 ); +if (error) {xfs_trans_cancel (tp,0 );return error; }
@@ -739,8 +740,7 @@ xfs_fs_log_dummy(int error; tp =_xfs_trans_alloc (mp,XFS_TRANS_DUMMY1 ,KM_SLEEP ); - error =xfs_trans_reserve (tp,0 ,XFS_SB_LOG_RES (mp),0 ,0 , -XFS_DEFAULT_LOG_COUNT ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_sb,0 ,0 );if (error) {xfs_trans_cancel (tp,0 );return error;
fs/xfs/xfs_inode_ops.c +37 -56
200 lines not on this page · raw message
fs/xfs/xfs_ioctl.c +2 -2
@@ -366,7 +366,7 @@ xfs_set_dmattrs(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 ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_ichange,0 ,0 );if (error) {xfs_trans_cancel (tp,0 );return error;
@@ -1000,7 +1000,7 @@ xfs_ioctl_setattr(* first do an error checking pass. */ tp =xfs_trans_alloc (mp,XFS_TRANS_SETATTR_NOT_SIZE ); - code =xfs_trans_reserve (tp,0 ,XFS_ICHANGE_LOG_RES (mp),0 ,0 ,0 ); + code =xfs_trans_reserve (tp, &M_RES (mp)->tr_ichange,0 ,0 );if (code) goto error_return;
fs/xfs/xfs_iomap.c +6 -12
@@ -187,10 +187,8 @@ xfs_iomap_write_direct(* Allocate and setup the transaction */ tp =xfs_trans_alloc (mp,XFS_TRANS_DIOSTRAT ); - error =xfs_trans_reserve (tp, resblks, -XFS_WRITE_LOG_RES (mp), resrtextents, -XFS_TRANS_PERM_LOG_RES , -XFS_WRITE_LOG_COUNT ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_write, + resblks, resrtextents);/* * Check for running out of space, note: need lock to return */
@@ -698,10 +696,8 @@ xfs_iomap_write_allocate( tp =xfs_trans_alloc (mp,XFS_TRANS_STRAT_WRITE ); tp->t_flags |=XFS_TRANS_RESERVE ; nres =XFS_EXTENTADD_SPACE_RES (mp,XFS_DATA_FORK ); - error =xfs_trans_reserve (tp, nres, -XFS_WRITE_LOG_RES (mp), -0 ,XFS_TRANS_PERM_LOG_RES , -XFS_WRITE_LOG_COUNT ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_write, + nres,0 );if (error) {xfs_trans_cancel (tp,0 );return XFS_ERROR (error);
@@ -864,10 +860,8 @@ xfs_iomap_write_unwritten(sb_start_intwrite (mp->m_super); tp =_xfs_trans_alloc (mp,XFS_TRANS_STRAT_WRITE ,KM_NOFS ); tp->t_flags |=XFS_TRANS_RESERVE |XFS_TRANS_FREEZE_PROT ; - error =xfs_trans_reserve (tp, resblks, -XFS_WRITE_LOG_RES (mp),0 , -XFS_TRANS_PERM_LOG_RES , -XFS_WRITE_LOG_COUNT ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_write, + resblks,0 );if (error) {xfs_trans_cancel (tp,0 );return XFS_ERROR (error);
fs/xfs/xfs_iops.c +3 -5
@@ -545,7 +545,7 @@ xfs_setattr_nonsize( } tp =xfs_trans_alloc (mp,XFS_TRANS_SETATTR_NOT_SIZE ); - error =xfs_trans_reserve (tp,0 ,XFS_ICHANGE_LOG_RES (mp),0 ,0 ,0 ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_ichange,0 ,0 );if (error) goto out_dqrele;
@@ -807,9 +807,7 @@ xfs_setattr_size( goto out_unlock; tp =xfs_trans_alloc (mp,XFS_TRANS_SETATTR_SIZE ); - error =xfs_trans_reserve (tp,0 ,XFS_ITRUNCATE_LOG_RES (mp),0 , -XFS_TRANS_PERM_LOG_RES , -XFS_ITRUNCATE_LOG_COUNT ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_itruncate,0 ,0 );if (error) goto out_trans_cancel;
@@ -932,7 +930,7 @@ xfs_vn_update_time(trace_xfs_update_time (ip); tp =xfs_trans_alloc (mp,XFS_TRANS_FSYNC_TS ); - error =xfs_trans_reserve (tp,0 ,XFS_FSYNC_TS_LOG_RES (mp),0 ,0 ,0 ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_fsyncts,0 ,0 );if (error) {xfs_trans_cancel (tp,0 );return -error;
fs/xfs/xfs_log_recover.c +2 -3
@@ -3368,7 +3368,7 @@ xlog_recover_process_efi( } tp =xfs_trans_alloc (mp,0 ); - error =xfs_trans_reserve (tp,0 ,XFS_ITRUNCATE_LOG_RES (mp),0 ,0 ,0 ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_itruncate,0 ,0 );if (error) goto abort_error; efdp =xfs_trans_get_efd (tp, efip, efip->efi_format.efi_nextents);
@@ -3474,8 +3474,7 @@ xlog_recover_clear_agi_bucket(int error; tp =xfs_trans_alloc (mp,XFS_TRANS_CLEAR_AGI_BUCKET ); - error =xfs_trans_reserve (tp,0 ,XFS_CLEAR_AGI_BUCKET_LOG_RES (mp), -0 ,0 ,0 ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_clearagi,0 ,0 );if (error) goto out_abort;
fs/xfs/xfs_mount.c +3 -6
@@ -607,8 +607,7 @@ xfs_mount_reset_sbqflags(return 0 ; tp =xfs_trans_alloc (mp,XFS_TRANS_QM_SBCHANGE ); - error =xfs_trans_reserve (tp,0 ,XFS_QM_SBCHANGE_LOG_RES (mp), -0 ,0 ,XFS_DEFAULT_LOG_COUNT ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_qm_sbchange,0 ,0 );if (error) {xfs_trans_cancel (tp,0 );xfs_alert (mp,"%s: Superblock update failed!" , __func__);
@@ -1081,8 +1080,7 @@ xfs_log_sbcount(xfs_mount_t *mp)return 0 ; tp =_xfs_trans_alloc (mp,XFS_TRANS_SB_COUNT ,KM_SLEEP ); - error =xfs_trans_reserve (tp,0 ,XFS_SB_LOG_RES (mp),0 ,0 , -XFS_DEFAULT_LOG_COUNT ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_sb,0 ,0 );if (error) {xfs_trans_cancel (tp,0 );return error;
@@ -1402,8 +1400,7 @@ xfs_mount_log_sb( XFS_SB_VERSIONNUM)); tp =xfs_trans_alloc (mp,XFS_TRANS_SB_UNIT ); - error =xfs_trans_reserve (tp,0 ,XFS_SB_LOG_RES (mp),0 ,0 , -XFS_DEFAULT_LOG_COUNT ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_sb,0 ,0 );if (error) {xfs_trans_cancel (tp,0 );return error;
fs/xfs/xfs_qm.c +4 -7
@@ -781,11 +781,9 @@ xfs_qm_qino_alloc(int committed; tp =xfs_trans_alloc (mp,XFS_TRANS_QM_QINOCREATE ); -if ((error =xfs_trans_reserve (tp, -XFS_QM_QINOCREATE_SPACE_RES (mp), -XFS_CREATE_LOG_RES (mp),0 , -XFS_TRANS_PERM_LOG_RES , -XFS_CREATE_LOG_COUNT ))) { + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_create, +XFS_QM_QINOCREATE_SPACE_RES (mp),0 ); +if (error) {xfs_trans_cancel (tp,0 );return error; }
@@ -1620,8 +1618,7 @@ xfs_qm_write_sb_changes(int error; tp =xfs_trans_alloc (mp,XFS_TRANS_QM_SBCHANGE ); - error =xfs_trans_reserve (tp,0 ,XFS_QM_SBCHANGE_LOG_RES (mp), -0 ,0 ,XFS_DEFAULT_LOG_COUNT ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_qm_sbchange,0 ,0 );if (error) {xfs_trans_cancel (tp,0 );return error;
fs/xfs/xfs_qm_syscalls.c +4 -9
@@ -242,9 +242,7 @@ xfs_qm_scall_trunc_qfile(xfs_ilock (ip,XFS_IOLOCK_EXCL ); tp =xfs_trans_alloc (mp,XFS_TRANS_TRUNCATE_FILE ); - error =xfs_trans_reserve (tp,0 ,XFS_ITRUNCATE_LOG_RES (mp),0 , -XFS_TRANS_PERM_LOG_RES , -XFS_ITRUNCATE_LOG_COUNT ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_itruncate,0 ,0 );if (error) {xfs_trans_cancel (tp,0 );xfs_iunlock (ip,XFS_IOLOCK_EXCL );
@@ -510,8 +508,7 @@ xfs_qm_scall_setqlim(xfs_dqunlock (dqp); tp =xfs_trans_alloc (mp,XFS_TRANS_QM_SETQLIM ); - error =xfs_trans_reserve (tp,0 ,XFS_QM_SETQLIM_LOG_RES (mp), -0 ,0 ,XFS_DEFAULT_LOG_COUNT ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_qm_setqlim,0 ,0 );if (error) {xfs_trans_cancel (tp,0 ); goto out_rele;
@@ -645,8 +642,7 @@ xfs_qm_log_quotaoff_end( tp =xfs_trans_alloc (mp,XFS_TRANS_QM_QUOTAOFF_END ); - error =xfs_trans_reserve (tp,0 ,XFS_QM_QUOTAOFF_END_LOG_RES (mp), -0 ,0 ,XFS_DEFAULT_LOG_COUNT ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_qm_equotaoff,0 ,0 );if (error) {xfs_trans_cancel (tp,0 );return (error);
@@ -679,8 +675,7 @@ xfs_qm_log_quotaoff(uint oldsbqflag=0 ; tp =xfs_trans_alloc (mp,XFS_TRANS_QM_QUOTAOFF ); - error =xfs_trans_reserve (tp,0 ,XFS_QM_QUOTAOFF_LOG_RES (mp), -0 ,0 ,XFS_DEFAULT_LOG_COUNT ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_qm_quotaoff,0 ,0 );if (error) goto error0;
fs/xfs/xfs_rtalloc.c +9 -8
@@ -100,10 +100,9 @@ xfs_growfs_rt_alloc(/* * Reserve space & log for one extent added to the file. */ -if ((error =xfs_trans_reserve (tp, resblks, -XFS_GROWRTALLOC_LOG_RES (mp),0 , -XFS_TRANS_PERM_LOG_RES , -XFS_DEFAULT_PERM_LOG_COUNT ))) + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_growdata, + resblks,0 ); +if (error) goto error_cancel; cancelflags =XFS_TRANS_RELEASE_LOG_RES ;/*
@@ -146,8 +145,9 @@ xfs_growfs_rt_alloc(/* * Reserve log for one block zeroing. */ -if ((error =xfs_trans_reserve (tp,0 , -XFS_GROWRTZERO_LOG_RES (mp),0 ,0 ,0 ))) + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_growrtzero, +0 ,0 ); +if (error) goto error_cancel;/* * Lock the bitmap inode.
@@ -1957,8 +1957,9 @@ xfs_growfs_rt(* Start a transaction, get the log reservation. */ tp =xfs_trans_alloc (mp,XFS_TRANS_GROWFSRT_FREE ); -if ((error =xfs_trans_reserve (tp,0 , -XFS_GROWRTFREE_LOG_RES (nmp),0 ,0 ,0 ))) + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_growrtfree, +0 ,0 ); +if (error) goto error_cancel;/* * Lock out other callers by grabbing the bitmap inode lock.
fs/xfs/xfs_symlink.c +4 -6
@@ -229,12 +229,10 @@ xfs_symlink(else fs_blocks =xfs_symlink_blocks (mp, pathlen); resblks =XFS_SYMLINK_SPACE_RES (mp, link_name->len, fs_blocks); - error =xfs_trans_reserve (tp, resblks,XFS_SYMLINK_LOG_RES (mp),0 , -XFS_TRANS_PERM_LOG_RES ,XFS_SYMLINK_LOG_COUNT ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_symlink, resblks,0 );if (error ==ENOSPC && fs_blocks ==0 ) { resblks =0 ; - error =xfs_trans_reserve (tp,0 ,XFS_SYMLINK_LOG_RES (mp),0 , -XFS_TRANS_PERM_LOG_RES ,XFS_SYMLINK_LOG_COUNT ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_symlink,0 ,0 ); }if (error) { cancel_flags =0 ;
@@ -534,8 +532,8 @@ xfs_inactive_symlink_rmt(* Put an itruncate log reservation in the new transaction * for our caller. */ -if ((error =xfs_trans_reserve (tp,0 ,XFS_ITRUNCATE_LOG_RES (mp),0 , -XFS_TRANS_PERM_LOG_RES ,XFS_ITRUNCATE_LOG_COUNT ))) { + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_itruncate,0 ,0 ); +if (error) {ASSERT (XFS_FORCED_SHUTDOWN (mp)); goto error0; }
fs/xfs/xfs_trans.c +26 -25
111 lines not on this page · raw message
fs/xfs/xfs_trans.h +2 -1
@@ -33,6 +33,7 @@ struct xfs_log_iovec;struct xfs_log_item_desc ;struct xfs_mount ;struct xfs_trans ; +struct xfs_trans_res ;struct xfs_dquot_acct ;struct xfs_busy_extent ;
@@ -169,7 +170,7 @@ typedef struct xfs_trans {xfs_trans_t *xfs_trans_alloc (struct xfs_mount *,uint );xfs_trans_t *_xfs_trans_alloc (struct xfs_mount *,uint ,xfs_km_flags_t );xfs_trans_t *xfs_trans_dup (xfs_trans_t *); -int xfs_trans_reserve (xfs_trans_t *,uint ,uint ,uint , +int xfs_trans_reserve (struct xfs_trans *,struct xfs_trans_res *,uint ,uint );void xfs_trans_mod_sb (xfs_trans_t *,uint ,int64_t );
fs/xfs/xfs_trans_resv.c +4 -3
@@ -551,7 +551,8 @@ xfs_calc_attrsetm_reservation(* Since the runtime attribute transaction space is dependent on the total * blocks needed for the 1st bmap, here we calculate out the space unit for * one block so that the caller could figure out the total space according -* to the attibute extent length in blocks by: ext * XFS_ATTRSETRT_LOG_RES(mp). +* to the attibute extent length in blocks by: +* ext * M_RES(mp)->tr_attrsetrt.tr_logres */ STATIC uint xfs_calc_attrsetrt_reservation(
@@ -623,14 +624,14 @@ xfs_calc_qm_setqlim_reservation(/* * Allocating quota on disk if needed. -* the write transaction log space: XFS_WRITE_LOG_RES(mp) +* the write transaction log space: M_RES(mp)->tr_write.tr_logres * the unit of quota allocation: one system block size */ STATIC uintxfs_calc_qm_dqalloc_reservation (struct xfs_mount *mp) { -return XFS_WRITE_LOG_RES (mp) + +return M_RES (mp)->tr_write.tr_logres +xfs_calc_buf_res (1 ,XFS_FSB_TO_B (mp,XFS_DQUOT_CLUSTER_SIZE_FSB ) -1 ); }
fs/xfs/xfs_trans_resv.h +3 -0
@@ -63,6 +63,9 @@ struct xfs_trans_resv {struct xfs_trans_res tr_fsyncts;/* update timestamps on fsync */ }; +/* shorthand way of accessing reservation structure */ +#define M_RES (mp) (&(mp)->m_resv) +/* * Per-extent log reservation for the allocation btree changes * involved in freeing or allocating an extent.
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 57/60 xfs: Get rid of all XFS_XXX_LOG_RES() macro
In reply to Dave ChinnerFrom: Jie Liu <[email protected]>
Get rid of all XFS_XXX_LOG_RES() macros since they are obsoleted now.
--- fs/xfs/xfs_trans_resv.h | 36 ------------------------------------ 1 file changed, 36 deletions(-)
fs/xfs/xfs_trans_resv.h +0 -36
@@ -90,42 +90,6 @@ struct xfs_trans_resv { (XFS_DAENTER_BLOCKS (mp,XFS_DATA_FORK ) + \XFS_DAENTER_BMAPS (mp,XFS_DATA_FORK ) +1 ) - -#define XFS_WRITE_LOG_RES (mp) ((mp)->m_resv.tr_write.tr_logres) -#define XFS_RENAME_LOG_RES (mp) ((mp)->m_resv.tr_rename.tr_logres) -#define XFS_LINK_LOG_RES (mp) ((mp)->m_resv.tr_link.tr_logres) -#define XFS_REMOVE_LOG_RES (mp) ((mp)->m_resv.tr_remove.tr_logres) -#define XFS_SYMLINK_LOG_RES (mp) ((mp)->m_resv.tr_symlink.tr_logres) -#define XFS_CREATE_LOG_RES (mp) ((mp)->m_resv.tr_create.tr_logres) -#define XFS_MKDIR_LOG_RES (mp) ((mp)->m_resv.tr_mkdir.tr_logres) -#define XFS_IFREE_LOG_RES (mp) ((mp)->m_resv.tr_ifree.tr_logres) -#define XFS_SWRITE_LOG_RES (mp) ((mp)->m_resv.tr_swrite.tr_logres) -#define XFS_ICHANGE_LOG_RES (mp) ((mp)->m_resv.tr_ichange.tr_logres) -#define XFS_GROWDATA_LOG_RES (mp) ((mp)->m_resv.tr_growdata.tr_logres) -#define XFS_ITRUNCATE_LOG_RES (mp) ((mp)->m_resv.tr_itruncate.tr_logres) -#define XFS_GROWRTZERO_LOG_RES (mp) ((mp)->m_resv.tr_growrtzero.tr_logres) -#define XFS_GROWRTFREE_LOG_RES (mp) ((mp)->m_resv.tr_growrtfree.tr_logres) -#define XFS_GROWRTALLOC_LOG_RES (mp) ((mp)->m_resv.tr_growrtalloc.tr_logres) - -/* -* Logging the inode timestamps on an fsync -- same as SWRITE -* as long as SWRITE logs the entire inode core -*/ -#define XFS_FSYNC_TS_LOG_RES (mp) ((mp)->m_resv.tr_fsyncts.tr_logres) -#define XFS_WRITEID_LOG_RES (mp) ((mp)->m_resv.tr_writeid.tr_logres) -#define XFS_ADDAFORK_LOG_RES (mp) ((mp)->m_resv.tr_addafork.tr_logres) -#define XFS_ATTRSETM_LOG_RES (mp) ((mp)->m_resv.tr_attrsetm.tr_logres) -#define XFS_ATTRINVAL_LOG_RES (mp) ((mp)->m_resv.tr_attrinval.tr_logres) -#define XFS_ATTRSETRT_LOG_RES (mp) ((mp)->m_resv.tr_attrsetrt.tr_logres) -#define XFS_ATTRRM_LOG_RES (mp) ((mp)->m_resv.tr_attrrm.tr_logres) -#define XFS_SB_LOG_RES (mp) ((mp)->m_resv.tr_sb.tr_logres) -#define XFS_QM_SETQLIM_LOG_RES (mp) ((mp)->m_resv.tr_qm_setqlim.tr_logres) -#define XFS_QM_DQALLOC_LOG_RES (mp) ((mp)->m_resv.tr_qm_dqalloc.tr_logres) -#define XFS_QM_SBCHANGE_LOG_RES (mp) ((mp)->m_resv.tr_qm_sbchange.tr_logres) -#define XFS_QM_QUOTAOFF_LOG_RES (mp) ((mp)->m_resv.tr_qm_quotaoff.tr_logres) -#define XFS_QM_QUOTAOFF_END_LOG_RES (mp) ((mp)->m_resv.tr_qm_equotaoff.tr_logres) -#define XFS_CLEAR_AGI_BUCKET_LOG_RES (mp) ((mp)->m_resv.tr_clearagi.tr_logres) -/* * Various log count values. */
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 58/60 xfs: Refactor xfs_ticket_alloc() to extract a new helper
In reply to Dave ChinnerFrom: Jie Liu <[email protected]>
Refactor xlog_ticket_alloc() to extract a new helper, i.e. xfs_log_calc_unit_res().
This helper would be used to calculate the total log reservation size by adding extra log operation/transation headers for a new log ticket.
--- fs/xfs/xfs_log.c | 60 ++++++++++++++++++++++++++++++----------------- fs/xfs/xfs_log_format.h | 4 ++++ 2 files changed, 42 insertions(+), 22 deletions(-)
fs/xfs/xfs_log.c +38 -22
@@ -3390,24 +3390,17 @@ xfs_log_ticket_get( }/* -* Allocate and initialise a new log ticket. +* Figure out the total log space unit (in bytes) that would be +* required for a log ticket. */ -struct xlog_ticket * -xlog_ticket_alloc ( -struct xlog *log, -int unit_bytes, -int cnt, -char client, -bool permanent, -xfs_km_flags_t alloc_flags) +int +xfs_log_calc_unit_res ( +struct xfs_mount *mp, +int unit_bytes) { -struct xlog_ticket *tic; -uint num_headers; -int iclog_space; - - tic =kmem_zone_zalloc (xfs_log_ticket_zone, alloc_flags); -if (!tic) -return NULL ; +struct xlog *log = mp->m_log; +int iclog_space; +uint num_headers;/* * Permanent reservations have up to 'cnt'-1 active log operations
@@ -3482,20 +3475,43 @@ xlog_ticket_alloc( unit_bytes += log->l_iclog_hsize;/* for roundoff padding for transaction data and one for commit record */ -if (xfs_sb_version_haslogv2 (&log->l_mp->m_sb) && - log->l_mp->m_sb.sb_logsunit >1 ) { +if (xfs_sb_version_haslogv2 (&mp->m_sb) && mp->m_sb.sb_logsunit >1 ) {/* log su roundoff */ - unit_bytes +=2 *log->l_mp->m_sb.sb_logsunit; + unit_bytes +=2 * mp->m_sb.sb_logsunit; }else {/* BB roundoff */ - unit_bytes +=2 *BBSIZE ; + unit_bytes +=2 *BBSIZE ; } +return unit_bytes; +} + +/* +* Allocate and initialise a new log ticket. +*/ +struct xlog_ticket * +xlog_ticket_alloc ( +struct xlog *log, +int unit_bytes, +int cnt, +char client, +bool permanent, +xfs_km_flags_t alloc_flags) +{ +struct xlog_ticket *tic; +int unit_res; + + tic =kmem_zone_zalloc (xfs_log_ticket_zone, alloc_flags); +if (!tic) +return NULL ; + + unit_res =xfs_log_calc_unit_res (log->l_mp, unit_bytes); +atomic_set (&tic->t_ref,1 ); tic->t_task = current;INIT_LIST_HEAD (&tic->t_queue); - tic->t_unit_res = unit_bytes; - tic->t_curr_res = unit_bytes; + tic->t_unit_res = unit_res; + tic->t_curr_res = unit_res; tic->t_cnt = cnt; tic->t_ocnt = cnt; tic->t_tid =prandom_u32 ();
fs/xfs/xfs_log_format.h +4 -0
@@ -18,6 +18,8 @@#ifndef __XFS_LOG_FORMAT_H__#define __XFS_LOG_FORMAT_H__ +struct xfs_mount ; +typedef __uint32_t xlog_tid_t ;#define XLOG_MIN_ICLOGS 2
@@ -175,4 +177,6 @@ typedef struct xfs_log_iovec { uint i_type; /* type of region */ } xfs_log_iovec_t; +int xfs_log_calc_unit_res (struct xfs_mount *mp,int unit_bytes); +#endif /* __XFS_LOG_FORMAT_H__ */
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 59/60 xfs: Add xfs_log_rlimit.c
In reply to Dave ChinnerFrom: Jie Liu <[email protected]>
Add source files for xfs_log_rlimit.c The new file is used for log size calculations and validation shared with userspace.
[dchinner: xfs_log_calc_max_attrsetm_res() does not modify the tr_attrsetm reservation, just calculates the maximum. ]
[dchinner: rework loop in xfs_log_get_max_trans_res() ]
--- fs/xfs/Makefile | 1 + fs/xfs/xfs_log_format.h | 8 ++- fs/xfs/xfs_log_rlimit.c | 145 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 153 insertions(+), 1 deletion(-) create mode 100644 fs/xfs/xfs_log_rlimit.c
fs/xfs/Makefile +1 -0
@@ -81,6 +81,7 @@ xfs-y += xfs_alloc.o \ xfs_inode_fork.o \ xfs_inode_buf.o \ xfs_log_recover.o \ + xfs_log_rlimit.o \ xfs_sb.o \ xfs_symlink_remote.o \ xfs_trans_resv.o
fs/xfs/xfs_log_format.h +7 -1
@@ -1,5 +1,6 @@/* * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. +* Copyright (c) 2013 Jie Liu. * All Rights Reserved. * * This program is free software; you can redistribute it and/or
@@ -19,6 +20,7 @@#define __XFS_LOG_FORMAT_H__struct xfs_mount ; +struct xfs_trans_res ;typedef __uint32_t xlog_tid_t ;
@@ -41,6 +43,9 @@ typedef __uint32_t xlog_tid_t;#define XLOG_HEADER_SIZE 512 +/* Minimum number of transactions that must fit in the log (defined by mkfs) */ +#define XFS_MIN_LOG_FACTOR 3 +#define XLOG_REC_SHIFT (log) \ BTOBB(1 << (xfs_sb_version_haslogv2(&log->l_mp->m_sb) ? \ XLOG_MAX_RECORD_BSHIFT : XLOG_BIG_RECORD_BSHIFT))
@@ -125,7 +130,6 @@ typedef struct xlog_op_header {__u16 oh_res2;/* 32 bit align : 2 b */ } xlog_op_header_t; -/* valid values for h_fmt */ #define XLOG_FMT_UNKNOWN 0#define XLOG_FMT_LINUX_LE 1
@@ -178,5 +182,7 @@ typedef struct xfs_log_iovec { } xfs_log_iovec_t;int xfs_log_calc_unit_res (struct xfs_mount *mp,int unit_bytes); +int xfs_log_calc_minimum_size (struct xfs_mount *); +#endif /* __XFS_LOG_FORMAT_H__ */
fs/xfs/xfs_log_rlimit.c new file +145 -0
145 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
Re: [PATCH 59/60] xfs: Add xfs_log_rlimit.c
Quoted 218 lines · Dave Chinner
From: Jie Liu <[email protected]>
Add source files for
xfs_log_rlimit.cThe new file is used for log size calculations and validation shared with userspace.[dchinner:
xfs_log_calc_max_attrsetm_res()does not modify thetr_attrsetmreservation, just calculates the maximum. ][dchinner: rework loop in
xfs_log_get_max_trans_res()]Signed-off-by Jie Liu <[email protected]>Signed-off-by Dave Chinner <[email protected]>--- fs/xfs/Makefile | 1 + fs/xfs/xfs_log_format.h | 8 ++- fs/xfs/xfs_log_rlimit.c | 145 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 153 insertions(+), 1 deletion(-) create mode 100644 fs/xfs/xfs_log_rlimit.cfs/xfs/Makefile +1
-0@@ -81,6 +81,7 @@ xfs-y += xfs_alloc.o \ xfs_inode_fork.o \ xfs_inode_buf.o \ xfs_log_recover.o \ + xfs_log_rlimit.o \ xfs_sb.o \ xfs_symlink_remote.o \ xfs_trans_resv.ofs/xfs/xfs_log_format.h +7
-1@@ -1,5 +1,6 @@/* * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. +* Copyright (c) 2013 Jie Liu. * All Rights Reserved. * * This program is free software; you can redistribute it and/or @@ -19,6 +20,7 @@#define __XFS_LOG_FORMAT_H__struct xfs_mount ; +struct xfs_trans_res ;typedef __uint32_t xlog_tid_t ;@@ -41,6 +43,9 @@ typedef __uint32_t xlog_tid_t;#define XLOG_HEADER_SIZE 512 +/* Minimum number of transactions that must fit in the log (defined by mkfs) */ +#define XFS_MIN_LOG_FACTOR 3 +#define XLOG_REC_SHIFT (log) \ BTOBB(1 << (xfs_sb_version_haslogv2(&log->l_mp->m_sb) ? \ XLOG_MAX_RECORD_BSHIFT : XLOG_BIG_RECORD_BSHIFT))@@ -125,7 +130,6 @@ typedef struct xlog_op_header {__u16 oh_res2;/* 32 bit align : 2 b */ } xlog_op_header_t; -/* valid values for h_fmt */ #define XLOG_FMT_UNKNOWN 0#define XLOG_FMT_LINUX_LE 1@@ -178,5 +182,7 @@ typedef struct xfs_log_iovec { } xfs_log_iovec_t;int xfs_log_calc_unit_res (struct xfs_mount *mp,int unit_bytes); +int xfs_log_calc_minimum_size (struct xfs_mount *); +#endif /* __XFS_LOG_FORMAT_H__ */ fs/xfs/xfs_log_rlimit.c new file +135
-0@@ -0,0 +1,145 @@ +/* +* Copyright (c) 2013 Jie Liu. +* 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 +*/ +#include "xfs.h" +#include "xfs_fs.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_ag.h" +#include "xfs_sb.h" +#include "xfs_mount.h" +#include "xfs_trans_space.h" +#include "xfs_bmap_btree.h" +#include "xfs_inode.h" +#include "xfs_da_btree.h" +#include "xfs_attr_leaf.h" + +/* +* Calculate the maximum length in bytes that would be required for a local +* attribute value as large attributes out of line are not logged. +*/ +STATIC int +xfs_log_calc_max_attrsetm_res ( +struct xfs_mount *mp) +{ +int size; +int nblks; + + size =xfs_attr_leaf_entsize_local_max (mp->m_sb.sb_blocksize) - +MAXNAMELEN -1 ; + nblks =XFS_DAENTER_SPACE_RES (mp,XFS_ATTR_FORK ); + nblks +=XFS_B_TO_FSB (mp, size); + nblks +=XFS_NEXTENTADD_SPACE_RES (mp, size,XFS_ATTR_FORK ); + +return M_RES (mp)->tr_attrsetm.tr_logres + +M_RES (mp)->tr_attrsetrt.tr_logres * nblks; +} + +/* +* Iterate over the log space reservation table to figure out and return +* the maximum one in terms of the pre-calculated values which were done +* at mount time. +*/ +STATIC void +xfs_log_get_max_trans_res ( +struct xfs_mount *mp, +struct xfs_trans_res *max_resp) +{ +struct xfs_trans_res *resp; +struct xfs_trans_res *end_resp; +int log_space =0 ; +int attr_space; + + attr_space =xfs_log_calc_max_attrsetm_res (mp); + + resp = (struct xfs_trans_res *)M_RES (mp); + end_resp = (struct xfs_trans_res *)(M_RES (mp) +1 ); +for (; resp < end_resp; resp++) { +int tmp = resp->tr_logcount >1 ? + resp->tr_logres * resp->tr_logcount : + resp->tr_logres; +if (log_space < tmp) { + log_space = tmp; + *max_resp = *resp;/* struct copy */ + } + } + +if (attr_space > log_space) { + *max_resp =M_RES (mp)->tr_attrsetm;/* struct copy */ + max_resp->tr_logres = attr_space; + } +} + +/* +* Calculate the minimum valid log size for the given superblock configuration. +* Used to calculate the minimum log size at mkfs time, and to determine if +* the log is large enough or not at mount time. Returns the minimum size in +* filesystem block size units. +*/ +int +xfs_log_calc_minimum_size ( +struct xfs_mount *mp) +{ +struct xfs_trans_res tres = {0 }; +int max_logres; +int min_logblks =0 ; +int lsunit =0 ; + +xfs_log_get_max_trans_res (mp, &tres); + + max_logres =xfs_log_calc_unit_res (mp, tres.tr_logres); +if (tres.tr_logcount >1 ) + max_logres *= tres.tr_logcount; + +if (xfs_sb_version_haslogv2 (&mp->m_sb) && mp->m_sb.sb_logsunit >1 ) + lsunit =BTOBB (mp->m_sb.sb_logsunit); + +/* +* Two factors should be taken into account for calculating the minimum +* log space. +* 1) The fundamental limitation is that no single transaction can be +* larger than half size of the log. +* +* From mkfs.xfs, this is considered by the XFS_MIN_LOG_FACTOR +* define, which is set to 3. That means we can definitely fit +* maximally sized 2 transactions in the log. We'll use this same +* value here. +* +* 2) If the lsunit option is specified, a transaction requires 2 LSU +* for the reservation because there are two log writes that can +* require padding - the transaction data and the commit record which +* are written separately and both can require padding to the LSU. +* Consider that we can have an active CIL reservation holding 2*LSU, +* but the CIL is not over a push threshold, in this case, if we +* don't have enough log space for at one new transaction, which +* includes another 2*LSU in the reservation, we will run into dead +* loop situation in log space grant procedure. i.e. +* xlog_grant_head_wait(). +* +* Hence the log size needs to be able to contain two maximally sized +* and padded transactions, which is (2 * (2 * LSU + maxlres)). +*
fs/xfs/xfs_log_rlimit.c line 145
Quoted 10 lines
fs/xfs/xfs_log_rlimit.c new file +10
-0+* Also, the log size should be a multiple of the log stripe unit, round +* it up to lsunit boundary if lsunit is specified. +*/ +if (lsunit) + min_logblks =roundup (BTOBB (max_logres), lsunit) +2 * lsunit; +else + min_logblks =BTOBB (max_logres); + min_logblks *=XFS_MIN_LOG_FACTOR ; +return XFS_BB_TO_FSB (mp, min_logblks); +}
OK, my overall patch for this patch series is after my closing and may be wrong. I applied Dave's patchset over a yet-newer git kernel and may have gotten burned a little bit. It may not even be helpful, as xfs/297 gets a new assert on a non-CRC 512b-block filesystem, as opposed to grinding to a halt. [xfs/297 still passes for filesystems that have a 4k block size.]
The point of this reply is to call on Jeff Liu and ask this: Do you have a more recent and accurate fix to this code than what I tried to remember? Or did the fix not work on platforms other than 32-bit x86?
Thanks!
Michael
Quoted 1 line
From
f2a4759c5ed2011daed14b3b44f5eee2e317dbf6Mon Sep 17 00:00:00 2001
From: "Michael L. Semon" <[email protected]>
Date: Thu, 20 Jun 2013 03:40:30 -0400
Subject: [PATCH] Residual fixes for 2013-06-19 XFS 3.11 patchset
This patch represents fixing a merge conflict between the functions xfs_inactive_symlink() and xfs_inactive_symlink_rmt() from a patch that git am did not take cleanly. Sysadmin hack. Please check.
This patch also uses an int cast to make the build not fail with an undefined reference to _udivdi3. This issue is somewhat documented near the roundup() function in include/linux/kernel.h as applying to gcc-3.3, but it also seems to apply to gcc-4.8.1. It is a Jeff Liu fix that might have gotten lost in the mix. Reconstructed from memory.
--- fs/xfs/xfs_inode_ops.c | 2 +- fs/xfs/xfs_log_rlimit.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/xfs/xfs_inode_ops.c +1 -1
@@ -1496,7 +1496,7 @@ xfs_inactive(* Zero length symlinks _can_ exist. */ if (ip->i_d.di_size >XFS_IFORK_DSIZE (ip)) { - error =xfs_inactive_symlink_rmt (ip, &tp); + error =xfs_inactive_symlink (ip, &tp);if (error) goto out_cancel; }else if (ip->i_df.if_bytes >0 ) {
fs/xfs/xfs_log_rlimit.c +1 -1
@@ -137,7 +137,7 @@ xfs_log_calc_minimum_size(* it up to lsunit boundary if lsunit is specified. */ if (lsunit) - min_logblks =roundup (BTOBB (max_logres), lsunit) +2 * lsunit; + min_logblks =roundup ((int )BTOBB (max_logres), lsunit) +2 * lsunit;else min_logblks =BTOBB (max_logres); min_logblks *=XFS_MIN_LOG_FACTOR ;
Signature · 51 lines
1.8.3 root@plbearer:/var/lib/xfstests# MKFS_OPTIONS='-b log=9' ./check -xfs xfs/297 FSTYP -- xfs (debug) PLATFORM -- Linux/i686 plbearer 3.10.0-rc6+ MKFS_OPTIONS -- -f -b log=9 /dev/sdb6 MOUNT_OPTIONS -- /dev/sdb6 /mnt/xfstests-scratch xfs/297 216s ...[ 2262.188646] XFS: Assertion failed: BTOBB(need_bytes) < log->l_logBBsize, file: fs/xfs/xfs_log.c, line: 1498 [ 2262.189898] ------------[ cut here ]------------ [ 2262.190017] kernel BUG at fs/xfs/xfs_message.c:108! [ 2262.190017] invalid opcode: 0000 [#1] [ 2262.190017] CPU: 0 PID: 11388 Comm: mkdir Not tainted 3.10.0-rc6+ #5 [ 2262.190017] Hardware name: Dell Computer Corporation Dimension 2350/07W080, BIOS A01 12/17/2002 [ 2262.190017] task: eebe8000 ti: d91fa000 task.ti: d91fa000 [ 2262.190017] EIP: 0060:[<c11b3454>] EFLAGS: 00010282 CPU: 0 [ 2262.190017] EIP is at assfail+0x2b/0x2d [ 2262.190017] EAX: 0000005f EBX: d961e600 ECX: 000002e1 EDX: eebe84a0 [ 2262.190017] ESI: 00000dcb EDI: 00000000 EBP: d91fbe0c ESP: d91fbdf8 [ 2262.190017] DS: 007b ES: 007b FS: 0000 GS: 00e0 SS: 0068 [ 2262.190017] CR0: 8005003b CR2: b768a2f0 CR3: 2a4de000 CR4: 000007d0 [ 2262.190017] DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000 [ 2262.190017] DR6: ffff0ff0 DR7: 00000400 [ 2262.190017] Stack: [ 2262.190017] 00000000 c16f3f10 c16fbcd4 c16e9391 000005da d91fbe28 c12006bd 00000069 [ 2262.190017] 000111b8 00000069 00000003 000111b8 d91fbe60 c12022bc 00000069 00000001 [ 2262.190017] 00000009 eaba0bb0 d91fbe60 c11b496d 00000001 d961e600 00000000 df116e88 [ 2262.190017] Call Trace: [ 2262.190017] [<c12006bd>] xlog_grant_push_ail+0x4e/0xf2 [ 2262.190017] [<c12022bc>] xfs_log_reserve+0xc8/0x290 [ 2262.190017] [<c11b496d>] ? xfs_mod_incore_sb+0x46/0x4f [ 2262.190017] [<c11b9741>] xfs_trans_reserve+0x295/0x2a3 [ 2262.190017] [<c11a8bcf>] xfs_create+0x151/0x57f [ 2262.190017] [<c10e5788>] ? kern_path_create+0x8b/0x118 [ 2262.190017] [<c11b1146>] xfs_vn_mknod+0x94/0x15f [ 2262.190017] [<c11b122d>] ? xfs_vn_create+0x1c/0x1c [ 2262.190017] [<c11b124a>] xfs_vn_mkdir+0x1d/0x1f [ 2262.190017] [<c10e5be4>] vfs_mkdir+0x75/0x10c [ 2262.190017] [<c10e2618>] ? putname+0x23/0x32 [ 2262.190017] [<c10e5cd6>] SyS_mkdirat+0x5b/0xab [ 2262.190017] [<c10e5d4c>] SyS_mkdir+0x26/0x28 [ 2262.190017] [<c156f710>] syscall_call+0x7/0xb [ 2262.190017] Code: 55 89 e5 83 ec 14 3e 8d 74 26 00 89 4c 24 10 89 54 24 0c 89 44 24 08 c7 44 24 04 10 3f 6f c1 c7 04 24 00 00 00 00 e8 ad fd ff ff <0f> 0b 55 89 e5 83 ec 14 3e 8d 74 26 00 c7 44 24 10 01 00 00 00 [ 2262.190017] EIP: [<c11b3454>] assfail+0x2b/0x2d SS:ESP 0068:d91fbdf8 [ 2262.236310] ---[ end trace fb9dc01903f0ec11 ]--- _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 59/60] xfs: Add xfs_log_rlimit.c
In reply to Dave ChinnerI'm still looking for Jeff's input on this particular patch. However, I did want to report success on xfs/297. The Pentium 4 test PC was left to rest for a few hours, then it was started again. The latest xfsprogs patchset was applied to xfsprogs.
512b blocks, internal logdev, no CRC, projid32bit=1, tracers on: PASS 512b blocks, internal logdev, no CRC, projid32bit=0, tracers on: PASS 512b blocks, internal logdev, no CRC, projid32bit=0, tracers off: PASS 1k blocks, internal logdev, no CRC, tracers off: PASS ...rebooted to avoid RT throttling slowing things down... 1k blocks, internal logdev, CRC, tracers off: PASS
2k blocks, internal logdev, CRC, tracers off: PASS
2k blocks, external logdev, CRC, rtdev, tracers off: PASS 4k blocks, default mkfs.xfs: PASS
Something was fixed between the new xfsprogs and the PC's chance to reset 100%. What? I really don't know! But there is success.
Great job, Dave and Jeff!
Michael
Quoted 218 lines · Dave Chinner
From: Jie Liu <[email protected]>
Add source files for
xfs_log_rlimit.cThe new file is used for log size calculations and validation shared with userspace.[dchinner:
xfs_log_calc_max_attrsetm_res()does not modify thetr_attrsetmreservation, just calculates the maximum. ][dchinner: rework loop in
xfs_log_get_max_trans_res()]Signed-off-by Jie Liu <[email protected]>Signed-off-by Dave Chinner <[email protected]>--- fs/xfs/Makefile | 1 + fs/xfs/xfs_log_format.h | 8 ++- fs/xfs/xfs_log_rlimit.c | 145 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 153 insertions(+), 1 deletion(-) create mode 100644 fs/xfs/xfs_log_rlimit.cfs/xfs/Makefile +1
-0@@ -81,6 +81,7 @@ xfs-y += xfs_alloc.o \ xfs_inode_fork.o \ xfs_inode_buf.o \ xfs_log_recover.o \ + xfs_log_rlimit.o \ xfs_sb.o \ xfs_symlink_remote.o \ xfs_trans_resv.ofs/xfs/xfs_log_format.h +7
-1@@ -1,5 +1,6 @@/* * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. +* Copyright (c) 2013 Jie Liu. * All Rights Reserved. * * This program is free software; you can redistribute it and/or @@ -19,6 +20,7 @@#define __XFS_LOG_FORMAT_H__struct xfs_mount ; +struct xfs_trans_res ;typedef __uint32_t xlog_tid_t ;@@ -41,6 +43,9 @@ typedef __uint32_t xlog_tid_t;#define XLOG_HEADER_SIZE 512 +/* Minimum number of transactions that must fit in the log (defined by mkfs) */ +#define XFS_MIN_LOG_FACTOR 3 +#define XLOG_REC_SHIFT (log) \ BTOBB(1 << (xfs_sb_version_haslogv2(&log->l_mp->m_sb) ? \ XLOG_MAX_RECORD_BSHIFT : XLOG_BIG_RECORD_BSHIFT))@@ -125,7 +130,6 @@ typedef struct xlog_op_header {__u16 oh_res2;/* 32 bit align : 2 b */ } xlog_op_header_t; -/* valid values for h_fmt */ #define XLOG_FMT_UNKNOWN 0#define XLOG_FMT_LINUX_LE 1@@ -178,5 +182,7 @@ typedef struct xfs_log_iovec { } xfs_log_iovec_t;int xfs_log_calc_unit_res (struct xfs_mount *mp,int unit_bytes); +int xfs_log_calc_minimum_size (struct xfs_mount *); +#endif /* __XFS_LOG_FORMAT_H__ */ fs/xfs/xfs_log_rlimit.c new file +135
-0@@ -0,0 +1,145 @@ +/* +* Copyright (c) 2013 Jie Liu. +* 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 +*/ +#include "xfs.h" +#include "xfs_fs.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_ag.h" +#include "xfs_sb.h" +#include "xfs_mount.h" +#include "xfs_trans_space.h" +#include "xfs_bmap_btree.h" +#include "xfs_inode.h" +#include "xfs_da_btree.h" +#include "xfs_attr_leaf.h" + +/* +* Calculate the maximum length in bytes that would be required for a local +* attribute value as large attributes out of line are not logged. +*/ +STATIC int +xfs_log_calc_max_attrsetm_res ( +struct xfs_mount *mp) +{ +int size; +int nblks; + + size =xfs_attr_leaf_entsize_local_max (mp->m_sb.sb_blocksize) - +MAXNAMELEN -1 ; + nblks =XFS_DAENTER_SPACE_RES (mp,XFS_ATTR_FORK ); + nblks +=XFS_B_TO_FSB (mp, size); + nblks +=XFS_NEXTENTADD_SPACE_RES (mp, size,XFS_ATTR_FORK ); + +return M_RES (mp)->tr_attrsetm.tr_logres + +M_RES (mp)->tr_attrsetrt.tr_logres * nblks; +} + +/* +* Iterate over the log space reservation table to figure out and return +* the maximum one in terms of the pre-calculated values which were done +* at mount time. +*/ +STATIC void +xfs_log_get_max_trans_res ( +struct xfs_mount *mp, +struct xfs_trans_res *max_resp) +{ +struct xfs_trans_res *resp; +struct xfs_trans_res *end_resp; +int log_space =0 ; +int attr_space; + + attr_space =xfs_log_calc_max_attrsetm_res (mp); + + resp = (struct xfs_trans_res *)M_RES (mp); + end_resp = (struct xfs_trans_res *)(M_RES (mp) +1 ); +for (; resp < end_resp; resp++) { +int tmp = resp->tr_logcount >1 ? + resp->tr_logres * resp->tr_logcount : + resp->tr_logres; +if (log_space < tmp) { + log_space = tmp; + *max_resp = *resp;/* struct copy */ + } + } + +if (attr_space > log_space) { + *max_resp =M_RES (mp)->tr_attrsetm;/* struct copy */ + max_resp->tr_logres = attr_space; + } +} + +/* +* Calculate the minimum valid log size for the given superblock configuration. +* Used to calculate the minimum log size at mkfs time, and to determine if +* the log is large enough or not at mount time. Returns the minimum size in +* filesystem block size units. +*/ +int +xfs_log_calc_minimum_size ( +struct xfs_mount *mp) +{ +struct xfs_trans_res tres = {0 }; +int max_logres; +int min_logblks =0 ; +int lsunit =0 ; + +xfs_log_get_max_trans_res (mp, &tres); + + max_logres =xfs_log_calc_unit_res (mp, tres.tr_logres); +if (tres.tr_logcount >1 ) + max_logres *= tres.tr_logcount; + +if (xfs_sb_version_haslogv2 (&mp->m_sb) && mp->m_sb.sb_logsunit >1 ) + lsunit =BTOBB (mp->m_sb.sb_logsunit); + +/* +* Two factors should be taken into account for calculating the minimum +* log space. +* 1) The fundamental limitation is that no single transaction can be +* larger than half size of the log. +* +* From mkfs.xfs, this is considered by the XFS_MIN_LOG_FACTOR +* define, which is set to 3. That means we can definitely fit +* maximally sized 2 transactions in the log. We'll use this same +* value here. +* +* 2) If the lsunit option is specified, a transaction requires 2 LSU +* for the reservation because there are two log writes that can +* require padding - the transaction data and the commit record which +* are written separately and both can require padding to the LSU. +* Consider that we can have an active CIL reservation holding 2*LSU, +* but the CIL is not over a push threshold, in this case, if we +* don't have enough log space for at one new transaction, which +* includes another 2*LSU in the reservation, we will run into dead +* loop situation in log space grant procedure. i.e. +* xlog_grant_head_wait(). +* +* Hence the log size needs to be able to contain two maximally sized +* and padded transactions, which is (2 * (2 * LSU + maxlres)). +*
fs/xfs/xfs_log_rlimit.c line 145
Quoted 10 lines
fs/xfs/xfs_log_rlimit.c new file +10
-0+* Also, the log size should be a multiple of the log stripe unit, round +* it up to lsunit boundary if lsunit is specified. +*/ +if (lsunit) + min_logblks =roundup (BTOBB (max_logres), lsunit) +2 * lsunit; +else + min_logblks =BTOBB (max_logres); + min_logblks *=XFS_MIN_LOG_FACTOR ; +return XFS_BB_TO_FSB (mp, min_logblks); +}
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 59/60] xfs: Add xfs_log_rlimit.c
In reply to Dave ChinnerQuoted 4 lines · Dave Chinner
fs/xfs/xfs_log_rlimit.c new file +4
-0+* 2) If the lsunit option is specified, a transaction requires 2 LSU +* for the reservation because there are two log writes that can +* require padding - the transaction data and the commit record which +* are written separately and both can require padding to the LSU.
fs/xfs/xfs_log_rlimit.c line 135
Quoted 10 lines
fs/xfs/xfs_log_rlimit.c new file +10
-0+* Consider that we can have an active CIL reservation holding 2*LSU, +* but the CIL is not over a push threshold, in this case, if we +* don't have enough log space for at one new transaction, which +* includes another 2*LSU in the reservation, we will run into dead +* loop situation in log space grant procedure. i.e. +* xlog_grant_head_wait(). +* +* Hence the log size needs to be able to contain two maximally sized +* and padded transactions, which is (2 * (2 * LSU + maxlres)). +*
Any thoughts on how we can separate the 2 * log stripe unit from the reservation.
The added extended attribute calls for parent inode pointers (especially xfs_rename() where it could add up to one and remove up to two attributes) is causing a huge multiplication cnt for reservation. Those multiplications would be killers on 256KiB log stripe units.
--Mark.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 59/60] xfs: Add xfs_log_rlimit.c
Quoted 10 lines · Mark Tinguely
Quoted 9 lines · Dave Chinner
fs/xfs/xfs_log_rlimit.c new file +9
-0+* 2) If the lsunit option is specified, a transaction requires 2 LSU +* for the reservation because there are two log writes that can +* require padding - the transaction data and the commit record which +* are written separately and both can require padding to the LSU. +* Consider that we can have an active CIL reservation holding 2*LSU, +* but the CIL is not over a push threshold, in this case, if we +* don't have enough log space for at one new transaction, which +* includes another 2*LSU in the reservation, we will run into dead +* loop situation in log space grant procedure. i.e.
Quoted 8 lines
fs/xfs/xfs_log_rlimit.c line 135
Quoted 5 lines
fs/xfs/xfs_log_rlimit.c new file +5
-0+* xlog_grant_head_wait(). +* +* Hence the log size needs to be able to contain two maximally sized +* and padded transactions, which is (2 * (2 * LSU + maxlres)). +* Any thoughts on how we can separate the 2 * log stripe unit from the reservation.
You can't. The reservation, by definition, is the worse case log space usage for the transaction. Therefore, it has to take into account the LSU padding that may be necessary if this transaction is committed by itself to the log (e.g. wsync operation)
Quoted 4 lines
The added extended attribute calls for parent inode pointers (especially
xfs_rename()where it could add up to one and remove up to two attributes) is causing a huge multiplication cnt for reservation.
So you are adding a attribute reservations to create/mkdir/rename/link transaction reservations? That doesn't seem like a good idea, and it's contrary to the direction we want to head with the transaction subsystem. Can you post your patches so we some some context to the question you are asking?
FWIW, the intended method of linking multiple independent transactions together for parent pointers into an atomic commit is this:
While the text is somewhat out of date (talks about rolling transactions and being able to replace them), it predated the delayed logging implementation and hence doesn't take into account the obvious, simple extension that can be made to the CIL to implement this. i.e. being able to hold the current CIL context open for a number of transactions to take place before releasing it again.
The point of doing this is still relevant, however:
"This may also allow us to split some of the large compound transactions into smaller, more self contained transactions. This would reduce reservation pressure on log space in the common case where all the corner cases in the transactions are not taken."
IOWs, rather than building new, large "aggregation" transactions, we should be adding infrastructure to the CIL to allow atomic transaction aggregation techniques to be used and then just using the existing transaction infrastructure to implement operations such as "create with ACL"....
FYI, we need this for all the operations that add attributes at create time, such as default ACLs and DMAPI/DMF attributes....
Quoted 2 lines
Those multiplications would be killers on 256KiB log stripe units.
Numbers, please?
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 59/60] xfs: Add xfs_log_rlimit.c
Quoted 20 lines · Dave Chinner
Quoted 10 lines · Mark Tinguely
Quoted 9 lines · Dave Chinner
fs/xfs/xfs_log_rlimit.c new file +9
-0+* 2) If the lsunit option is specified, a transaction requires 2 LSU +* for the reservation because there are two log writes that can +* require padding - the transaction data and the commit record which +* are written separately and both can require padding to the LSU. +* Consider that we can have an active CIL reservation holding 2*LSU, +* but the CIL is not over a push threshold, in this case, if we +* don't have enough log space for at one new transaction, which +* includes another 2*LSU in the reservation, we will run into dead +* loop situation in log space grant procedure. i.e. Quoted 8 lines
fs/xfs/xfs_log_rlimit.c line 135
Quoted 5 lines
fs/xfs/xfs_log_rlimit.c new file +5
-0+* xlog_grant_head_wait(). +* +* Hence the log size needs to be able to contain two maximally sized +* and padded transactions, which is (2 * (2 * LSU + maxlres)). +* Any thoughts on how we can separate the 2 * log stripe unit from the reservation.
Quoted 4 lines
You can't. The reservation, by definition, is the worse case log space usage for the transaction. Therefore, it has to take into account the LSU padding that may be necessary if this transaction is committed by itself to the log (e.g. wsync operation)
I am thinking we should separate the extra 2*LSU allocated space from the individual pieces of the transaction (caused by xfs_trans_rolls and xfs_bmap_finish) and associate it with the transaction. Sync writes are for the transaction anyway and not the pieces. It is the multiplication of the (2*LSU) by each piece of the transaction that is the killer. A mkdir will have 1.5MB of log reserved space just for the possible LSU padding.
The cil can steal the left over current ticket space and the global LSU space.
Quoted 33 lines
Quoted 5 lines
The added extended attribute calls for parent inode pointers (especially
xfs_rename()where it could add up to one and remove up to two attributes) is causing a huge multiplication cnt for reservation.So you are adding a attribute reservations to create/mkdir/rename/link transaction reservations? That doesn't seem like a good idea, and it's contrary to the direction we want to head with the transaction subsystem. Can you post your patches so we some some context to the question you are asking?
FWIW, the intended method of linking multiple independent transactions together for parent pointers into an atomic commit is this:
While the text is somewhat out of date (talks about rolling transactions and being able to replace them), it predated the delayed logging implementation and hence doesn't take into account the obvious, simple extension that can be made to the CIL to implement this. i.e. being able to hold the current CIL context open for a number of transactions to take place before releasing it again.
The point of doing this is still relevant, however:
"This may also allow us to split some of the large compound transactions into smaller, more self contained transactions. This would reduce reservation pressure on log space in the common case where all the corner cases in the transactions are not taken."
Quoted 5 lines
IOWs, rather than building new, large "aggregation" transactions, we should be adding infrastructure to the CIL to allow atomic transaction aggregation techniques to be used and then just using the existing transaction infrastructure to implement operations such as "create with ACL"....
I will have to think on this. I don't see how the allocation of log space for a new transaction while holding locks is a good thing.
Quoted 4 lines
FYI, we need this for all the operations that add attributes at create time, such as default ACLs and DMAPI/DMF attributes....
Quoted 8 lines
Quoted 2 lines
Those multiplications would be killers on 256KiB log stripe units.
Numbers, please?
Cheers,
Dave.
/*
* Various log count values.
*/
#define XFS_DEFAULT_LOG_COUNT 1 #define XFS_DEFAULT_PERM_LOG_COUNT 2 #define XFS_ITRUNCATE_LOG_COUNT 2 #define XFS_INACTIVE_LOG_COUNT 2 #define XFS_CREATE_LOG_COUNT 2 #define XFS_MKDIR_LOG_COUNT 3 #define XFS_SYMLINK_LOG_COUNT 3 #define XFS_REMOVE_LOG_COUNT 2 #define XFS_LINK_LOG_COUNT 2 #define XFS_RENAME_LOG_COUNT 2 #define XFS_WRITE_LOG_COUNT 2 #define XFS_ADDAFORK_LOG_COUNT 2 #define XFS_ATTRINVAL_LOG_COUNT 1 #define XFS_ATTRSET_LOG_COUNT 3 #define XFS_ATTRRM_LOG_COUNT 3
Even if you are creative, the multipliers add up quickly.xfs_rename will do the directory ops. possibly a attibset and up to 2 attrrm and we have to hold the src and target inodes locks over all the operations.
Thanks for the ideas.
--Mark.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 59/60] xfs: Add xfs_log_rlimit.c
Quoted 21 lines · Mark Tinguely
Quoted 20 lines · Dave Chinner
Quoted 18 lines · Mark Tinguely
Quoted 4 lines · Dave Chinner
fs/xfs/xfs_log_rlimit.c new file +4
-0+* 2) If the lsunit option is specified, a transaction requires 2 LSU +* for the reservation because there are two log writes that can +* require padding - the transaction data and the commit record which +* are written separately and both can require padding to the LSU. fs/xfs/xfs_log_rlimit.c line 135
Quoted 10 lines
fs/xfs/xfs_log_rlimit.c new file +10
-0+* Consider that we can have an active CIL reservation holding 2*LSU, +* but the CIL is not over a push threshold, in this case, if we +* don't have enough log space for at one new transaction, which +* includes another 2*LSU in the reservation, we will run into dead +* loop situation in log space grant procedure. i.e. +* xlog_grant_head_wait(). +* +* Hence the log size needs to be able to contain two maximally sized +* and padded transactions, which is (2 * (2 * LSU + maxlres)). +* Any thoughts on how we can separate the 2 * log stripe unit from the reservation.
Quoted 7 lines
Quoted 4 lines
You can't. The reservation, by definition, is the worse case log space usage for the transaction. Therefore, it has to take into account the LSU padding that may be necessary if this transaction is committed by itself to the log (e.g. wsync operation)
I am thinking we should separate the extra 2*LSU allocated space from the individual pieces of the transaction
Why? How are you going to prevent log space deadlocks if we don't reserve that space for each individual transaction in a permanent transaction reservation?
Quoted 4 lines
(caused by
xfs_trans_rollsandxfs_bmap_finish) and associate it with the transaction. Sync writes are for the transaction anyway and not the pieces.
Every transaction commit that is executed can require LSU padding because it could be the transaction the CIL steals the required LSU reservation from. When CIL flushes occur - and hence when the LSU padding needs to be stolen from a transaction commit - is not under the control of the currently executing transaction.
Quoted 4 lines
It is the multiplication of the (2*LSU) by each piece of the transaction that is the killer.
A mkdir will have 1.5MB of log reserved space just for the possible LSU padding.
A killer for what, exactly? This is the current status quo, and I don't see people having performance problems related to it....
Quoted 2 lines
The cil can steal the left over current ticket space and the global LSU space.
The space is avilable only if the current transaction _unit reservation_ has it reserved. Hence every unit reservation needs that space to be reserved.
I'm not saying this is optimal - it is an architectural requirement that the log has always had and therefore *necessary*.
Quoted 32 lines
Quoted 32 lines
Quoted 4 lines
The added extended attribute calls for parent inode pointers (especially
xfs_rename()where it could add up to one and remove up to two attributes) is causing a huge multiplication cnt for reservation.So you are adding a attribute reservations to create/mkdir/rename/link transaction reservations? That doesn't seem like a good idea, and it's contrary to the direction we want to head with the transaction subsystem. Can you post your patches so we some some context to the question you are asking?
FWIW, the intended method of linking multiple independent transactions together for parent pointers into an atomic commit is this:
While the text is somewhat out of date (talks about rolling transactions and being able to replace them), it predated the delayed logging implementation and hence doesn't take into account the obvious, simple extension that can be made to the CIL to implement this. i.e. being able to hold the current CIL context open for a number of transactions to take place before releasing it again.
The point of doing this is still relevant, however:
"This may also allow us to split some of the large compound transactions into smaller, more self contained transactions. This would reduce reservation pressure on log space in the common case where all the corner cases in the transactions are not taken."
Quoted 8 lines
Quoted 5 lines
IOWs, rather than building new, large "aggregation" transactions, we should be adding infrastructure to the CIL to allow atomic transaction aggregation techniques to be used and then just using the existing transaction infrastructure to implement operations such as "create with ACL"....
I will have to think on this. I don't see how the allocation of log space for a new transaction while holding locks is a good thing.
Who said anything about requiring new locks? :)
The initial implementation I was thinking of is basically a reference counter and a method for delaying CIL pushes until the reference count drops to zero.
Indeed, if we push the aggregated space reservations up into this aggregated transaction, the individual transactions can just pull out of the space we already know is available to use. IOWs, it's relatively trivial to do in a way that leaves open many avenues for later optimisation....
Quoted 31 lines
Quoted 11 lines
FYI, we need this for all the operations that add attributes at create time, such as default ACLs and DMAPI/DMF attributes....
Quoted 2 lines
Those multiplications would be killers on 256KiB log stripe units.
Numbers, please?
Cheers,
Dave.
/*
* Various log count values.
*/#define XFS_DEFAULT_LOG_COUNT 1 #define XFS_DEFAULT_PERM_LOG_COUNT 2 #define XFS_ITRUNCATE_LOG_COUNT 2 #define XFS_INACTIVE_LOG_COUNT 2 #define XFS_CREATE_LOG_COUNT 2 #define XFS_MKDIR_LOG_COUNT 3 #define XFS_SYMLINK_LOG_COUNT 3 #define XFS_REMOVE_LOG_COUNT 2 #define XFS_LINK_LOG_COUNT 2 #define XFS_RENAME_LOG_COUNT 2 #define XFS_WRITE_LOG_COUNT 2 #define XFS_ADDAFORK_LOG_COUNT 2 #define XFS_ATTRINVAL_LOG_COUNT 1 #define XFS_ATTRSET_LOG_COUNT 3 #define XFS_ATTRRM_LOG_COUNT 3
Quoted 4 lines
Even if you are creative, the multipliers add up quickly.
xfs_renamewill do the directory ops. possibly a attibset and up to 2 attrrm and we have to hold the src and target inodes locks over all the operations.
We don't have to hold them locked across the entire operation because the VFS is holding them locked so nothing else can do a namespace operation which we are modifying them.
Anyway, you're worried about multiplying out the existing reservations, but that's really not that big of a deal - it's just log space, and we've got lots of that to use, and we have plenty of avenues to optimise usage in future..
e.g. mkdir is a compound transaction that is really 2 different operations. The first is physical inode allocation, then second is allocating a free inode. the first only happens for 1 in every 64 free inode allocations (rarer if we are also removing inodes, too). So most of the time we are reserving far more space in the log that we actually need to allocate an inode.
The actual unit reservation for the create is the maximum of the two individual component reservations times the number of commits that will be required, and the total is the unit reservation times the number of commits needed. So for a create transaction, it's an overestimation of the worst case.
Is that a problem? No. Can it be improved? Yes - see the comments about splitting out physical inode chunk allocation into the background here:
http://xfs.org/index.php/Improving_inode_Caching#Contiguous_Inode_Allocation
And suddenly we end up with mkdir/create/etc only requiring a single transaction reservation. There goes one of your 2*LSU paddings...
What about attributes? The triple-stage transaction is only required when -replacing- an existing attribute. The first adds the new attribute, the second flips the complete/incomplete flags, and the third removes the old attributes. Just adding a new attribute only requires a single transaction and most attributes are never overwritten, so again we are almost always reserving far too much space for such an operation.
Can we optimise this? Yes, we can. Let's disaggregate it - if we are replacing attribute content without changing the size or name, then we could just add a new transaction that logs a direct overwrite. That's a *tiny* transaction. If we are replacing an attribute of the same size with a new name, then it's a little more complex as we have to manipulate the hash index entries, but that is still a single, simple transaction. If we are adding, knowing we aren't doing a replacment, then that is a single transaction, too.
Start to see how this greatly reduces the overall operational transaction reservations? We can build bigger and more complex transactions as part of the process, but optimisation of the reservations comes from separation into smaller, more fine-grained transactions and reservations.
Keep in mind that from this perspective, I'm quite happy for an initial parent pointer implementation to start with gigantic create+attr/rename+attr transaction reservations. I'm also happy for it to take us 2-3 years to optimise/disaggegate the transactions to reduce the overhead to be smaller and more efficient.
I don't expect the initial implementation to be perfect or even optimal - attempting to make it so puts us right into prematuve optimisation territory. Make parent pointers robust first, then we can worry about where we can optimise reservations down to the smallest possible subset.
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 59/60] xfs: Add xfs_log_rlimit.c
Quoted 27 lines · Dave Chinner
Quoted 26 lines · Mark Tinguely
Quoted 24 lines · Dave Chinner
Quoted 10 lines · Mark Tinguely
Quoted 9 lines · Dave Chinner
fs/xfs/xfs_log_rlimit.c new file +9
-0+* 2) If the lsunit option is specified, a transaction requires 2 LSU +* for the reservation because there are two log writes that can +* require padding - the transaction data and the commit record which +* are written separately and both can require padding to the LSU. +* Consider that we can have an active CIL reservation holding 2*LSU, +* but the CIL is not over a push threshold, in this case, if we +* don't have enough log space for at one new transaction, which +* includes another 2*LSU in the reservation, we will run into dead +* loop situation in log space grant procedure. i.e. Quoted 8 lines
fs/xfs/xfs_log_rlimit.c line 135
Quoted 5 lines
fs/xfs/xfs_log_rlimit.c new file +5
-0+* xlog_grant_head_wait(). +* +* Hence the log size needs to be able to contain two maximally sized +* and padded transactions, which is (2 * (2 * LSU + maxlres)). +* Any thoughts on how we can separate the 2 * log stripe unit from the reservation.
You can't. The reservation, by definition, is the worse case log space usage for the transaction. Therefore, it has to take into account the LSU padding that may be necessary if this transaction is committed by itself to the log (e.g. wsync operation)
Quoted 6 lines
Quoted 2 lines
I am thinking we should separate the extra 2*LSU allocated space from the individual pieces of the transaction
Why? How are you going to prevent log space deadlocks if we don't reserve that space for each individual transaction in a permanent transaction reservation?
Allocate 2 per transaction, not one per segment of a transaction.
It may be a wash for 2 or 3 segments per transaction, but would help if there are 10 segments per transaction.
Quoted 11 lines
Quoted 5 lines
(caused by
xfs_trans_rollsandxfs_bmap_finish) and associate it with the transaction. Sync writes are for the transaction anyway and not the pieces.Every transaction commit that is executed can require LSU padding because it could be the transaction the CIL steals the required LSU reservation from. When CIL flushes occur - and hence when the LSU padding needs to be stolen from a transaction commit - is not under the control of the currently executing transaction.
I was thinking we need 2 (2*LSU) per transaction. One for a CIL push because it could be too large and one if it is sync transaction. In the mean time if another transaction pushes the log for one of the above reasons, the CIL will steal whatever is left over from the transaction and one of the (2*LSU) from that ticket.
Quoted 11 lines
Quoted 4 lines
It is the multiplication of the (2*LSU) by each piece of the transaction that is the killer.
A mkdir will have 1.5MB of log reserved space just for the possible LSU padding.A killer for what, exactly? This is the current status quo, and I don't see people having performance problems related to it....
Quoted 2 lines
The cil can steal the left over current ticket space and the global LSU space.
Quoted 6 lines
The space is avilable only if the current transaction
_unitreservation_has it reserved. Hence every unit reservation needs that space to be reserved.I'm not saying this is optimal - it is an architectural requirement that the log has always had and therefore *necessary*.
Killer only in the amount of space as the segments increase.
Quoted 38 lines
Quoted 38 lines
Quoted 37 lines
Quoted 4 lines
The added extended attribute calls for parent inode pointers (especially
xfs_rename()where it could add up to one and remove up to two attributes) is causing a huge multiplication cnt for reservation.So you are adding a attribute reservations to create/mkdir/rename/link transaction reservations? That doesn't seem like a good idea, and it's contrary to the direction we want to head with the transaction subsystem. Can you post your patches so we some some context to the question you are asking?
FWIW, the intended method of linking multiple independent transactions together for parent pointers into an atomic commit is this:
While the text is somewhat out of date (talks about rolling transactions and being able to replace them), it predated the delayed logging implementation and hence doesn't take into account the obvious, simple extension that can be made to the CIL to implement this. i.e. being able to hold the current CIL context open for a number of transactions to take place before releasing it again.
The point of doing this is still relevant, however:
"This may also allow us to split some of the large compound transactions into smaller, more self contained transactions. This would reduce reservation pressure on log space in the common case where all the corner cases in the transactions are not taken."
IOWs, rather than building new, large "aggregation" transactions, we should be adding infrastructure to the CIL to allow atomic transaction aggregation techniques to be used and then just using the existing transaction infrastructure to implement operations such as "create with ACL"....
Quoted 4 lines
Quoted 2 lines
I will have to think on this. I don't see how the allocation of log space for a new transaction while holding locks is a good thing.
Who said anything about requiring new locks? :)
I meant we have to hold the inode locks between the directory code the the attribute code. If we do not, then the attributes quickly become out of line with the directory status.
Quoted 10 lines
The initial implementation I was thinking of is basically a reference counter and a method for delaying CIL pushes until the reference count drops to zero.
Indeed, if we push the aggregated space reservations up into this aggregated transaction, the individual transactions can just pull out of the space we already know is available to use. IOWs, it's relatively trivial to do in a way that leaves open many avenues for later optimisation....
sweet.
Quoted 32 lines
Quoted 32 lines
Quoted 4 lines
FYI, we need this for all the operations that add attributes at create time, such as default ACLs and DMAPI/DMF attributes....
Quoted 8 lines
Quoted 2 lines
Those multiplications would be killers on 256KiB log stripe units.
Numbers, please?
Cheers,
Dave.
/*
* Various log count values.
*/#define XFS_DEFAULT_LOG_COUNT 1 #define XFS_DEFAULT_PERM_LOG_COUNT 2 #define XFS_ITRUNCATE_LOG_COUNT 2 #define XFS_INACTIVE_LOG_COUNT 2 #define XFS_CREATE_LOG_COUNT 2 #define XFS_MKDIR_LOG_COUNT 3 #define XFS_SYMLINK_LOG_COUNT 3 #define XFS_REMOVE_LOG_COUNT 2 #define XFS_LINK_LOG_COUNT 2 #define XFS_RENAME_LOG_COUNT 2 #define XFS_WRITE_LOG_COUNT 2 #define XFS_ADDAFORK_LOG_COUNT 2 #define XFS_ATTRINVAL_LOG_COUNT 1 #define XFS_ATTRSET_LOG_COUNT 3 #define XFS_ATTRRM_LOG_COUNT 3
Quoted 8 lines
Quoted 4 lines
Even if you are creative, the multipliers add up quickly.
xfs_renamewill do the directory ops. possibly a attibset and up to 2 attrrm and we have to hold the src and target inodes locks over all the operations.We don't have to hold them locked across the entire operation because the VFS is holding them locked so nothing else can do a namespace operation which we are modifying them.
I find without holding the lock over both dir and attrib routines that remove occasionally can't find parent pointer attribute entry. I suspect remove racing in rename.
Quoted 62 lines
Anyway, you're worried about multiplying out the existing reservations, but that's really not that big of a deal - it's just log space, and we've got lots of that to use, and we have plenty of avenues to optimise usage in future..
e.g. mkdir is a compound transaction that is really 2 different operations. The first is physical inode allocation, then second is allocating a free inode. the first only happens for 1 in every 64 free inode allocations (rarer if we are also removing inodes, too). So most of the time we are reserving far more space in the log that we actually need to allocate an inode.
The actual unit reservation for the create is the maximum of the two individual component reservations times the number of commits that will be required, and the total is the unit reservation times the number of commits needed. So for a create transaction, it's an overestimation of the worst case.
Is that a problem? No. Can it be improved? Yes - see the comments about splitting out physical inode chunk allocation into the background here:
http://xfs.org/index.php/Improving_inode_Caching#Contiguous_Inode_Allocation
And suddenly we end up with mkdir/create/etc only requiring a single transaction reservation. There goes one of your 2*LSU paddings...
What about attributes? The triple-stage transaction is only required when -replacing- an existing attribute. The first adds the new attribute, the second flips the complete/incomplete flags, and the third removes the old attributes. Just adding a new attribute only requires a single transaction and most attributes are never overwritten, so again we are almost always reserving far too much space for such an operation.
Can we optimise this? Yes, we can. Let's disaggregate it - if we are replacing attribute content without changing the size or name, then we could just add a new transaction that logs a direct overwrite. That's a *tiny* transaction. If we are replacing an attribute of the same size with a new name, then it's a little more complex as we have to manipulate the hash index entries, but that is still a single, simple transaction. If we are adding, knowing we aren't doing a replacment, then that is a single transaction, too.
Start to see how this greatly reduces the overall operational transaction reservations? We can build bigger and more complex transactions as part of the process, but optimisation of the reservations comes from separation into smaller, more fine-grained transactions and reservations.
Keep in mind that from this perspective, I'm quite happy for an initial parent pointer implementation to start with gigantic create+attr/rename+attr transaction reservations. I'm also happy for it to take us 2-3 years to optimise/disaggegate the transactions to reduce the overhead to be smaller and more efficient.
I don't expect the initial implementation to be perfect or even optimal - attempting to make it so puts us right into prematuve optimisation territory. Make parent pointers robust first, then we can worry about where we can optimise reservations down to the smallest possible subset.
Quoted 3 lines
Cheers,
Dave.
Thanks.
--Mark.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 59/60] xfs: Add xfs_log_rlimit.c
Quoted 31 lines · Mark Tinguely
Quoted 30 lines · Dave Chinner
Quoted 28 lines · Mark Tinguely
Quoted 20 lines · Dave Chinner
Quoted 10 lines · Mark Tinguely
Quoted 9 lines · Dave Chinner
fs/xfs/xfs_log_rlimit.c new file +9
-0+* 2) If the lsunit option is specified, a transaction requires 2 LSU +* for the reservation because there are two log writes that can +* require padding - the transaction data and the commit record which +* are written separately and both can require padding to the LSU. +* Consider that we can have an active CIL reservation holding 2*LSU, +* but the CIL is not over a push threshold, in this case, if we +* don't have enough log space for at one new transaction, which +* includes another 2*LSU in the reservation, we will run into dead +* loop situation in log space grant procedure. i.e. Quoted 8 lines
fs/xfs/xfs_log_rlimit.c line 135
Quoted 5 lines
fs/xfs/xfs_log_rlimit.c new file +5
-0+* xlog_grant_head_wait(). +* +* Hence the log size needs to be able to contain two maximally sized +* and padded transactions, which is (2 * (2 * LSU + maxlres)). +* Any thoughts on how we can separate the 2 * log stripe unit from the reservation.
Quoted 4 lines
You can't. The reservation, by definition, is the worse case log space usage for the transaction. Therefore, it has to take into account the LSU padding that may be necessary if this transaction is committed by itself to the log (e.g. wsync operation)
I am thinking we should separate the extra 2*LSU allocated space from the individual pieces of the transaction
Quoted 7 lines
Quoted 3 lines
Why? How are you going to prevent log space deadlocks if we don't reserve that space for each individual transaction in a permanent transaction reservation?
Allocate 2 per transaction, not one per segment of a transaction. It may be a wash for 2 or 3 segments per transaction, but would help if there are 10 segments per transaction.
I'll repeat: The unit reservation used for every commit in a permanent transaction *requires* LSU padding because we don't know ahead of time when it will be required. We can't avoid that worst case behaviour - violating design constraints of the log subsystem because the worst case reservations get large is simply not an option....
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
IOWs, rather than building new, large "aggregation" transactions, we should be adding infrastructure to the CIL to allow atomic transaction aggregation techniques to be used and then just using the existing transaction infrastructure to implement operations such as "create with ACL"....
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
I will have to think on this. I don't see how the allocation of log space for a new transaction while holding locks is a good thing.
Who said anything about requiring new locks? :)
I meant we have to hold the inode locks between the directory code the the attribute code. If we do not, then the attributes quickly become out of line with the directory status.
But why would we need to hold locks atomically across all operations there? The inodes are already locked at that VFS level via i_mutex, so nobody is going to see the newly created/modified inodes in the namespace until we complete the whole create/rename operation, so the only thing we realy need to be concerned about is whether the operations can be recovered in whole or in part.....
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Even if you are creative, the multipliers add up quickly.
xfs_renamewill do the directory ops. possibly a attibset and up to 2 attrrm and we have to hold the src and target inodes locks over all the operations.
Quoted 7 lines
Quoted 3 lines
We don't have to hold them locked across the entire operation because the VFS is holding them locked so nothing else can do a namespace operation which we are modifying them.
I find without holding the lock over both dir and attrib routines that remove occasionally can't find parent pointer attribute entry. I suspect remove racing in rename.
Racing with what? The VFS prevents create/link/unlink/rename races via the i_mutex locking on the parent directories and the vfs_rename_lock....
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 60/60 xfs: Validate log space at mount time
In reply to Dave ChinnerFrom: Jie Liu <[email protected]>
Validate log space during log mount stage, the underlying function will drop a warning message via syslog in critical level if the log space is too small or too large.
[ dchinner: For CRC enable filesystems, abort the mounting of the filesystem as mkfs should never make a log too small for the given filesystem configuration. ]
--- fs/xfs/xfs_log.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-)
fs/xfs/xfs_log.c +48 -1
@@ -614,7 +614,9 @@ xfs_log_mount(xfs_daddr_t blk_offset, int num_bblks) { - int error; + int error = 0; +int min_logfsbs; +int max_logfsbs;if (!(mp->m_flags &XFS_MOUNT_NORECOVERY ))xfs_notice (mp,"Mounting Filesystem" );
@@ -631,6 +633,51 @@ xfs_log_mount( }/* +* Validate the given log space and drop a critical message via syslog +* if the log size is too small that would lead to some unexpected +* situations in transaction log space reservation stage. +* +* Note: we can't just reject the mount if the validation fails. This +* would mean that people would have to downgrade their kernel just to +* remedy the situation as there is no way to grow the log (short of +* black magic surgery with xfs_db). +* +* We can, however, reject mounts for CRC format filesystems, as the +* mkfs binary being used to make the filesystem should never create a +* filesystem with a log that is too small. +*/ + min_logfsbs =xfs_log_calc_minimum_size (mp); + max_logfsbs =XFS_BB_TO_FSB (mp,XFS_MAX_LOG_BLOCKS ); + +if (mp->m_sb.sb_logblocks < min_logfsbs) { +xfs_warn (mp, +"Log size %d blocks too small, minimum size is %d blocks" , + mp->m_sb.sb_logblocks, min_logfsbs); + error =EINVAL ; + }else if (mp->m_sb.sb_logblocks > max_logfsbs) { +xfs_warn (mp, +"Log size %d blocks too large, maximum size is %d blocks" , + mp->m_sb.sb_logblocks, max_logfsbs); + error =EINVAL ; + }else if (XFS_FSB_TO_B (mp, mp->m_sb.sb_logblocks) >XFS_MAX_LOG_BYTES ) { +xfs_warn (mp, +"log size %lld bytes too large, maximum size is %lld bytes" , +XFS_FSB_TO_B (mp, mp->m_sb.sb_logblocks), +XFS_MAX_LOG_BYTES ); + error =EINVAL ; + } +if (error) { +if (xfs_sb_version_hascrc (&mp->m_sb)) { +xfs_crit (mp,"AAIEEE! Log failed size checks. Abort!" ); +ASSERT (0 ); + goto out_free_log; + } +xfs_crit (mp, +"Log size out of supported range. Continuing onwards, but if log hangs are\n" +"experienced then please report this message in the bug report." ); + } + +/* * Initialize the AIL now we have a log. */ error =xfs_trans_ail_init (mp);
Signature · 6 lines
1.7.10.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Hi Dave,
I like this version a lot better from a quick glance.
A few more comments:
- do we really want all that many separate _format.h headers? I'd be really tempted to say we have just a single xfs_format.h header, which should declare everything. It's still not all that large, and it would be a really good start to ease our include mess.
- xfs_extent_ops.c still has that odd _ops.c name I hate because it tends to imply it's an implementation of some ops vector. How about xfs_alloc_util.c to go with the other _util name you added?
- any chance to reorder the inode.c split so that stuff doesn't get move around multiple times?
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 10 lines · Christoph Hellwig
Hi Dave,
I like this version a lot better from a quick glance.
A few more comments:
- do we really want all that many separate
_format.hheaders? I'd be really tempted to say we have just a singlexfs_format.hheader, which should declare everything. It's still not all that large, and it would be a really good start to ease our include mess.
I don't see any problem with doing that, though I would like to keep some of it separate - the dir2 stuff is complex enough that I would like to keep it separate, but stuff like all the log item format headers can be aggregated.
How about we end up with xfs_log_format.h for the log and log item formats, xfs_da_format.h for all the dir2/da/attr format definitions, and xfs_format.h for everything else?
Quoted 3 lines
-
xfs_extent_ops.cstill has that odd_ops.cname I hate because it tends to imply it's an implementation of some ops vector. How aboutxfs_alloc_util.cto go with the other_utilname you added?
Yup, sounds reasonable. sed can sort that one out.
Quoted 2 lines
- any chance to reorder the
inode.csplit so that stuff doesn't get move around multiple times?
I was waiting for that question - I have been considering doing that but I've been putting it off because it is a fair bit of shuffling that I'd have to do from scratch. Sounds like another vote for :redo it"...
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
I don't see any problem with doing that, though I would like to keep some of it separate - the dir2 stuff is complex enough that I would like to keep it separate, but stuff like all the log item format headers can be aggregated.
How about we end up with
xfs_log_format.hfor the log and log item formats,xfs_da_format.hfor all the dir2/da/attr format definitions, andxfs_format.hfor everything else?
Sounds reasonable.
Quoted 7 lines
Quoted 2 lines
- any chance to reorder the
inode.csplit so that stuff doesn't get move around multiple times?I was waiting for that question - I have been considering doing that but I've been putting it off because it is a fair bit of shuffling that I'd have to do from scratch. Sounds like another vote for :redo it"...
Maybe wait for the discussion about having the trans stuff and the separate project quotas to go in before this, as it would mean another big redo..
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Dave,
Quoted 1 line · Dave Chinner
This is my patch queue for 3.11 as it stands right now.
Getting all of this in for 3.11 does not strike me as being realistic. You need to think about how this can be split up. I see that you have rebased Jeff's log size validation patch set after your rearrangement. I'd rather you'd taken Jeff's series first and then made your changes. Now we can't pull in Jeff's work without pulling in a bunch of rearrangement that hasn't been fully discussed. You have also crowded out Chandra's quota work. We had an agreement with him to go for 3.11 with that work which you have broken.
-Ben
Quoted 100 lines
The first 27 patches have been posted previously, and I've addressed these comments directly:
- non-debug static function prblems (Brian)
-agblock_tinxfs-ialloc.c(Brian)
-xfs-dir2_format.hchanges reverted, now included beforexfs_dir2.h(Christoph)
- renamexfs_aops_punch_delalloc_range()(Christoph)The next set of patches then build on this and implement the first part of where the discussions went - the removal of
__KERNEL__from all the XFS code. This generally takes the form of:- split on-disk format definitions into a separate header
- include the header in the original it came from
- share the new header file with userspace
- repeat until all definitions are split out and the only thing is left in the orignal header is #includes and ifdef__KERNEL__sections.
- remove the ifdef__KERNEL__, as this header file is no longer shared with userspace.The same process is done for the .c files, resulting in .c files that contain only kernel code or only code shared with libxfs in userspace.
This has resulted in some less than optimal code locality, mostly to do with
xfs_inode_ops.c. The code is kernel only, and it's in that file because it all related to inode operatianos. However, some are internal core operations, some are interfaces that the VFS inode operations just wrap around, and some are related more closely to inode allocation than anything else. Hence more thought and effort needs to be put into factoring and merging this kernel code back into the most appropriate places, and that is work for a future release.The final part of the patchset is a rebase of Jeff Liu's log size validation patch set. This calculates the minimum size of the log that we should have to guarantee that we don't end up with transactions being too large for the log. This is an issue because mkfs currently doesn't take into account the log stripe unit padding that is necessary when calculating the log size, and this can drive the size of transaction over the maximum size the log can safely support.
This code will warn on existing filesystems at mount time if the log is smaller than the minimum safe size, and for CRC enabled filesystems it will abort immediately as it is expected that you are using a mkfs binary that has this problem fixed.
Overall, there is a lot of code movement in the patch set. The tail of the diffstat looks like:
113 files changed, 14734 insertions(+), 13221 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_bmap_util.c create mode 100644 fs/xfs/xfs_bmap_util.h create mode 100644 fs/xfs/xfs_buf_item_format.h delete mode 100644 fs/xfs/xfs_dfrag.c delete mode 100644 fs/xfs/xfs_dfrag.h create mode 100644 fs/xfs/xfs_dir2_readdir.c create mode 100644 fs/xfs/xfs_dquot_format.h create mode 100644 fs/xfs/xfs_extent_ops.c rename fs/xfs/{xfs_utils.h => xfs_extent_ops.h} (55%) create mode 100644 fs/xfs/xfs_extfree_item_format.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_icreate_item_format.h create mode 100644 fs/xfs/xfs_inode_buf.c create mode 100644 fs/xfs/xfs_inode_buf.h create mode 100644 fs/xfs/xfs_inode_fork.c create mode 100644 fs/xfs/xfs_inode_fork.h create mode 100644 fs/xfs/xfs_inode_item_format.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_log_format.h create mode 100644 fs/xfs/xfs_log_rlimit.c create mode 100644 fs/xfs/xfs_quota_defs.h delete mode 100644 fs/xfs/xfs_rename.c create mode 100644 fs/xfs/xfs_rtalloc_defs.h create mode 100644 fs/xfs/xfs_sb.c create mode 100644 fs/xfs/xfs_symlink_remote.c create mode 100644 fs/xfs/xfs_symlink_remote.h create mode 100644 fs/xfs/xfs_trans_format.h create mode 100644 fs/xfs/xfs_trans_resv.c create mode 100644 fs/xfs/xfs_trans_resv.h delete mode 100644 fs/xfs/xfs_utils.c delete mode 100644 fs/xfs/xfs_vnodeops.c delete mode 100644 fs/xfs/xfs_vnodeops.hWhich should give you an idea of the number of new files that have been added to split out shared userspace code, and hence an idea of how much ofthe diffstat is just moving stuff around. FWIW, this kills about 2000 lines of
__KERNEL__code in header files that is currently exported to userspace. You can see why I'm thinking a kernelfs/xfs/libxfssubdir might be a good idea. :)Comments, flames, etc all welcome.
Quoted 8 lines
Cheers,
Dave.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 5 lines · Ben Myers
Dave,
Quoted 1 line · Dave Chinner
This is my patch queue for 3.11 as it stands right now.
Quoted 7 lines
Getting all of this in for 3.11 does not strike me as being realistic. You need to think about how this can be split up. I see that you have rebased Jeff's log size validation patch set after your rearrangement. I'd rather you'd taken Jeff's series first and then made your changes. Now we can't pull in Jeff's work without pulling in a bunch of rearrangement that hasn't been fully discussed. You have also crowded out Chandra's quota work. We had an agreement with him to go for 3.11 with that work which you have broken.
I think 3.11 is a realistic target for all the code movearound, but maybe not as part of the normal pull request for -rc1. If we make sure it's really moving code around and not changing it I think a sending a second pull request to Linus saying this is just code movearounds we wanted to do when the churn causes least problems with actual code work he should be fine with it.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 13 lines · Christoph Hellwig
Quoted 5 lines · Ben Myers
Quoted 5 lines
Dave,
Quoted 1 line · Dave Chinner
Quoted 1 line
This is my patch queue for 3.11 as it stands right now.
Quoted 7 lines
Quoted 7 lines
Getting all of this in for 3.11 does not strike me as being realistic. You need to think about how this can be split up. I see that you have rebased Jeff's log size validation patch set after your rearrangement. I'd rather you'd taken Jeff's series first and then made your changes. Now we can't pull in Jeff's work without pulling in a bunch of rearrangement that hasn't been fully discussed. You have also crowded out Chandra's quota work. We had an agreement with him to go for 3.11 with that work which you have broken.
Quoted 6 lines
I think 3.11 is a realistic target for all the code movearound, but maybe not as part of the normal pull request for -rc1. If we make sure it's really moving code around and not changing it I think a sending a second pull request to Linus saying this is just code movearounds we wanted to do when the churn causes least problems with actual code work he should be fine with it.
Just to chime in here, we have a lot of resources focused on testing these XFS updates both internally with our QA team and with a range of other RH partners.
I am confident we can shake out any integration concerns in time.
Thanks!
Ric
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Hey Ric,
Quoted 20 lines · Ric Wheeler
Quoted 12 lines · Christoph Hellwig
Quoted 10 lines · Ben Myers
Quoted 10 lines · Dave Chinner
Quoted 1 line
Quoted 1 line
This is my patch queue for 3.11 as it stands right now.
Getting all of this in for 3.11 does not strike me as being realistic. You need to think about how this can be split up. I see that you have rebased Jeff's log size validation patch set after your rearrangement. I'd rather you'd taken Jeff's series first and then made your changes. Now we can't pull in Jeff's work without pulling in a bunch of rearrangement that hasn't been fully discussed. You have also crowded out Chandra's quota work. We had an agreement with him to go for 3.11 with that work which you have broken.
Quoted 6 lines
I think 3.11 is a realistic target for all the code movearound, but maybe not as part of the normal pull request for -rc1. If we make sure it's really moving code around and not changing it I think a sending a second pull request to Linus saying this is just code movearounds we wanted to do when the churn causes least problems with actual code work he should be fine with it.
Quoted 3 lines
Just to chime in here, we have a lot of resources focused on testing these XFS updates both internally with our QA team and with a range of other RH partners.
This isn't about the size of your QA team or the number of other RH partners.
We had an agreement with Chandra to work toward getting his quota work in 3.11 and it appears that Dave has crowded him out with a rearrangement of code which we had no agreement would go into 3.11. Further, Dave has taken Jeff's log size validation series hostage by rebasing it on top of this rearrangement of code.
If there is a strategic reason that RH needs to have the kernel/libxfs code rearranged and separated in 3.11 I would have liked to have heard about it before now. I'm all for getting this work done, but not at the expense of crowding out other XFS contributors.
-Ben
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 27 lines · Ben Myers
Hey Ric,
Quoted 20 lines · Ric Wheeler
Quoted 12 lines · Christoph Hellwig
Quoted 10 lines · Ben Myers
Quoted 10 lines · Dave Chinner
Quoted 1 line
Quoted 1 line
This is my patch queue for 3.11 as it stands right now.
Getting all of this in for 3.11 does not strike me as being realistic. You need to think about how this can be split up. I see that you have rebased Jeff's log size validation patch set after your rearrangement. I'd rather you'd taken Jeff's series first and then made your changes. Now we can't pull in Jeff's work without pulling in a bunch of rearrangement that hasn't been fully discussed. You have also crowded out Chandra's quota work. We had an agreement with him to go for 3.11 with that work which you have broken.
Quoted 6 lines
I think 3.11 is a realistic target for all the code movearound, but maybe not as part of the normal pull request for -rc1. If we make sure it's really moving code around and not changing it I think a sending a second pull request to Linus saying this is just code movearounds we wanted to do when the churn causes least problems with actual code work he should be fine with it.
Quoted 3 lines
Just to chime in here, we have a lot of resources focused on testing these XFS updates both internally with our QA team and with a range of other RH partners.
Quoted 5 lines
This isn't about the size of your QA team or the number of other RH partners.
We had an agreement with Chandra to work toward getting his quota work in 3.11 and it appears that Dave has crowded him out with a rearrangement of code which we had no agreement would go into 3.11.
What I posted is what I'm *proposing* for 3.11. You can't have an agreement with first having a proposal....
Quoted 3 lines
Further, Dave has taken Jeff's log
size validation series hostage by rebasing it on top of this rearrangement of code.
Ben, I think you're being a little melodramatic here. I asked Jeff if it was OK to rebase his patchset, and he said that was fine:
http://oss.sgi.com/pipermail/xfs/2013-June/027270.html
You don't have to take my rebase of Jeff's patches - you're welcome to take them direct from Jeff, but then I'll have to send reviews asking for changes to problems I found when integrating it so that's going to delay any integration you can do of that series. Please let Jeff and myself know what you want to do here...
Quoted 4 lines
If there is a strategic reason that RH needs to have the kernel/libxfs code rearranged and separated in 3.11 I would have liked to have heard about it before now. I'm all for getting this work done, but not at the expense of crowding out other XFS contributors.
You are making a mountain out of a molehill. I had an itch, and I scratched it. Simple as that. It is only a couple of days work.
If you think it's too much for 3.11, then just say so and leave it at that. I'll move it to my for-3.12 queue and you won't see it again until after 3.11-rc1 is released...
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Hey Dave,
Quoted 50 lines · Dave Chinner
Quoted 25 lines · Ben Myers
Quoted 20 lines · Ric Wheeler
Quoted 12 lines · Christoph Hellwig
Quoted 10 lines · Ben Myers
Quoted 10 lines · Dave Chinner
Quoted 1 line
Quoted 1 line
This is my patch queue for 3.11 as it stands right now.
Getting all of this in for 3.11 does not strike me as being realistic. You need to think about how this can be split up. I see that you have rebased Jeff's log size validation patch set after your rearrangement. I'd rather you'd taken Jeff's series first and then made your changes. Now we can't pull in Jeff's work without pulling in a bunch of rearrangement that hasn't been fully discussed. You have also crowded out Chandra's quota work. We had an agreement with him to go for 3.11 with that work which you have broken.
Quoted 6 lines
I think 3.11 is a realistic target for all the code movearound, but maybe not as part of the normal pull request for -rc1. If we make sure it's really moving code around and not changing it I think a sending a second pull request to Linus saying this is just code movearounds we wanted to do when the churn causes least problems with actual code work he should be fine with it.
Quoted 3 lines
Just to chime in here, we have a lot of resources focused on testing these XFS updates both internally with our QA team and with a range of other RH partners.
Quoted 5 lines
This isn't about the size of your QA team or the number of other RH partners.
We had an agreement with Chandra to work toward getting his quota work in 3.11 and it appears that Dave has crowded him out with a rearrangement of code which we had no agreement would go into 3.11.
What I posted is what I'm *proposing* for 3.11. You can't have an agreement with first having a proposal....
Quoted 3 lines
Further, Dave has taken Jeff's log
size validation series hostage by rebasing it on top of this rearrangement of code.Ben, I think you're being a little melodramatic here. I asked Jeff if it was OK to rebase his patchset, and he said that was fine:
http://oss.sgi.com/pipermail/xfs/2013-June/027270.html
You don't have to take my rebase of Jeff's patches - you're welcome to take them direct from Jeff, but then I'll have to send reviews asking for changes to problems I found when integrating it so that's going to delay any integration you can do of that series. Please let Jeff and myself know what you want to do here...
Quoted 7 lines
Quoted 4 lines
If there is a strategic reason that RH needs to have the kernel/libxfs code rearranged and separated in 3.11 I would have liked to have heard about it before now. I'm all for getting this work done, but not at the expense of crowding out other XFS contributors.
You are making a mountain out of a molehill. I had an itch, and I scratched it. Simple as that. It is only a couple of days work.
You jumped the queue in front of the other cars. I'm asking you not to do that, even if one of the drivers was kind enough to let you in.
Quoted 3 lines
If you think it's too much for 3.11, then just say so and leave it at that. I'll move it to my for-3.12 queue and you won't see it again until after 3.11-rc1 is released...
Lets see where Chandra is at with his quota work. If he has already rebased on top of your series I don't see a good reason to rearrange things now. If he hasn't, I'd like focus on getting his code merged before pulling in your rearrangement. Now that you've rebased Jeff's work, I don't see much point in redoing that, so maybe that will have to wait for the rearrangement to get merged.
For now we'll focus on the first 13 patches.
Thanks,
Ben
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 64 lines · Ben Myers
Hey Dave,
Quoted 50 lines · Dave Chinner
Quoted 25 lines · Ben Myers
Quoted 20 lines · Ric Wheeler
Quoted 12 lines · Christoph Hellwig
Quoted 10 lines · Ben Myers
Quoted 10 lines · Dave Chinner
Quoted 1 line
Quoted 1 line
This is my patch queue for 3.11 as it stands right now.
Getting all of this in for 3.11 does not strike me as being realistic. You need to think about how this can be split up. I see that you have rebased Jeff's log size validation patch set after your rearrangement. I'd rather you'd taken Jeff's series first and then made your changes. Now we can't pull in Jeff's work without pulling in a bunch of rearrangement that hasn't been fully discussed. You have also crowded out Chandra's quota work. We had an agreement with him to go for 3.11 with that work which you have broken.
Quoted 6 lines
I think 3.11 is a realistic target for all the code movearound, but maybe not as part of the normal pull request for -rc1. If we make sure it's really moving code around and not changing it I think a sending a second pull request to Linus saying this is just code movearounds we wanted to do when the churn causes least problems with actual code work he should be fine with it.
Quoted 3 lines
Just to chime in here, we have a lot of resources focused on testing these XFS updates both internally with our QA team and with a range of other RH partners.
Quoted 5 lines
This isn't about the size of your QA team or the number of other RH partners.
We had an agreement with Chandra to work toward getting his quota work in 3.11 and it appears that Dave has crowded him out with a rearrangement of code which we had no agreement would go into 3.11.
What I posted is what I'm *proposing* for 3.11. You can't have an agreement with first having a proposal....
Quoted 3 lines
Further, Dave has taken Jeff's log
size validation series hostage by rebasing it on top of this rearrangement of code.Ben, I think you're being a little melodramatic here. I asked Jeff if it was OK to rebase his patchset, and he said that was fine:
http://oss.sgi.com/pipermail/xfs/2013-June/027270.html
You don't have to take my rebase of Jeff's patches - you're welcome to take them direct from Jeff, but then I'll have to send reviews asking for changes to problems I found when integrating it so that's going to delay any integration you can do of that series. Please let Jeff and myself know what you want to do here...
Quoted 7 lines
Quoted 4 lines
If there is a strategic reason that RH needs to have the kernel/libxfs code rearranged and separated in 3.11 I would have liked to have heard about it before now. I'm all for getting this work done, but not at the expense of crowding out other XFS contributors.
You are making a mountain out of a molehill. I had an itch, and I scratched it. Simple as that. It is only a couple of days work.
You jumped the queue in front of the other cars. I'm asking you not to do that, even if one of the drivers was kind enough to let you in.
Quoted 6 lines
Quoted 3 lines
If you think it's too much for 3.11, then just say so and leave it at that. I'll move it to my for-3.12 queue and you won't see it again until after 3.11-rc1 is released...
Lets see where Chandra is at with his quota work. If he has already rebased on top of your series I don't see a good reason to rearrange things now. If he
No, I haven't rebased on top of Dave's patches. I will post my patchset by EOD today.
Quoted 7 lines
hasn't, I'd like focus on getting his code merged before pulling in your rearrangement. Now that you've rebased Jeff's work, I don't see much point in redoing that, so maybe that will have to wait for the rearrangement to get merged.
For now we'll focus on the first 13 patches.
Quoted 8 lines
Thanks,
Ben_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 7 lines · Ben Myers
Dave,
Quoted 1 line · Dave Chinner
This is my patch queue for 3.11 as it stands right now.
Getting all of this in for 3.11 does not strike me as being realistic.
Why not? We've done more complex changes in the past...
Quoted 1 line
You need to think about how this can be split up.
Sure - the first 27 patches at the necessary ones for 3.11.
Quoted 6 lines
I
see that you have rebased Jeff's log size validation patch set after your rearrangement. I'd rather you'd taken Jeff's series first and then made your changes. Now we can't pull in Jeff's work without pulling in a bunch of rearrangement that hasn't been fully discussed.
Sure, but Jeff's work hadn't been reviewed or QA'd by anyone else, so what's the problem? If the Maintainers had their job that a month ago when Jeff posted the patches, then this wouldn't be an issue as my patchset would now be based on top of it.
You're welcome to go review, test and integrate Jeff's patchset before mine - I'll just have to rebase my patchset.
Quoted 2 lines
You have also crowded out Chandra's quota work. We had an agreement with him to go for 3.11 with that work which you have broken.
You're blaming me for the fact the Maintainers haven't reviewed and integrated Chandra's latest quota patchset that was posted 6 weeks ago?
Feel free to get Chandra to repost the patchset and review and integrate it before taking any of my changes. I'll just rebase my patchset on top of whatever ends up in the XFS tree....
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 6 lines · Dave Chinner
Quoted 5 lines · Ben Myers
Dave,
Quoted 1 line · Dave Chinner
This is my patch queue for 3.11 as it stands right now.
Quoted 8 lines
Quoted 2 lines
Getting all of this in for 3.11 does not strike me as being realistic.
Why not? We've done more complex changes in the past...
Quoted 1 line
You need to think about how this can be split up.
Sure - the first 27 patches at the necessary ones for 3.11.
Actaully if you really concerned about how little time you have left before the next merge window opens, then just concentrate on the first 13 patches (i.e. up to the local format fork extent handling change for xfs_write_bmapi).
I'm about to rework the series based on the log_format/da_format/format split that I suggested in reponse to Christoph's comments and also to avoid creating xfs_inode_ops.[ch]. If I get that done this afternoon, I'll repost it all for you....
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs