OpenZFS 1300 - filename normalization doesn't work for removes

Authored by: Kevin Crowe <kevin.crowe@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Ported-by: George Melikov <mail@gmelikov.ru>

OpenZFS-issue: https://www.illumos.org/issues/1300
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/8f1750d
Closes #5725 

Porting notes:
- zap_micro.c: all `MT_EXACT` are replaced by `0`
This commit is contained in:
George Melikov
2017-02-03 01:13:41 +03:00
committed by Brian Behlendorf
parent 96f1b347f8
commit 9b7b9cd370
9 changed files with 185 additions and 117 deletions
+10 -28
View File
@@ -18,9 +18,11 @@
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright 2017 Nexenta Systems, Inc.
*/
#ifndef _SYS_ZAP_H
@@ -87,22 +89,15 @@ extern "C" {
/*
* Specifies matching criteria for ZAP lookups.
* MT_NORMALIZE Use ZAP normalization flags, which can include both
* unicode normalization and case-insensitivity.
* MT_MATCH_CASE Do case-sensitive lookups even if MT_NORMALIZE is
* specified and ZAP normalization flags include
* U8_TEXTPREP_TOUPPER.
*/
typedef enum matchtype
{
/* Only find an exact match (non-normalized) */
MT_EXACT,
/*
* If there is an exact match, find that, otherwise find the
* first normalized match.
*/
MT_BEST,
/*
* Find the "first" normalized (case and Unicode form) match;
* the designated "first" match will not change as long as the
* set of entries with this normalization doesn't change.
*/
MT_FIRST
typedef enum matchtype {
MT_NORMALIZE = 1 << 0,
MT_MATCH_CASE = 1 << 1,
} matchtype_t;
typedef enum zap_flags {
@@ -119,19 +114,6 @@ typedef enum zap_flags {
/*
* Create a new zapobj with no attributes and return its object number.
* MT_EXACT will cause the zap object to only support MT_EXACT lookups,
* otherwise any matchtype can be used for lookups.
*
* normflags specifies what normalization will be done. values are:
* 0: no normalization (legacy on-disk format, supports MT_EXACT matching
* only)
* U8_TEXTPREP_TOLOWER: case normalization will be performed.
* MT_FIRST/MT_BEST matching will find entries that match without
* regard to case (eg. looking for "foo" can find an entry "Foo").
* Eventually, other flags will permit unicode normalization as well.
*
* dnodesize specifies the on-disk size of the dnode for the new zapobj.
* Valid values are multiples of 512 up to DNODE_MAX_SIZE.
*/
uint64_t zap_create(objset_t *ds, dmu_object_type_t ot,
dmu_object_type_t bonustype, int bonuslen, dmu_tx_t *tx);
+3
View File
@@ -18,10 +18,12 @@
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014 Spectra Logic Corporation, All rights reserved.
* Copyright (c) 2013, 2016 by Delphix. All rights reserved.
* Copyright 2017 Nexenta Systems, Inc.
*/
#ifndef _SYS_ZAP_IMPL_H
@@ -188,6 +190,7 @@ typedef struct zap_name {
int zn_key_norm_numints;
uint64_t zn_hash;
matchtype_t zn_matchtype;
int zn_normflags;
char zn_normbuf[ZAP_MAXNAMELEN];
} zap_name_t;