24 Jun, 2020
1 commit
-
Move the struct block_device definition together with most of the
block layer definitions, as it has nothing to do with the rest of fs.h.Signed-off-by: Christoph Hellwig
Signed-off-by: Jens Axboe
21 Apr, 2020
1 commit
-
Some filesystem references got broken by a previous patch
series I submitted. Address those.Signed-off-by: Mauro Carvalho Chehab
Acked-by: David Sterba # fs/affs/Kconfig
Link: https://lore.kernel.org/r/57318c53008dbda7f6f4a5a9e5787f4d37e8565a.1586881715.git.mchehab+huawei@kernel.org
Signed-off-by: Jonathan Corbet
26 Jan, 2020
1 commit
-
This code accidentally returns success, but it should return the
-EIO error code from adfs_fplus_validate_header().Acked-by: Russell King
Fixes: d79288b4f61b ("fs/adfs: bigdir: calculate and validate directory checkbyte")
Signed-off-by: Dan Carpenter
Signed-off-by: Al Viro
21 Jan, 2020
37 commits
-
Avoid using the inode number as the indirect disc address, even though
these currently have the same value.Signed-off-by: Russell King
Signed-off-by: Al Viro -
Add support for ADFS E and E+ floppy image formats, which, unlike their
hard disk variants, do not have a filesystem boot block - they have a
single map zone, with the map fragment stored at sector 0.Signed-off-by: Russell King
Signed-off-by: Al Viro -
Separate the filesystem block probing from the superblock filling so
we can support other ADFS filesystem formats, such as the single-zone
E and E+ floppy image formats which do not have a boot block.Signed-off-by: Russell King
Signed-off-by: Al Viro -
Remove the noisy debug in adfs_dir_update().
Signed-off-by: Russell King
Signed-off-by: Al Viro -
When we have write support enabled, we must not drop inodes before they
have been written back, otherwise we lose updates to the filesystem on
umount. Keep the inodes around unless we are built in read-only mode,
or we are mounted read-only.Signed-off-by: Russell King
Signed-off-by: Al Viro -
Implement big directory entry update support in the same way that we
do for new directories.Signed-off-by: Russell King
Signed-off-by: Al Viro -
When reading a big directory, calculate the validate the directory
checkbyte to ensure that the directory contents are valid.Signed-off-by: Russell King
Signed-off-by: Al Viro -
Strengthen the directory validation by ensuring that the header fields
contain sensible values that fit inside the directory, and limit the
directory size to 4MB as per RISC OS requirements.Signed-off-by: Russell King
Signed-off-by: Al Viro -
Extract the directory validation from the directory reading function as
we will want to re-use this code.Signed-off-by: Russell King
Signed-off-by: Al Viro -
Factor out the directory entry byte offset calculation.
Signed-off-by: Russell King
Signed-off-by: Al Viro -
After changing a directory, we need to update the sequence numbers and
calculate the new check byte before the directory is scheduled to be
written back to the media. Since this needs to happen for any change
to the directory, move this into a separate method.Signed-off-by: Russell King
Signed-off-by: Al Viro -
__adfs_dir_put() and adfs_dir_find_entry() are only called from
adfs_f_update(), so move them into this function, removing some
unnecessary entry copying by doing so.Signed-off-by: Russell King
Signed-off-by: Al Viro -
adfs_dir_read() is only called from adfs_f_read(), so merge it into
that function. As new directories are always 2048 bytes in size,
(which we rely on elsewhere) we can consolidate some of the code.Signed-off-by: Russell King
Signed-off-by: Al Viro -
Check that the lastmask and reserved fields are all zero, as per the
documentation.Signed-off-by: Russell King
Signed-off-by: Al Viro -
We have two locations where we validate the new directory format, so
factor this out to a helper.Signed-off-by: Russell King
Signed-off-by: Al Viro -
Add and use pointers in the adfs_dir structure to access the directory
head and tail structures, which will always be contiguous in a buffer.
This allows us to avoid memcpy()ing the data in the new directory code,
making it slightly more efficient.Signed-off-by: Russell King
Signed-off-by: Al Viro -
Rather than using setpos + getnext to iterate through the directory
entries, pass iterate() down to the dir format code to populate the
dirents.Signed-off-by: Russell King
Signed-off-by: Al Viro -
There is nothing in our readdir (aka iterate) method that relies on
the directory inode being exclusively locked, so switch to using the
iterate_shared() hook rather than iterate().Signed-off-by: Russell King
Signed-off-by: Al Viro -
Get rid of the ifdef, using IS_ENABLED() instead to detect whether the
code should be callable. This allows the compiler to always parse the
following code, reducing the chances of errors being missed.Signed-off-by: Russell King
Signed-off-by: Al Viro -
When we update a directory, a number of errors may happen. If we failed
to find the entry to update, we can just release the directory buffers
as normal.However, if we have some other error, we may have partially updated the
buffers, resulting in an invalid directory. In this case, we need to
discard the buffers to avoid writing the contents back to the media, and
later re-read the directory from the media.Signed-off-by: Russell King
Signed-off-by: Al Viro -
Use __u8 and pack the structures for on-disk directories.
Signed-off-by: Russell King
Signed-off-by: Al Viro -
Update directory locking such that it covers the validation of the
directory, which could fail if another thread is concurrently writing
to the same directory. Since we may sleep, we need to use a rwsem
rather than a rw spinlock.Signed-off-by: Russell King
Signed-off-by: Al Viro -
Provide a helper for marking directory buffers dirty so they get
written back to disk.Signed-off-by: Russell King
Signed-off-by: Al Viro -
Add a helper to read a directory using the inode, which we do in two
places.Signed-off-by: Russell King
Signed-off-by: Al Viro -
Both directory formats code the mechanics of fetching the directory
buffers using their own implementations. Consolidate these into one
implementation.Signed-off-by: Russell King
Signed-off-by: Al Viro -
Directories can span multiple buffers, and we currently open-code
memcpy access to these buffers, including dealing with entries that
are split across multiple buffers. Such code exists in both
directory format implementations.Provide common functions to allow data to be copied from/to the
directory buffers as if they were a contiguous set of buffers, and
use them when accessing directories.Signed-off-by: Russell King
Signed-off-by: Al Viro -
adfs_fplus_sync() can be used for both directory formats since we now
have a common way to access the buffer heads, so move it into dir.c
and appropriately rename it. Remove the directory-format specific
implementations.Signed-off-by: Russell King
Signed-off-by: Al Viro -
With the bhs pointer in place, we have no need for separate per-format
free() methods, since a generic version will do. Provide a generic
implementation, remove the format specific implementations and the
method function pointer.Signed-off-by: Russell King
Signed-off-by: Al Viro -
Initialise the dir object before we pass it down to the directory format
specific read handler. This allows us to get rid of the initialisation
inside those handlers.Signed-off-by: Russell King
Signed-off-by: Al Viro -
Rename bh_fplus to bhs in preparation to make some of the directory
handling code sharable between implementations.Signed-off-by: Russell King
Signed-off-by: Al Viro -
When scanning the map for a fragment id, we need to keep track of the
free space links, so we don't inadvertently believe that the freespace
link is a valid fragment id.Signed-off-by: Russell King
Signed-off-by: Al Viro -
Move map specific superblock initialisation to map.c, rather than
having it spread into super.c.Signed-off-by: Russell King
Signed-off-by: Al Viro -
Use find_next_bit_le() to find the end of a fragment in the map rather
than open-coding this functionality.Signed-off-by: Russell King
Signed-off-by: Al Viro -
lookup_zone() and scan_free_map() cope in different ways with the
location of the map data within a zone:1. lookup_zone() adds a four byte offset to the map data pointer to
skip over the check and free link bytes.2. scan_free_map() needs to use the free link pointer, which is an
offset from itself, so we end up adding a 32-bit offset to the
end pointer (aka mapsize) which is really confusing.Rename mapsize to endbit as this is really what it is, and incorporate
the 32-bit offset into the map layout. This means that both dm_startbit
and dm_endbit are now bit offsets from the start of the buffer, rather
than four bytes in to the buffer.Signed-off-by: Russell King
Signed-off-by: Al Viro -
We have several places which deal with releasing the map buffers and
freeing the map array. Provide a helper for this.Signed-off-by: Russell King
Signed-off-by: Al Viro -
Split up adfs_read_map() into separate helpers to layout the map,
read the map, and release the map buffers.Signed-off-by: Russell King
Signed-off-by: Al Viro -
adfs_map_free() is not obvious whether it is freeing the map or
returning the number of free blocks on the filesystem. Rename it to
the more generic statfs() to make it clear that it's a statistic
function.Signed-off-by: Russell King
Signed-off-by: Al Viro