[18/41] fs/adfs: dir: add helper to mark directory buffers dirty
diff mbox series

Message ID E1ieGvB-0004bc-TC@rmk-PC.armlinux.org.uk
State New
Headers show
Series
  • fs/adfs updates for 5.6
Related show

Commit Message

Russell King Dec. 9, 2019, 11:09 a.m. UTC
Provide a helper for marking directory buffers dirty so they get
written back to disk.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
 fs/adfs/dir.c   | 12 ++++++++++++
 fs/adfs/dir_f.c |  5 +----
 2 files changed, 13 insertions(+), 4 deletions(-)

Patch
diff mbox series

diff --git a/fs/adfs/dir.c b/fs/adfs/dir.c
index 882377e86041..e8aafc65d545 100644
--- a/fs/adfs/dir.c
+++ b/fs/adfs/dir.c
@@ -157,6 +157,15 @@  static int adfs_dir_read_inode(struct super_block *sb, struct inode *inode,
 	return ret;
 }
 
+static void adfs_dir_mark_dirty(struct adfs_dir *dir)
+{
+	unsigned int i;
+
+	/* Mark the buffers dirty */
+	for (i = 0; i < dir->nr_buffers; i++)
+		mark_buffer_dirty(dir->bhs[i]);
+}
+
 static int adfs_dir_sync(struct adfs_dir *dir)
 {
 	int err = 0;
@@ -280,6 +289,9 @@  adfs_dir_update(struct super_block *sb, struct object_info *obj, int wait)
 	ret = ops->update(&dir, obj);
 	write_unlock(&adfs_dir_lock);
 
+	if (ret == 0)
+		adfs_dir_mark_dirty(&dir);
+
 	if (wait) {
 		int err = adfs_dir_sync(&dir);
 		if (!ret)
diff --git a/fs/adfs/dir_f.c b/fs/adfs/dir_f.c
index 027ee714f42b..682df46d8d33 100644
--- a/fs/adfs/dir_f.c
+++ b/fs/adfs/dir_f.c
@@ -306,7 +306,7 @@  static int
 adfs_f_update(struct adfs_dir *dir, struct object_info *obj)
 {
 	struct super_block *sb = dir->sb;
-	int ret, i;
+	int ret;
 
 	ret = adfs_dir_find_entry(dir, obj->indaddr);
 	if (ret < 0) {
@@ -347,9 +347,6 @@  adfs_f_update(struct adfs_dir *dir, struct object_info *obj)
 		goto bad_dir;
 	}
 #endif
-	for (i = dir->nr_buffers - 1; i >= 0; i--)
-		mark_buffer_dirty(dir->bh[i]);
-
 	ret = 0;
 out:
 	return ret;