aboutsummaryrefslogtreecommitdiff
path: root/fs/nfsd/xdr4.h
diff options
context:
space:
mode:
authorChuck Lever2022-07-27 14:40:41 -0400
committerChuck Lever2022-07-29 20:16:59 -0400
commit1913cdf56cb5bfbc8170873728d13598cbecda23 (patch)
tree2d8d804500b35cdf61a94761be797334bd201b66 /fs/nfsd/xdr4.h
parent8ea6e2c90bb0eb74a595a12e23a1dff9abbc760a (diff)
NFSD: Replace boolean fields in struct nfsd4_copy
Clean up: saves 8 bytes, and we can replace check_and_set_stop_copy() with an atomic bitop. Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to 'fs/nfsd/xdr4.h')
-rw-r--r--fs/nfsd/xdr4.h33
1 files changed, 28 insertions, 5 deletions
diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h
index a36678e3ca0e..eb09bf5aa70e 100644
--- a/fs/nfsd/xdr4.h
+++ b/fs/nfsd/xdr4.h
@@ -541,10 +541,12 @@ struct nfsd4_copy {
u64 cp_dst_pos;
u64 cp_count;
struct nl4_server *cp_src;
- bool cp_intra;
- /* both */
- u32 cp_synchronous;
+ unsigned long cp_flags;
+#define NFSD4_COPY_F_STOPPED (0)
+#define NFSD4_COPY_F_INTRA (1)
+#define NFSD4_COPY_F_SYNCHRONOUS (2)
+#define NFSD4_COPY_F_COMMITTED (3)
/* response */
struct nfsd42_write_res cp_res;
@@ -564,14 +566,35 @@ struct nfsd4_copy {
struct list_head copies;
struct task_struct *copy_task;
refcount_t refcount;
- bool stopped;
struct vfsmount *ss_mnt;
struct nfs_fh c_fh;
nfs4_stateid stateid;
- bool committed;
};
+static inline void nfsd4_copy_set_sync(struct nfsd4_copy *copy, bool sync)
+{
+ if (sync)
+ set_bit(NFSD4_COPY_F_SYNCHRONOUS, &copy->cp_flags);
+ else
+ clear_bit(NFSD4_COPY_F_SYNCHRONOUS, &copy->cp_flags);
+}
+
+static inline bool nfsd4_copy_is_sync(const struct nfsd4_copy *copy)
+{
+ return test_bit(NFSD4_COPY_F_SYNCHRONOUS, &copy->cp_flags);
+}
+
+static inline bool nfsd4_copy_is_async(const struct nfsd4_copy *copy)
+{
+ return !test_bit(NFSD4_COPY_F_SYNCHRONOUS, &copy->cp_flags);
+}
+
+static inline bool nfsd4_ssc_is_inter(const struct nfsd4_copy *copy)
+{
+ return !test_bit(NFSD4_COPY_F_INTRA, &copy->cp_flags);
+}
+
struct nfsd4_seek {
/* request */
stateid_t seek_stateid;