]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: move files_struct.aio_write_behind to a bitfield
authorRalph Boehme <slow@samba.org>
Fri, 3 Apr 2020 05:39:34 +0000 (07:39 +0200)
committerJeremy Allison <jra@samba.org>
Fri, 3 Apr 2020 19:05:44 +0000 (19:05 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/include/vfs.h
source3/smbd/aio.c
source3/smbd/durable.c
source3/smbd/files.c
source3/smbd/open.c

index a09e189cede11abf6703c609d1416951efaa93b1..92f240c61b48a2c3e3f1f930b8f71bb19237f8eb 100644 (file)
@@ -367,6 +367,7 @@ typedef struct files_struct {
                bool can_write : 1;
                bool modified : 1;
                bool is_directory : 1;
+               bool aio_write_behind : 1;
        } fsp_flags;
 
        struct tevent_timer *update_write_time_event;
@@ -387,7 +388,6 @@ typedef struct files_struct {
        struct lock_struct last_lock_failure;
        int current_lock_count; /* Count the number of outstanding locks and pending locks. */
 
-       bool aio_write_behind;
        bool initial_delete_on_close; /* Only set at NTCreateX if file was created. */
        bool delete_on_close;
        uint64_t posix_flags;
index f007383702088b8ff92a1c3b1abbaba53b868f75..7ed2691cfbff48d79bc3dea336880afece0c72b2 100644 (file)
@@ -490,7 +490,8 @@ NTSTATUS schedule_aio_write_and_X(connection_struct *conn,
        contend_level2_oplocks_end(fsp, LEVEL2_CONTEND_WRITE);
 
        if (!aio_ex->write_through && !lp_sync_always(SNUM(fsp->conn))
-           && fsp->aio_write_behind) {
+           && fsp->fsp_flags.aio_write_behind)
+       {
                /* Lie to the client and immediately claim we finished the
                 * write. */
                SSVAL(aio_ex->outbuf.data,smb_vwv2,numtowrite);
@@ -542,7 +543,7 @@ static void aio_pwrite_smb1_done(struct tevent_req *req)
 
        mark_file_modified(fsp);
 
-       if (fsp->aio_write_behind) {
+       if (fsp->fsp_flags.aio_write_behind) {
 
                if (nwritten != numtowrite) {
                        if (nwritten == -1) {
index 26537567e8eeef61f399117ef5b9ade0b8ded3a4..f01df16ec92559c5d252df22b46891bd9dc7901e 100644 (file)
@@ -703,7 +703,7 @@ NTSTATUS vfs_default_durable_reconnect(struct connection_struct *conn,
        /*
         * We do not support aio write behind for smb2
         */
-       fsp->aio_write_behind = false;
+       fsp->fsp_flags.aio_write_behind = false;
        fsp->oplock_type = e.op_type;
 
        if (fsp->oplock_type == LEASE_OPLOCK) {
index 7e2d12b8794432363afd6d96fc39a2034dd7c926..6269dd94dd5addfd77f4c4607000522ec82d785f 100644 (file)
@@ -795,7 +795,7 @@ NTSTATUS dup_file_fsp(
                ((access_mask & (FILE_WRITE_DATA | FILE_APPEND_DATA)) != 0);
        to->fsp_flags.modified = from->fsp_flags.modified;
        to->fsp_flags.is_directory = from->fsp_flags.is_directory;
-       to->aio_write_behind = from->aio_write_behind;
+       to->fsp_flags.aio_write_behind = from->fsp_flags.aio_write_behind;
 
        return fsp_set_smb_fname(to, from->fsp_name);
 }
index 63018759dfba646987e7434276457df42d3ab424..5fe5c1e58dc737fa9b87d2bc6f173736f720fc36 100644 (file)
@@ -1441,7 +1441,7 @@ static NTSTATUS open_file(files_struct *fsp,
        if (conn->aio_write_behind_list &&
            is_in_path(smb_fname->base_name, conn->aio_write_behind_list,
                       conn->case_sensitive)) {
-               fsp->aio_write_behind = True;
+               fsp->fsp_flags.aio_write_behind = true;
        }
 
        DEBUG(2,("%s opened file %s read=%s write=%s (numopen=%d)\n",