mirror of
https://github.com/samba-team/samba.git
synced 2025-03-24 10:50:22 +03:00
smbd: move files_struct.is_sparse to a bitfield
Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
930b7525a6
commit
049488f6a5
@ -370,6 +370,7 @@ typedef struct files_struct {
|
||||
bool aio_write_behind : 1;
|
||||
bool initial_delete_on_close : 1;
|
||||
bool delete_on_close : 1;
|
||||
bool is_sparse : 1;
|
||||
} fsp_flags;
|
||||
|
||||
struct tevent_timer *update_write_time_event;
|
||||
@ -391,7 +392,6 @@ typedef struct files_struct {
|
||||
int current_lock_count; /* Count the number of outstanding locks and pending locks. */
|
||||
|
||||
uint64_t posix_flags;
|
||||
bool is_sparse;
|
||||
bool backup_intent; /* Handle was successfully opened with backup intent
|
||||
and opener has privilege to do so. */
|
||||
bool use_ofd_locks; /* Are we using open file description locks ? */
|
||||
|
@ -2633,7 +2633,7 @@ static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, off_t
|
||||
|
||||
START_PROFILE(syscall_ftruncate);
|
||||
|
||||
if (lp_strict_allocate(SNUM(fsp->conn)) && !fsp->is_sparse) {
|
||||
if (lp_strict_allocate(SNUM(fsp->conn)) && !fsp->fsp_flags.is_sparse) {
|
||||
result = strict_allocate_ftruncate(handle, fsp, len);
|
||||
END_PROFILE(syscall_ftruncate);
|
||||
return result;
|
||||
|
@ -2073,7 +2073,7 @@ static int vfs_gpfs_fallocate(struct vfs_handle_struct *handle,
|
||||
off_t offset, off_t len)
|
||||
{
|
||||
if (mode == (VFS_FALLOCATE_FL_PUNCH_HOLE|VFS_FALLOCATE_FL_KEEP_SIZE) &&
|
||||
!fsp->is_sparse &&
|
||||
!fsp->fsp_flags.is_sparse &&
|
||||
lp_strict_allocate(SNUM(fsp->conn))) {
|
||||
/*
|
||||
* This is from a ZERO_DATA request on a non-sparse
|
||||
|
@ -1197,7 +1197,7 @@ NTSTATUS file_set_sparse(connection_struct *conn,
|
||||
FILE_NOTIFY_CHANGE_ATTRIBUTES,
|
||||
fsp->fsp_name->base_name);
|
||||
|
||||
fsp->is_sparse = sparse;
|
||||
fsp->fsp_flags.is_sparse = sparse;
|
||||
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ static ssize_t real_write_file(struct smb_request *req,
|
||||
fsp->fh->pos = pos;
|
||||
if (pos &&
|
||||
lp_strict_allocate(SNUM(fsp->conn)) &&
|
||||
!fsp->is_sparse)
|
||||
!fsp->fsp_flags.is_sparse)
|
||||
{
|
||||
if (vfs_fill_sparse(fsp, pos) == -1) {
|
||||
return -1;
|
||||
|
@ -3998,9 +3998,9 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
|
||||
/* Determine sparse flag. */
|
||||
if (posix_open) {
|
||||
/* POSIX opens are sparse by default. */
|
||||
fsp->is_sparse = true;
|
||||
fsp->fsp_flags.is_sparse = true;
|
||||
} else {
|
||||
fsp->is_sparse =
|
||||
fsp->fsp_flags.is_sparse =
|
||||
(existing_dos_attributes & FILE_ATTRIBUTE_SPARSE);
|
||||
}
|
||||
|
||||
|
@ -154,7 +154,7 @@ static NTSTATUS fsctl_dup_extents_check_sparse(struct files_struct *src_fsp,
|
||||
* is non-sparse, then FSCTL_DUPLICATE_EXTENTS_TO_FILE completes
|
||||
* successfully.
|
||||
*/
|
||||
if ((src_fsp->is_sparse) && (!dst_fsp->is_sparse)) {
|
||||
if (src_fsp->fsp_flags.is_sparse && !dst_fsp->fsp_flags.is_sparse) {
|
||||
return NT_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
@ -509,7 +509,7 @@ static NTSTATUS fsctl_zero_data(TALLOC_CTX *mem_ctx,
|
||||
return status;
|
||||
}
|
||||
|
||||
if (!fsp->is_sparse && lp_strict_allocate(SNUM(fsp->conn))) {
|
||||
if (!fsp->fsp_flags.is_sparse && lp_strict_allocate(SNUM(fsp->conn))) {
|
||||
/*
|
||||
* File marked non-sparse and "strict allocate" is enabled -
|
||||
* allocate the range that we just punched out.
|
||||
@ -699,7 +699,7 @@ static NTSTATUS fsctl_qar(TALLOC_CTX *mem_ctx,
|
||||
max_off = MIN(sbuf.st_ex_size,
|
||||
qar_req.buf.file_off + qar_req.buf.len) - 1;
|
||||
|
||||
if (!fsp->is_sparse) {
|
||||
if (!fsp->fsp_flags.is_sparse) {
|
||||
struct file_alloced_range_buf qar_buf;
|
||||
|
||||
/* file is non-sparse, claim file_off->max_off is allocated */
|
||||
|
Loading…
x
Reference in New Issue
Block a user