summaryrefslogtreecommitdiffstats
path: root/fs/gfs2/dir.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2021-04-29 10:33:35 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2021-04-29 10:33:35 -0700
commitf2c80837e27e67e91ad93f41f0849be28b808b14 (patch)
tree892112731da08a2ae97be1f39ede5f88499ea08b /fs/gfs2/dir.c
parent8ae8932c6a330790c6bf22a43a6960118c34dcb5 (diff)
parente5966cf20f0c7e40fd8c208ba1614e1a35a8deee (diff)
downloadlinux-stable-f2c80837e27e67e91ad93f41f0849be28b808b14.tar.gz
linux-stable-f2c80837e27e67e91ad93f41f0849be28b808b14.tar.bz2
linux-stable-f2c80837e27e67e91ad93f41f0849be28b808b14.zip
Merge tag 'gfs2-for-5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2
Pull gfs2 updates from Andreas Gruenbacher: - Fix some compiler and kernel-doc warnings - Various minor cleanups and optimizations - Add a new sysfs gfs2 status file with some filesystem wide information * tag 'gfs2-for-5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2: gfs2: Fix fall-through warnings for Clang gfs2: Fix a number of kernel-doc warnings gfs2: Make gfs2_setattr_simple static gfs2: Add new sysfs file for gfs2 status gfs2: Silence possible null pointer dereference warning gfs2: Turn gfs2_meta_indirect_buffer into gfs2_meta_buffer gfs2: Replace gfs2_lblk_to_dblk with gfs2_get_extent gfs2: Turn gfs2_extent_map into gfs2_{get,alloc}_extent gfs2: Add new gfs2_iomap_get helper gfs2: Remove unused variable sb_format gfs2: Fix dir.c function parameter descriptions gfs2: Eliminate gh parameter from go_xmote_bh func gfs2: don't create empty buffers for NO_CREATE
Diffstat (limited to 'fs/gfs2/dir.c')
-rw-r--r--fs/gfs2/dir.c52
1 files changed, 28 insertions, 24 deletions
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index c0f2875c946c..18f67b37d6f8 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -159,7 +159,7 @@ static int gfs2_dir_write_data(struct gfs2_inode *ip, const char *buf,
unsigned int o;
int copied = 0;
int error = 0;
- int new = 0;
+ bool new = false;
if (!size)
return 0;
@@ -189,9 +189,9 @@ static int gfs2_dir_write_data(struct gfs2_inode *ip, const char *buf,
amount = sdp->sd_sb.sb_bsize - o;
if (!extlen) {
- new = 1;
- error = gfs2_extent_map(&ip->i_inode, lblock, &new,
- &dblock, &extlen);
+ extlen = 1;
+ error = gfs2_alloc_extent(&ip->i_inode, lblock, &dblock,
+ &extlen, &new);
if (error)
goto fail;
error = -EIO;
@@ -286,15 +286,14 @@ static int gfs2_dir_read_data(struct gfs2_inode *ip, __be64 *buf,
while (copied < size) {
unsigned int amount;
struct buffer_head *bh;
- int new;
amount = size - copied;
if (amount > sdp->sd_sb.sb_bsize - o)
amount = sdp->sd_sb.sb_bsize - o;
if (!extlen) {
- new = 0;
- error = gfs2_extent_map(&ip->i_inode, lblock, &new,
+ extlen = 32;
+ error = gfs2_get_extent(&ip->i_inode, lblock,
&dblock, &extlen);
if (error || !dblock)
goto fail;
@@ -770,14 +769,13 @@ static int get_leaf(struct gfs2_inode *dip, u64 leaf_no,
/**
* get_leaf_nr - Get a leaf number associated with the index
* @dip: The GFS2 inode
- * @index:
- * @leaf_out:
+ * @index: hash table index of the targeted leaf
+ * @leaf_out: Resulting leaf block number
*
* Returns: 0 on success, error code otherwise
*/
-static int get_leaf_nr(struct gfs2_inode *dip, u32 index,
- u64 *leaf_out)
+static int get_leaf_nr(struct gfs2_inode *dip, u32 index, u64 *leaf_out)
{
__be64 *hash;
int error;
@@ -898,7 +896,7 @@ static struct gfs2_leaf *new_leaf(struct inode *inode, struct buffer_head **pbh,
/**
* dir_make_exhash - Convert a stuffed directory into an ExHash directory
- * @dip: The GFS2 inode
+ * @inode: The directory inode to be converted to exhash
*
* Returns: 0 on success, error code otherwise
*/
@@ -991,9 +989,8 @@ static int dir_make_exhash(struct inode *inode)
/**
* dir_split_leaf - Split a leaf block into two
- * @dip: The GFS2 inode
- * @index:
- * @leaf_no:
+ * @inode: The directory inode to be split
+ * @name: name of the dirent we're trying to insert
*
* Returns: 0 on success, error code on failure
*/
@@ -1252,6 +1249,7 @@ static int compare_dents(const void *a, const void *b)
* @ctx: what to feed the entries to
* @darr: an array of struct gfs2_dirent pointers to read
* @entries: the number of entries in darr
+ * @sort_start: index of the directory array to start our sort
* @copied: pointer to int that's non-zero if a entry has been copied out
*
* Jump through some hoops to make sure that if there are hash collsions,
@@ -1468,6 +1466,10 @@ out:
/**
* gfs2_dir_readahead - Issue read-ahead requests for leaf blocks.
+ * @inode: the directory inode
+ * @hsize: hash table size
+ * @index: index into the hash table
+ * @f_ra: read-ahead parameters
*
* Note: we can't calculate each index like dir_e_read can because we don't
* have the leaf, and therefore we don't have the depth, and therefore we
@@ -1517,8 +1519,9 @@ static void gfs2_dir_readahead(struct inode *inode, unsigned hsize, u32 index,
/**
* dir_e_read - Reads the entries from a directory into a filldir buffer
- * @dip: dinode pointer
+ * @inode: the directory inode
* @ctx: actor to feed the entries to
+ * @f_ra: read-ahead parameters
*
* Returns: errno
*/
@@ -1627,7 +1630,7 @@ out:
/**
* gfs2_dir_search - Search a directory
- * @dip: The GFS2 dir inode
+ * @dir: The GFS2 directory inode
* @name: The name we are looking up
* @fail_on_exist: Fail if the name exists rather than looking it up
*
@@ -1864,7 +1867,7 @@ int gfs2_dir_add(struct inode *inode, const struct qstr *name,
/**
* gfs2_dir_del - Delete a directory entry
* @dip: The GFS2 inode
- * @filename: The filename
+ * @dentry: The directory entry we want to delete
*
* Returns: 0 on success, error code on failure
*/
@@ -1918,9 +1921,10 @@ int gfs2_dir_del(struct gfs2_inode *dip, const struct dentry *dentry)
/**
* gfs2_dir_mvino - Change inode number of directory entry
- * @dip: The GFS2 inode
- * @filename:
- * @new_inode:
+ * @dip: The GFS2 directory inode
+ * @filename: the filename to be moved
+ * @nip: the new GFS2 inode
+ * @new_type: the de_type of the new dirent
*
* This routine changes the inode number of a directory entry. It's used
* by rename to change ".." when a directory is moved.
@@ -1960,7 +1964,7 @@ int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename,
* @len: the number of pointers to this leaf
* @leaf_no: the leaf number
* @leaf_bh: buffer_head for the starting leaf
- * last_dealloc: 1 if this is the final dealloc for the leaf, else 0
+ * @last_dealloc: 1 if this is the final dealloc for the leaf, else 0
*
* Returns: errno
*/
@@ -2142,8 +2146,8 @@ out:
/**
* gfs2_diradd_alloc_required - find if adding entry will require an allocation
- * @ip: the file being written to
- * @filname: the filename that's going to be added
+ * @inode: the directory inode being written to
+ * @name: the filename that's going to be added
* @da: The structure to return dir alloc info
*
* Returns: 0 if ok, -ve on error