summaryrefslogtreecommitdiff
path: root/fs/adfs/dir_f.c
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2019-12-09 11:10:47 +0000
committerAl Viro <viro@zeniv.linux.org.uk>2020-01-20 20:12:42 -0500
commitaacc954c1be8910a994e09a8f8757a2e3e231c37 (patch)
tree99f06bcba784a12524ca2bd068d3ba9f3fd255ad /fs/adfs/dir_f.c
parentcc625ccd0e6c2804cd0935743e3b51121a712562 (diff)
fs/adfs: newdir: split out directory commit from update
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 <rmk+kernel@armlinux.org.uk> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/adfs/dir_f.c')
-rw-r--r--fs/adfs/dir_f.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/fs/adfs/dir_f.c b/fs/adfs/dir_f.c
index 36cfadb2b893..30d526fecc3f 100644
--- a/fs/adfs/dir_f.c
+++ b/fs/adfs/dir_f.c
@@ -292,25 +292,24 @@ static int adfs_f_update(struct adfs_dir *dir, struct object_info *obj)
adfs_obj2dir(&de, obj);
/* Write the directory entry back to the directory */
- ret = adfs_dir_copyto(dir, pos, &de, 26);
- if (ret)
- return ret;
-
- /*
- * Increment directory sequence number
- */
+ return adfs_dir_copyto(dir, offset, &de, 26);
+}
+
+static int adfs_f_commit(struct adfs_dir *dir)
+{
+ int ret;
+
+ /* Increment directory sequence number */
dir->dirhead->startmasseq += 1;
dir->newtail->endmasseq += 1;
- ret = adfs_dir_checkbyte(dir);
- /*
- * Update directory check byte
- */
- dir->newtail->dircheckbyte = ret;
+ /* Update directory check byte */
+ dir->newtail->dircheckbyte = adfs_dir_checkbyte(dir);
+ /* Make sure the directory still validates correctly */
ret = adfs_f_validate(dir);
if (ret)
- adfs_error(dir->sb, "whoops! I broke a directory!");
+ adfs_msg(dir->sb, KERN_ERR, "error: update broke directory");
return ret;
}
@@ -321,4 +320,5 @@ const struct adfs_dir_ops adfs_f_dir_ops = {
.setpos = adfs_f_setpos,
.getnext = adfs_f_getnext,
.update = adfs_f_update,
+ .commit = adfs_f_commit,
};