https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c7806a6b29a802b6fedca…
commit c7806a6b29a802b6fedcaf6fdd6b4aba0c8a20ce
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Sat May 26 10:44:36 2018 +0200
Commit: Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Sat May 26 10:44:36 2018 +0200
[BTRFS] Upgrade to 1.0.2
CORE-14655
---
drivers/filesystems/btrfs/balance.c | 4 ----
drivers/filesystems/btrfs/btrfs.h | 2 +-
drivers/filesystems/btrfs/btrfs.rc | 10 +++++-----
drivers/filesystems/btrfs/btrfs_drv.h | 10 +++++-----
drivers/filesystems/btrfs/calcthread.c | 4 +++-
drivers/filesystems/btrfs/create.c | 2 +-
drivers/filesystems/btrfs/fileinfo.c | 3 +++
drivers/filesystems/btrfs/flushthread.c | 3 ++-
drivers/filesystems/btrfs/fsctl.c | 2 +-
drivers/filesystems/btrfs/read.c | 2 --
drivers/filesystems/btrfs/registry.c | 14 ++++++++++----
drivers/filesystems/btrfs/scrub.c | 6 +++---
media/doc/README.FSD | 2 +-
13 files changed, 35 insertions(+), 29 deletions(-)
diff --git a/drivers/filesystems/btrfs/balance.c b/drivers/filesystems/btrfs/balance.c
index 980089618a..3e36489c31 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 01d2c3b9ab..27e9b63f51 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 d79da1aa15..50f7463328 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 1cb50cbfa4..e5efc86b79 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 2b6da81743..9bfb45a74c 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 191bf63be8..cd1106477b 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 9f736671da..9588ea177e 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 ceb37c5a2a..9e95f82834 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 87556c47e1..6cc0f45ab1 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 ddeea66c7a..81fbec3d68 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 9e4d9ea08d..05f66f5df2 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 bab1241579..9dd7c2008d 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 8cb1f12970..e0faa8491d 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