<commit_before>#ifndef __2QLRU__
#define __2QLRU__

#include <deque>
#include "cache.h"

#define RECLAIM_NPAGES 32

class linked_page: public page {
	linked_page *prev, *next;
public:
	linked_page() {
		prev = this;
		next = this;
	}

	linked_page(off_t off, long data): page(off, data) {
		prev = this;
		next = this;
	}

	void add_front(linked_page *pg) {
		linked_page *next = this->next;
		pg->next = next;
		pg->prev = this;
		this->next = pg;
		next->prev = pg;
	}

	void add_back(linked_page *pg) {
		linked_page *prev = this->prev;
		pg->next = this;
		pg->prev = prev;
		this->prev = pg;
		prev->next = pg;
	}

	void remove_from_list() {
		linked_page *prev = this->prev;
		linked_page *next = this->next;
		prev->next = next;
		next->prev = prev;
		this->next = this;
		this->prev = this;<commit_msg>fix a bug in LRU2Q.<commit_after>#ifndef __2QLRU__
#define __2QLRU__

#include <deque>
#include "cache.h"

#define RECLAIM_NPAGES 32

class linked_page: public thread_safe_page {
	linked_page *prev, *next;
public:
	linked_page() {
		prev = this;
		next = this;
	}

	linked_page(off_t off, long data): thread_safe_page(off, data) {
		prev = this;
		next = this;
	}

	void add_front(linked_page *pg) {
		linked_page *next = this->next;
		pg->next = next;
		pg->prev = this;
		this->next = pg;
		next->prev = pg;
	}

	void add_back(linked_page *pg) {
		linked_page *prev = this->prev;
		pg->next = this;
		pg->prev = prev;
		this->prev = pg;
		prev->next = pg;
	}

	void remove_from_list() {
		linked_page *prev = this->prev;
		linked_page *next = this->next;
		prev->next = next;
		next->prev = prev;
		this->next = this;
		this->prev = this;
{'fraction_non_alphanumeric': 0.1484848484848485, 'fraction_numerical': 0.005454545454545455, 'mean_word_length': 3.4864130434782608, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6750451', 'n_tokens_mistral': 717, 'n_tokens_neox': 652, 'n_words': 159}