summaryrefslogtreecommitdiffstats
path: root/fs
Commit message (Collapse)AuthorAgeFilesLines
* udf: Fix bug in VAT mapping codeSebastian Manciulea2008-04-172-5/+4Star
| | | | | | | | | Fix mapping of blocks using VAT when it is stored in an inode. UDF_I(inode)->i_data already points to the beginning of VAT header so there's no need to add udf_ext0_offset(inode). Signed-off-by: Sebastian Manciulea <manciuleas@yahoo.com> Signed-off-by: Jan Kara <jack@suse.cz>
* udf: Add read-only support for 2.50 UDF mediaJan Kara2008-04-175-14/+258
| | | | | | | | | | | | This patch implements parsing of metadata partitions and reading of Metadata File thus allowing to read UDF 2.50 media. Error resilience is implemented through accessing the Metadata Mirror File in case the data the Metadata File cannot be read. The patch is based on the original patch by Sebastian Manciulea <manciuleas@yahoo.com> and Mircea Fedoreanu <mirceaf_spl@yahoo.com>. Signed-off-by: Sebastian Manciulea <manciuleas@yahoo.com> Signed-off-by: Mircea Fedoreanu <mirceaf_spl@yahoo.com> Signed-off-by: Jan Kara <jack@suse.cz>
* udf: Fix handling of multisession mediaSebastian Manciulea2008-04-172-9/+6Star
| | | | | | | | | | According to OSTA UDF specification, only anchor blocks and primary volume descriptors are placed on media relative to the last session. All other block numbers are absolute (in the partition or the whole media). This seems to be confirmed by multisession media created by other systems. Signed-off-by: Sebastian Manciulea <manciuleas@yahoo.com> Signed-off-by: Jan Kara <jack@suse.cz>
* udf: Mount filesystem read-only if it has pseudooverwrite partitionJan Kara2008-04-171-0/+8
| | | | | | | | As we don't properly support writing to pseudooverwrite partition (we should add entries to VAT and relocate blocks instead of just writing them), mount filesystems with such partition as read-only. Signed-off-by: Jan Kara <jack@suse.cz>
* udf: Handle VAT packed inside inode properlyJan Kara2008-04-172-12/+22
| | | | | | | | We didn't handle VAT packed inside the inode - we tried to call udf_block_map() on such file which lead to strange results at best. Add proper handling of packed VAT as we do it with other packed files. Signed-off-by: Jan Kara <jack@suse.cz>
* udf: Allow loading of VAT inodeJan Kara2008-04-171-0/+1
| | | | | | | UDF media with VAT could have never worked because udf_fill_inode() didn't know about case FILE_TYPE_VAT20. Fix this. Signed-off-by: Jan Kara <jack@suse.cz>
* udf: Fix detection of VAT versionJan Kara2008-04-171-2/+2
| | | | | | | | We incorrectly (way to strictly) checked version of VAT on loading and thus refuse to mount correct media. There are just two format versions - below 2.0 and above 2.0 and we understand both. So update the version check accordingly. Signed-off-by: Jan Kara <jack@suse.cz>
* udf: Silence warning about accesses beyond end of deviceJan Kara2008-04-171-1/+5
| | | | | | | Some of the computed positions of anchor block could be beyond the end of device. Skip reading such blocks. Signed-off-by: Jan Kara <jack@suse.cz>
* udf: Improve anchor block detectionJan Kara2008-04-171-4/+9
| | | | | | | | | Add <last block>+1 and <last block>-1 to a list of blocks which can be the real last recorded block on a UDF media. Sebastian Manciulea <manciuleas@yahoo.com> claims this helps some drive + media combinations he is able to test. Signed-off-by: Jan Kara <jack@suse.cz>
* udf: Cleanup anchor block detection.Jan Kara2008-04-172-142/+99Star
| | | | | | | | | | | | | | UDF anchor block detection is complicated by several things - there are several places where the anchor point can be, some of them relative to the last recorded block which some devices report wrongly. Moreover some devices on some media seem to have 7 spare blocks sectors for every 32 blocks (at least as far as I understand the old code) so we have to count also with that possibility. This patch splits anchor block detection into several functions so that it is clearer what we actually try to do. We fix several bugs of the type "for such and such media, we fail to check block blah" as a result of the cleanup. Signed-off-by: Jan Kara <jack@suse.cz>
* udf: Move processing of virtual partitionsJan Kara2008-04-171-80/+85
| | | | | | | | This patch move processing of UDF virtual partitions close to the place where other partition types are processed. As a result we now also properly fill in partition access type. Signed-off-by: Jan Kara <jack@suse.cz>
* udf: Move filling of partition descriptor info into a separate functionJan Kara2008-04-171-56/+62
| | | | Signed-off-by: Jan Kara <jack@suse.cz>
* udf: Improve error recovery on mountJan Kara2008-04-171-44/+42Star
| | | | | | | | Report error when we fail to allocate memory for a bitmap and properly release allocated memory and inodes for all the partitions in case of mount failure and umount. Signed-off-by: Jan Kara <jack@suse.cz>
* udf: Cleanup volume descriptor sequence processingJan Kara2008-04-171-54/+81
| | | | | | | Cleanup processing of volume descriptor sequence so that it is more readable, make code handle errors (e.g. media problems) better. Signed-off-by: Jan Kara <jack@suse.cz>
* udf: fix anchor point detectionPavel Emelyanov2008-04-171-9/+6Star
| | | | | | | | | | | | | | | | | | | | | | | According to ECMA 167 rev. 3 (see 3/8.4.2.1), Anchor Volume Descriptor Pointer should be recorded at two or more anchor points located at sectors 256, N, N - 256, where N - is a largest logical sector number at volume space. So we should always try to detect N on UDF volume before trying to find Anchor Volume Descriptor (i.e. calling to udf_find_anchor()). That said, all this patch does is updates the s_last_block even if the udf_vrs() returns positive value. Originally written and tested by Yuri Per, ported on latest mainline by me. Signed-off-by: Yuri Per <Yuri.Per@acronis.com> Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Cc: Max Lyadvinsky <Max.Lyadvinsky@acronis.com> Cc: Vladimir Simonov <Vladimir.Simonov@acronis.com> Cc: Andrew Neporada <Andrew.Neporada@acronis.com> Cc: Kirill Korotaev <dev@openvz.org> Signed-off-by: Jan Kara <jack@suse.cz>
* udf: Remove declarations of arrays of size UDF_NAME_LEN (256 bytes)Jan Kara2008-04-172-92/+93
| | | | | | | | | There are several places in UDF where we declared temporary arrays of UDF_NAME_LEN bytes on stack. This is not nice to stack usage so this patch changes those places to use kmalloc() instead. Also clean up bail-out paths in those functions when we are changing them. Signed-off-by: Jan Kara <jack@suse.cz>
* udf: Remove checking of existence of filename in udf_add_entry()Jan Kara2008-04-171-37/+1Star
| | | | | | | | We don't have to check whether a directory entry already exists in a directory when creating a new one since we've already checked that earlier by lookup and we are holding directory i_mutex all the time. Signed-off-by: Jan Kara <jack@suse.cz>
* udf: Mark udf_process_sequence() as noinlineJan Kara2008-04-171-1/+1
| | | | | | | Mark udf_process_sequence() as noinline since stack usage is terrible otherwise. Signed-off-by: Jan Kara <jack@suse.cz>
* udf: super.c reorganizationMarcin Slusarz2008-04-171-282/+270Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | reorganize few code blocks in super.c which were needlessly indented (and hard to read): so change from: rettype fun() { init; if (sth) { long block of code; } } to: rettype fun() { init; if (!sth) return; long block of code; } or from: rettype fun2() { init; while (sth) { init2(); if (sth2) { long block of code; } } } to: rettype fun2() { init; while (sth) { init2(); if (!sth2) continue; long block of code; } } Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
* udf: remove unneeded kernel_timestamp typeMarcin Slusarz2008-04-173-39/+5Star
| | | | | | | remove now unneeded kernel_timestamp type with conversion functions Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
* udf: convert udf_stamp_to_time and udf_time_to_stamp to use timestampsMarcin Slusarz2008-04-174-53/+41Star
| | | | | | | | | | | | * kernel_timestamp type was almost unused - only callers of udf_stamp_to_time and udf_time_to_stamp used it, so let these functions handle endianness internally and don't clutter code with conversions * rename udf_stamp_to_time to udf_disk_stamp_to_time and udf_time_to_stamp to udf_time_to_disk_stamp Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
* udf: convert udf_stamp_to_time to return struct timespecmarcin.slusarz@gmail.com2008-04-174-42/+37Star
| | | | | Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
* udf: create function for conversion from timestamp to timespecmarcin.slusarz@gmail.com2008-04-171-56/+23Star
| | | | | Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
* udf: udf_get_block, inode_bmap - remove unneeded checksmarcin.slusarz@gmail.com2008-04-171-12/+0Star
| | | | | | | | block cannot be less than 0, because it's sector_t, so remove unneeded checks Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
* udf: convert udf_count_free_bitmap to use bitmap_weightMarcin Slusarz2008-04-171-12/+5Star
| | | | | | | replace handwritten bits counting with bitmap_weight Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
* udf: replace udf_*_offset macros with functionsmarcin.slusarz@gmail.com2008-04-172-12/+21
| | | | | | | | | - translate udf_file_entry_alloc_offset macro into function - translate udf_ext0_offset macro into function - add comment about crypticly named fields in struct udf_inode_info Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
* udf: simplify __udf_read_inodemarcin.slusarz@gmail.com2008-04-171-29/+23Star
| | | | | | | | | - move all brelse(ibh) after main if, because it's called on every path except one where ibh is null - move variables to the most inner blocks Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
* udf: replace all adds to little endians variables with le*_add_cpumarcin.slusarz@gmail.com2008-04-173-29/+12Star
| | | | | | | | | | | | replace all: little_endian_variable = cpu_to_leX(leX_to_cpu(little_endian_variable) + expression_in_cpu_byteorder); with: leX_add_cpu(&little_endian_variable, expression_in_cpu_byteorder); sparse didn't generate any new warning with this patch Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com Signed-off-by: Jan Kara <jack@suse.cz>
* udf: truncate: create function for updating of Allocation Ext Descriptormarcin.slusarz@gmail.com2008-04-171-33/+23Star
| | | | | | Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Cc: Jan Kara <jack@suse.cz> Signed-off-by: Jan Kara <jack@suse.cz>
* udf: simple cleanup of truncate.cmarcin.slusarz@gmail.com2008-04-171-42/+34Star
| | | | | | | | - remove one indentation level by little code reorganization - convert "if (smth) BUG();" to "BUG_ON(smth);" Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
* udf: constify crcmarcin.slusarz@gmail.com2008-04-172-3/+3
| | | | | | | | - constify internal crc table - mark udf_crc "in" parameter as const Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
* udf: udf_CS0toNLS cleanupmarcin.slusarz@gmail.com2008-04-171-11/+8Star
| | | | | | | | | - fix error handling - always zero output variable - don't zero explicitely fields zeroed by memset - mark "in" paramater as const Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
* udf: fix udf_build_ustrMarcin Slusarz2008-04-171-5/+7
| | | | | | | | | | | | | | | | | | | | | | | udf_build_ustr was broken: - size == 1: dest->u_len = ptr[1 - 1], but at ptr[0] there's cmpID, so we created string with wrong length it should not happen, so we BUG() it - size > 1 and size < UDF_NAME_LEN: we set u_len correctly, but memcpy copied one needless byte - size == UDF_NAME_LEN - 1: memcpy overwrited u_len - with correct value, but... - size >= UDF_NAME_LEN: we copied UDF_NAME_LEN - 1 bytes, but dest->u_name is array of UDF_NAME_LEN - 2 bytes, so we were overwriting u_len with character from input string nobody noticed because all callers set size to acceptable values (constants within range) Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
* udf: udf_CS0toUTF8 cleanupmarcin.slusarz@gmail.com2008-04-172-18/+11Star
| | | | | | | | | | - fix error handling - always zero output variable - don't zero explicitely fields zeroed by memset - mark "in" paramater as const - remove outdated comment Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
* make udf_error() staticAdrian Bunk2008-04-172-3/+4
| | | | | | | This patch makes the needlessly global udf_error() static. Signed-off-by: Adrian Bunk <bunk@kernel.org> Signed-off-by: Jan Kara <jack@suse.cz>
* fs/udf: Use DIV_ROUND_UPJulia Lawall2008-04-171-4/+3Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The kernel.h macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) / (d)) but is perhaps more readable. An extract of the semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // <smpl> @haskernel@ @@ #include <linux/kernel.h> @depends on haskernel@ expression n,d; @@ ( - (n + d - 1) / d + DIV_ROUND_UP(n,d) | - (n + (d - 1)) / d + DIV_ROUND_UP(n,d) ) @depends on haskernel@ expression n,d; @@ - DIV_ROUND_UP((n),d) + DIV_ROUND_UP(n,d) @depends on haskernel@ expression n,d; @@ - DIV_ROUND_UP(n,(d)) + DIV_ROUND_UP(n,d) // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Jan Kara <jack@suse.cz>
* udf: move headers out include/linux/Christoph Hellwig2008-04-1712-16/+141
| | | | | | | | | | | | | | | | There's really no reason to keep udf headers in include/linux as they're not used by anything but fs/udf/. This patch merges most of include/linux/udf_fs_i.h into fs/udf/udf_i.h, include/linux/udf_fs_sb.h into fs/udf/udf_sb.h and include/linux/udf_fs.h into fs/udf/udfdecl.h. The only thing remaining in include/linux/ is a stub of udf_fs_i.h defining the four user-visible udf ioctls. It's also moved from unifdef-y to headers-y because it can be included unconditionally now. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz>
* udf: kill useless file header comments for vfs method implementationsChristoph Hellwig2008-04-175-178/+1Star
| | | | | | | | | | There's not need to document vfs method invocation rules, we have Documentation/filesystems/vfs.txt and Documentation/filesystems/Locking for that. Also a lot of these comments where either plain wrong or horrible out of date. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz>
* udf: kill udf_set_blocksizeChristoph Hellwig2008-04-171-39/+4Star
| | | | | | | | | This helper has been quite useless since sb_min_blocksize was introduced and is misnamed while we're at it. Just opencode the few lines in the caller instead. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz>
* [XFS] If you mount an XFS filesystem with no mount options at all, thenJosef Jeff Sipek2008-02-295-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the "ikeep" option is set rather than "noikeep". This regression was introduced in 970451. With no mount options specified, xfs_parseargs() does the following: int ikeep = 0; args->flags |= XFSMNT_BARRIER; args->flags2 |= XFSMNT2_COMPAT_IOSIZE; if (!options) goto done; It only sets the above two options by default and before, it also used to set XFSMNT_IDELETE by default. If options are specified, then if (!(args->flags & XFSMNT_DMAPI) && !ikeep) args->flags |= XFSMNT_IDELETE; is executed later on which is skipped by the "goto done;" above. The solution is to invert the logic. SGI-PV: 977771 SGI-Modid: xfs-linux-melb:xfs-kern:30590a Signed-off-by: Niv Sardi <xaiki@sgi.com> Signed-off-by: Barry Naujok <bnaujok@sgi.com> Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net> Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
* Merge branch 'for-linus' of git://oss.sgi.com:8090/xfs/xfs-2.6Linus Torvalds2008-02-263-29/+120
|\ | | | | | | | | | | | | * 'for-linus' of git://oss.sgi.com:8090/xfs/xfs-2.6: [XFS] Undo bit ops cleanup mod due to regression on 32-bit powermac [XFS] Undo bit ops cleanup mod due to regression on 32-bit powermac Remove empty file fs/xfs/Makefile-linux-2.6.
| * [XFS] Undo bit ops cleanup mod due to regression on 32-bit powermacLachlan McIlroy2008-02-263-29/+120
| | | | | | | | | | | | | | | | | | platform. SGI-PV: 971186 SGI-Modid: xfs-linux-melb:xfs-kern:30559a Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
| * [XFS] Undo bit ops cleanup mod due to regression on 32-bit powermacLachlan McIlroy2008-02-261-4/+4
| | | | | | | | | | | | | | | | | | platform. SGI-PV: 974005 SGI-Modid: xfs-linux-melb:xfs-kern:30558a Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
* | Merge branch 'for_linus' of ↵Linus Torvalds2008-02-268-67/+176
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4 * 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: ext4: add missing ext4_journal_stop() ext4: ext4_find_next_zero_bit needs an aligned address on some arch ext4: set EXT4_EXTENTS_FL only for directory and regular files ext4: Don't mark filesystem error if fallocate fails ext4: Fix BUG when writing to an unitialized extent ext4: Don't use ext4_dec_count() if not needed ext4: modify block allocation algorithm for the last group ext4: Don't claim block from group which has corrupt bitmap ext4: Get journal write access before modifying the extent tree ext4: Fix memory and buffer head leak in callers to ext4_ext_find_extent() ext4: Don't leave behind a half-created inode if ext4_mkdir() fails ext4: Fix kernel BUG at fs/ext4/mballoc.c:910! ext4: Fix locking hierarchy violation in ext4_fallocate() Remove incorrect BKL comments in ext4
| * | ext4: add missing ext4_journal_stop()Akinobu Mita2008-02-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add missing ext4_journal_stop() in error handling. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Cc: Stephen Tweedie <sct@redhat.com> Cc: adilger@clusterfs.com Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Mingming Cao <cmm@us.ibm.com>
| * | ext4: ext4_find_next_zero_bit needs an aligned address on some archAneesh Kumar K.V2008-02-231-22/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ext4_find_next_zero_bit and ext4_find_next_bit needs a long aligned address on x8_64. Add mb_find_next_zero_bit and mb_find_next_bit and use them in the mballoc. Fix: https://bugzilla.redhat.com/show_bug.cgi?id=433286 Eric Sandeen debugged the problem and suggested the fix. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Acked-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Mingming Cao <cmm@us.ibm.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
| * | ext4: set EXT4_EXTENTS_FL only for directory and regular filesAneesh Kumar K.V2008-02-252-8/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In addition, don't inherit EXT4_EXTENTS_FL from parent directory. If we have a directory with extent flag set and later mount the file system with -o noextents, the files created in that directory will also have extent flag set but we would not have called ext4_ext_tree_init for them. This will cause error later when we are verifying the extent header Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Acked-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Mingming Cao <cmm@us.ibm.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
| * | ext4: Don't mark filesystem error if fallocate failsAneesh Kumar K.V2008-02-251-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | If we fail to allocate blocks don't call ext4_error. Also don't hide errors from ext4_get_blocks_wrap Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
| * | ext4: Fix BUG when writing to an unitialized extentMingming Cao2008-02-252-3/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes a bug when writing to preallocated but uninitialized blocks, which resulted in a BUG in fs/buffer.c saying that the buffer is not mapped. When writing to a file, ext4_get_block_wrap() is called with create=1 in order to request that blocks be allocated if necessary. It currently calls ext4_get_blocks() with create=0 in order to do a lookup first. If the inode contains an unitialized data block, the buffer head is left unampped, which ext4_get_blocks_wrap() returns, causing the BUG. We fix this by checking to see if the buffer head is unmapped, and if so, we make sure the the buffer head is mapped by calling ext4_ext_get_blocks with create=1. Signed-off-by: Mingming Cao <cmm@us.ibm.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
| * | ext4: Don't use ext4_dec_count() if not neededTheodore Ts'o2008-02-151-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ext4_dec_count() function is only needed when dropping the i_nlink count on inodes which are (or which could be) directories. If we *know* that the inode in question can't possibly be a directory, use drop_nlink or clear_nlink() if we know i_nlink is 1. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>