Skip to content

Commit 532aec7

Browse files
Florian Westphalummakynes
authored andcommitted
netfilter: nft_set_pipapo: remove dirty flag
After previous change: ->clone exists: ->dirty is always true ->clone == NULL ->dirty is always false So remove this flag. Signed-off-by: Florian Westphal <[email protected]> Reviewed-by: Stefano Brivio <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 3f1d886 commit 532aec7

File tree

2 files changed

+0
-27
lines changed

2 files changed

+0
-27
lines changed

net/netfilter/nft_set_pipapo.c

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,7 +1299,6 @@ static int nft_pipapo_insert(const struct net *net, const struct nft_set *set,
12991299
union nft_pipapo_map_bucket rulemap[NFT_PIPAPO_MAX_FIELDS];
13001300
const u8 *start = (const u8 *)elem->key.val.data, *end;
13011301
struct nft_pipapo_match *m = pipapo_maybe_clone(set);
1302-
struct nft_pipapo *priv = nft_set_priv(set);
13031302
u8 genmask = nft_genmask_next(net);
13041303
struct nft_pipapo_elem *e, *dup;
13051304
u64 tstamp = nft_net_tstamp(net);
@@ -1370,8 +1369,6 @@ static int nft_pipapo_insert(const struct net *net, const struct nft_set *set,
13701369
}
13711370

13721371
/* Insert */
1373-
priv->dirty = true;
1374-
13751372
bsize_max = m->bsize_max;
13761373

13771374
nft_pipapo_for_each_field(f, i, m) {
@@ -1736,8 +1733,6 @@ static void pipapo_gc(struct nft_set *set, struct nft_pipapo_match *m)
17361733
* NFT_SET_ELEM_DEAD_BIT.
17371734
*/
17381735
if (__nft_set_elem_expired(&e->ext, tstamp)) {
1739-
priv->dirty = true;
1740-
17411736
gc = nft_trans_gc_queue_sync(gc, GFP_KERNEL);
17421737
if (!gc)
17431738
return;
@@ -1823,13 +1818,9 @@ static void nft_pipapo_commit(struct nft_set *set)
18231818
if (time_after_eq(jiffies, priv->last_gc + nft_set_gc_interval(set)))
18241819
pipapo_gc(set, priv->clone);
18251820

1826-
if (!priv->dirty)
1827-
return;
1828-
18291821
old = rcu_replace_pointer(priv->match, priv->clone,
18301822
nft_pipapo_transaction_mutex_held(set));
18311823
priv->clone = NULL;
1832-
priv->dirty = false;
18331824

18341825
if (old)
18351826
call_rcu(&old->rcu, pipapo_reclaim_match);
@@ -1839,12 +1830,8 @@ static void nft_pipapo_abort(const struct nft_set *set)
18391830
{
18401831
struct nft_pipapo *priv = nft_set_priv(set);
18411832

1842-
if (!priv->dirty)
1843-
return;
1844-
18451833
if (!priv->clone)
18461834
return;
1847-
priv->dirty = false;
18481835
pipapo_free_match(priv->clone);
18491836
priv->clone = NULL;
18501837
}
@@ -2098,7 +2085,6 @@ static void nft_pipapo_remove(const struct net *net, const struct nft_set *set,
20982085
match_end += NFT_PIPAPO_GROUPS_PADDED_SIZE(f);
20992086

21002087
if (last && f->mt[rulemap[i].to].e == e) {
2101-
priv->dirty = true;
21022088
pipapo_drop(m, rulemap);
21032089
return;
21042090
}
@@ -2295,21 +2281,10 @@ static int nft_pipapo_init(const struct nft_set *set,
22952281
f->mt = NULL;
22962282
}
22972283

2298-
/* Create an initial clone of matching data for next insertion */
2299-
priv->clone = pipapo_clone(m);
2300-
if (!priv->clone) {
2301-
err = -ENOMEM;
2302-
goto out_free;
2303-
}
2304-
2305-
priv->dirty = false;
2306-
23072284
rcu_assign_pointer(priv->match, m);
23082285

23092286
return 0;
23102287

2311-
out_free:
2312-
free_percpu(m->scratch);
23132288
out_scratch:
23142289
kfree(m);
23152290

net/netfilter/nft_set_pipapo.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,14 +155,12 @@ struct nft_pipapo_match {
155155
* @match: Currently in-use matching data
156156
* @clone: Copy where pending insertions and deletions are kept
157157
* @width: Total bytes to be matched for one packet, including padding
158-
* @dirty: Working copy has pending insertions or deletions
159158
* @last_gc: Timestamp of last garbage collection run, jiffies
160159
*/
161160
struct nft_pipapo {
162161
struct nft_pipapo_match __rcu *match;
163162
struct nft_pipapo_match *clone;
164163
int width;
165-
bool dirty;
166164
unsigned long last_gc;
167165
};
168166

0 commit comments

Comments
 (0)