1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
From 06c067eb25fafd8d18de204a3df430e114fc8871 Mon Sep 17 00:00:00 2001
From: Cheyenne Wills <cwills@sinenomine.net>
Date: Mon, 8 Mar 2021 09:22:04 -0700
Subject: [PATCH 10/11] Linux: Create wrapper for setattr_prepare
Move call to setattr_prepare/inode_change_ok into an osi_compat.h
wrapper called 'afs_setattr_prepare'. This moves some of the #if logic
out of the mainline code.
Reviewed-on: https://gerrit.openafs.org/14548
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 12ae2beeeb172cebdfa24d5ea149f73fd85541f8)
Change-Id: I1c7806893daf2404a8b3ac1b5c88ca04e6409226
Reviewed-on: https://gerrit.openafs.org/14564
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
---
src/afs/LINUX/osi_compat.h | 10 ++++++++++
src/afs/LINUX/osi_file.c | 6 +-----
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/afs/LINUX/osi_compat.h b/src/afs/LINUX/osi_compat.h
index a1e7f21fb..3ac4d798d 100644
--- a/src/afs/LINUX/osi_compat.h
+++ b/src/afs/LINUX/osi_compat.h
@@ -748,4 +748,14 @@ afs_d_path(struct dentry *dp, struct vfsmount *mnt, char *buf, int buflen)
#endif
}
+static inline int
+afs_setattr_prepare(struct dentry *dp, struct iattr *newattrs)
+{
+#if defined(HAVE_LINUX_SETATTR_PREPARE)
+ return setattr_prepare(dp, newattrs);
+#else
+ return inode_change_ok(dp->d_inode, newattrs);
+#endif
+}
+
#endif /* AFS_LINUX_OSI_COMPAT_H */
diff --git a/src/afs/LINUX/osi_file.c b/src/afs/LINUX/osi_file.c
index 5b0a0c01d..982cf47e7 100644
--- a/src/afs/LINUX/osi_file.c
+++ b/src/afs/LINUX/osi_file.c
@@ -205,11 +205,7 @@ osi_UFSTruncate(struct osi_file *afile, afs_int32 asize)
AFS_CURRENT_TIME(&newattrs.ia_ctime);
/* avoid notify_change() since it wants to update dentry->d_parent */
-#ifdef HAVE_LINUX_SETATTR_PREPARE
- code = setattr_prepare(file_dentry(afile->filp), &newattrs);
-#else
- code = inode_change_ok(inode, &newattrs);
-#endif
+ code = afs_setattr_prepare(file_dentry(afile->filp), &newattrs);
if (!code)
code = afs_inode_setattr(afile, &newattrs);
if (!code)
--
2.31.1
|