diff --git a/drivers/filesystems/btrfs/balance.c b/drivers/filesystems/btrfs/balance.c index 980089618a4..3e36489c31f 100644 --- a/drivers/filesystems/btrfs/balance.c +++ b/drivers/filesystems/btrfs/balance.c @@ -1984,8 +1984,6 @@ static NTSTATUS balance_data_chunk(device_extension* Vcb, chunk* c, BOOL* change c, NULL, NULL, 0, FALSE, NormalPagePriority); if (!NT_SUCCESS(Status)) { ERR("read_data returned %08x\n", Status); - ExFreePool(csum); - ExFreePool(bmparr); goto end; } @@ -1993,8 +1991,6 @@ static NTSTATUS balance_data_chunk(device_extension* Vcb, chunk* c, BOOL* change NULL, newchunk, FALSE, 0, NormalPagePriority); if (!NT_SUCCESS(Status)) { ERR("write_data_complete returned %08x\n", Status); - ExFreePool(csum); - ExFreePool(bmparr); goto end; } diff --git a/drivers/filesystems/btrfs/btrfs.h b/drivers/filesystems/btrfs/btrfs.h index 01d2c3b9ab0..27e9b63f511 100644 --- a/drivers/filesystems/btrfs/btrfs.h +++ b/drivers/filesystems/btrfs/btrfs.h @@ -562,7 +562,7 @@ typedef struct { #define BTRFS_SEND_TLV_CLONE_OFFSET 23 #define BTRFS_SEND_TLV_CLONE_LENGTH 24 -#define BTRFS_SEND_MAGIC "btrfs-stream\0" +#define BTRFS_SEND_MAGIC "btrfs-stream" typedef struct { UINT8 magic[13]; diff --git a/drivers/filesystems/btrfs/btrfs.rc b/drivers/filesystems/btrfs/btrfs.rc index d79da1aa156..50f74633287 100644 --- a/drivers/filesystems/btrfs/btrfs.rc +++ b/drivers/filesystems/btrfs/btrfs.rc @@ -53,8 +53,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,1,0 - PRODUCTVERSION 1,0,1,0 + FILEVERSION 1,0,2,0 + PRODUCTVERSION 1,0,2,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -70,12 +70,12 @@ BEGIN BLOCK "080904b0" BEGIN VALUE "FileDescription", "WinBtrfs" - VALUE "FileVersion", "1.0.1" + VALUE "FileVersion", "1.0.2" VALUE "InternalName", "btrfs" - VALUE "LegalCopyright", "Copyright (c) Mark Harmstone 2016-17" + VALUE "LegalCopyright", "Copyright (c) Mark Harmstone 2016-18" VALUE "OriginalFilename", "btrfs.sys" VALUE "ProductName", "WinBtrfs" - VALUE "ProductVersion", "1.0.1" + VALUE "ProductVersion", "1.0.2" END END BLOCK "VarFileInfo" diff --git a/drivers/filesystems/btrfs/btrfs_drv.h b/drivers/filesystems/btrfs/btrfs_drv.h index 1cb50cbfa4b..e5efc86b790 100644 --- a/drivers/filesystems/btrfs/btrfs_drv.h +++ b/drivers/filesystems/btrfs/btrfs_drv.h @@ -427,12 +427,7 @@ typedef struct _root { } root; enum batch_operation { - Batch_Insert, Batch_Delete, - Batch_SetXattr, - Batch_DirItem, - Batch_InodeRef, - Batch_InodeExtRef, Batch_DeleteInode, Batch_DeleteDirItem, Batch_DeleteInodeRef, @@ -440,6 +435,11 @@ enum batch_operation { Batch_DeleteXattr, Batch_DeleteExtentData, Batch_DeleteFreeSpace, + Batch_Insert, + Batch_SetXattr, + Batch_DirItem, + Batch_InodeRef, + Batch_InodeExtRef, }; typedef struct { diff --git a/drivers/filesystems/btrfs/calcthread.c b/drivers/filesystems/btrfs/calcthread.c index 2b6da81743d..9bfb45a74c7 100644 --- a/drivers/filesystems/btrfs/calcthread.c +++ b/drivers/filesystems/btrfs/calcthread.c @@ -37,12 +37,14 @@ NTSTATUS add_calc_job(device_extension* Vcb, UINT8* data, UINT32 sectors, UINT32 KeInitializeEvent(&cj->event, NotificationEvent, FALSE); ExAcquireResourceExclusiveLite(&Vcb->calcthreads.lock, TRUE); + InsertTailList(&Vcb->calcthreads.job_list, &cj->list_entry); - ExReleaseResourceLite(&Vcb->calcthreads.lock); KeSetEvent(&Vcb->calcthreads.event, 0, FALSE); KeClearEvent(&Vcb->calcthreads.event); + ExReleaseResourceLite(&Vcb->calcthreads.lock); + *pcj = cj; return STATUS_SUCCESS; diff --git a/drivers/filesystems/btrfs/create.c b/drivers/filesystems/btrfs/create.c index 191bf63be88..cd1106477bf 100644 --- a/drivers/filesystems/btrfs/create.c +++ b/drivers/filesystems/btrfs/create.c @@ -3103,7 +3103,7 @@ static NTSTATUS open_file(PDEVICE_OBJECT DeviceObject, _Requires_lock_held_(_Cur allowed |= DELETE; if (fileref->fcb != Vcb->dummy_fcb && !is_subvol_readonly(fileref->fcb->subvol, Irp) && !Vcb->readonly) { - allowed |= WRITE_OWNER | WRITE_DAC | FILE_WRITE_EA | FILE_WRITE_ATTRIBUTES; + allowed |= DELETE | WRITE_OWNER | WRITE_DAC | FILE_WRITE_EA | FILE_WRITE_ATTRIBUTES; if (!fileref->fcb->ads && fileref->fcb->type == BTRFS_TYPE_DIRECTORY) allowed |= FILE_ADD_SUBDIRECTORY | FILE_ADD_FILE | FILE_DELETE_CHILD; diff --git a/drivers/filesystems/btrfs/fileinfo.c b/drivers/filesystems/btrfs/fileinfo.c index 9f736671da4..9588ea177ec 100644 --- a/drivers/filesystems/btrfs/fileinfo.c +++ b/drivers/filesystems/btrfs/fileinfo.c @@ -2064,6 +2064,9 @@ static NTSTATUS set_end_of_file_information(device_extension* Vcb, PIRP Irp, PFI ERR("error - extend_file failed\n"); goto end; } + } else if ((UINT64)feofi->EndOfFile.QuadPart == fcb->inode_item.st_size && advance_only) { + Status = STATUS_SUCCESS; + goto end; } ccfs.AllocationSize = fcb->Header.AllocationSize; diff --git a/drivers/filesystems/btrfs/flushthread.c b/drivers/filesystems/btrfs/flushthread.c index ceb37c5a2ae..9e95f82834f 100644 --- a/drivers/filesystems/btrfs/flushthread.c +++ b/drivers/filesystems/btrfs/flushthread.c @@ -4254,8 +4254,9 @@ NTSTATUS insert_tree_item_batch(LIST_ENTRY* batchlist, device_extension* Vcb, ro le = br->items.Blink; while (le != &br->items) { batch_item* bi2 = CONTAINING_RECORD(le, batch_item, list_entry); + int cmp = keycmp(bi2->key, bi->key); - if (keycmp(bi2->key, bi->key) != 1) { + if (cmp == -1 || (cmp == 0 && bi->operation >= bi2->operation)) { InsertHeadList(&bi2->list_entry, &bi->list_entry); return STATUS_SUCCESS; } diff --git a/drivers/filesystems/btrfs/fsctl.c b/drivers/filesystems/btrfs/fsctl.c index 87556c47e15..6cc0f45ab18 100644 --- a/drivers/filesystems/btrfs/fsctl.c +++ b/drivers/filesystems/btrfs/fsctl.c @@ -5065,7 +5065,7 @@ NTSTATUS fsctl_request(PDEVICE_OBJECT DeviceObject, PIRP* Pirp, UINT32 type) { Status = STATUS_INVALID_DEVICE_REQUEST; break; -#if WIN32_WINNT >= 0x0600 +#if _WIN32_WINNT >= 0x0600 case FSCTL_MAKE_MEDIA_COMPATIBLE: WARN("STUB: FSCTL_MAKE_MEDIA_COMPATIBLE\n"); Status = STATUS_INVALID_DEVICE_REQUEST; diff --git a/drivers/filesystems/btrfs/read.c b/drivers/filesystems/btrfs/read.c index ddeea66c7aa..81fbec3d68c 100644 --- a/drivers/filesystems/btrfs/read.c +++ b/drivers/filesystems/btrfs/read.c @@ -2093,7 +2093,6 @@ NTSTATUS read_data(_In_ device_extension* Vcb, _In_ UINT64 addr, _In_ UINT32 len if (!dummy_mdl) { ERR("IoAllocateMdl failed\n"); Status = STATUS_INSUFFICIENT_RESOURCES; - ExFreePool(dummypage); goto exit; } @@ -2347,7 +2346,6 @@ NTSTATUS read_data(_In_ device_extension* Vcb, _In_ UINT64 addr, _In_ UINT32 len if (!dummy_mdl) { ERR("IoAllocateMdl failed\n"); Status = STATUS_INSUFFICIENT_RESOURCES; - ExFreePool(dummypage); goto exit; } diff --git a/drivers/filesystems/btrfs/registry.c b/drivers/filesystems/btrfs/registry.c index 9e4d9ea08d2..05f66f5df2b 100644 --- a/drivers/filesystems/btrfs/registry.c +++ b/drivers/filesystems/btrfs/registry.c @@ -923,21 +923,27 @@ void read_registry(PUNICODE_STRING regpath, BOOL refresh) { ERR("LogFile was type %u, length %u\n", kvfi->Type, kvfi->DataLength); Status = ZwDeleteValueKey(h, &us); - if (!NT_SUCCESS(Status)) { + if (!NT_SUCCESS(Status)) ERR("ZwDeleteValueKey returned %08x\n", Status); - } + + log_file.Length = 0; } + } else { + ERR("ZwQueryValueKey returned %08\n", Status); + log_file.Length = 0; } ExFreePool(kvfi); } else if (Status == STATUS_OBJECT_NAME_NOT_FOUND) { Status = ZwSetValueKey(h, &us, 0, REG_SZ, def_log_file, (ULONG)(wcslen(def_log_file) + 1) * sizeof(WCHAR)); - if (!NT_SUCCESS(Status)) { + if (!NT_SUCCESS(Status)) ERR("ZwSetValueKey returned %08x\n", Status); - } + + log_file.Length = 0; } else { ERR("ZwQueryValueKey returned %08x\n", Status); + log_file.Length = 0; } if (log_file.Length == 0) { diff --git a/drivers/filesystems/btrfs/scrub.c b/drivers/filesystems/btrfs/scrub.c index bab1241579b..9dd7c2008d9 100644 --- a/drivers/filesystems/btrfs/scrub.c +++ b/drivers/filesystems/btrfs/scrub.c @@ -2113,10 +2113,10 @@ static void scrub_raid6_stripe(device_extension* Vcb, chunk* c, scrub_context_ra } do_xor(scratch, &context->stripes[parity2].buf[(num * c->chunk_item->stripe_length) + (i * Vcb->superblock.sector_size)], len); - } - if (bad_stripe_num != 0) - galois_divpower(scratch, (UINT8)bad_stripe_num, len); + if (bad_stripe_num != 0) + galois_divpower(scratch, (UINT8)bad_stripe_num, len); + } if (RtlCheckBit(&context->is_tree, bad_off1)) { tree_header *th1 = NULL, *th2 = NULL; diff --git a/media/doc/README.FSD b/media/doc/README.FSD index 8cb1f129705..e0faa8491de 100644 --- a/media/doc/README.FSD +++ b/media/doc/README.FSD @@ -3,7 +3,7 @@ The following FSD are shared with: https://github.com/maharmstone/btrfs. -reactos/drivers/filesystems/btrfs # Synced to 1.0.1 +reactos/drivers/filesystems/btrfs # Synced to 1.0.2 reactos/dll/shellext/shellbtrfs # Synced to 1.0.1 reactos/sdk/lib/fslib/btrfslib # Synced to 1.0.1