Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4ce5c342 authored by Ryusuke Konishi's avatar Ryusuke Konishi Committed by Linus Torvalds
Browse files
parent ad980c9a
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -41,7 +41,7 @@ nilfs_btnode_create_block(struct address_space *btnc, __u64 blocknr)
	struct inode *inode = NILFS_BTNC_I(btnc);
	struct inode *inode = NILFS_BTNC_I(btnc);
	struct buffer_head *bh;
	struct buffer_head *bh;


	bh = nilfs_grab_buffer(inode, btnc, blocknr, 1 << BH_NILFS_Node);
	bh = nilfs_grab_buffer(inode, btnc, blocknr, BIT(BH_NILFS_Node));
	if (unlikely(!bh))
	if (unlikely(!bh))
		return NULL;
		return NULL;


@@ -70,7 +70,7 @@ int nilfs_btnode_submit_block(struct address_space *btnc, __u64 blocknr,
	struct page *page;
	struct page *page;
	int err;
	int err;


	bh = nilfs_grab_buffer(inode, btnc, blocknr, 1 << BH_NILFS_Node);
	bh = nilfs_grab_buffer(inode, btnc, blocknr, BIT(BH_NILFS_Node));
	if (unlikely(!bh))
	if (unlikely(!bh))
		return -ENOMEM;
		return -ENOMEM;


+2 −2
Original line number Original line Diff line number Diff line
@@ -356,7 +356,7 @@ struct inode *nilfs_new_inode(struct inode *dir, umode_t mode)


	root = NILFS_I(dir)->i_root;
	root = NILFS_I(dir)->i_root;
	ii = NILFS_I(inode);
	ii = NILFS_I(inode);
	ii->i_state = 1 << NILFS_I_NEW;
	ii->i_state = BIT(NILFS_I_NEW);
	ii->i_root = root;
	ii->i_root = root;


	err = nilfs_ifile_create_inode(root->ifile, &ino, &ii->i_bh);
	err = nilfs_ifile_create_inode(root->ifile, &ino, &ii->i_bh);
@@ -555,7 +555,7 @@ static int nilfs_iget_set(struct inode *inode, void *opaque)


	inode->i_ino = args->ino;
	inode->i_ino = args->ino;
	if (args->for_gc) {
	if (args->for_gc) {
		NILFS_I(inode)->i_state = 1 << NILFS_I_GCINODE;
		NILFS_I(inode)->i_state = BIT(NILFS_I_GCINODE);
		NILFS_I(inode)->i_cno = args->cno;
		NILFS_I(inode)->i_cno = args->cno;
		NILFS_I(inode)->i_root = NULL;
		NILFS_I(inode)->i_root = NULL;
	} else {
	} else {
+7 −8
Original line number Original line Diff line number Diff line
@@ -120,19 +120,18 @@ enum {
 * Macros to check inode numbers
 * Macros to check inode numbers
 */
 */
#define NILFS_MDT_INO_BITS						\
#define NILFS_MDT_INO_BITS						\
	((unsigned int)(1 << NILFS_DAT_INO | 1 << NILFS_CPFILE_INO |	\
	(BIT(NILFS_DAT_INO) | BIT(NILFS_CPFILE_INO) |			\
			1 << NILFS_SUFILE_INO | 1 << NILFS_IFILE_INO |	\
	 BIT(NILFS_SUFILE_INO) | BIT(NILFS_IFILE_INO) |			\
			1 << NILFS_ATIME_INO | 1 << NILFS_SKETCH_INO))
	 BIT(NILFS_ATIME_INO) | BIT(NILFS_SKETCH_INO))


#define NILFS_SYS_INO_BITS   \
#define NILFS_SYS_INO_BITS (BIT(NILFS_ROOT_INO) | NILFS_MDT_INO_BITS)
	((unsigned int)(1 << NILFS_ROOT_INO) | NILFS_MDT_INO_BITS)


#define NILFS_FIRST_INO(sb) (((struct the_nilfs *)sb->s_fs_info)->ns_first_ino)
#define NILFS_FIRST_INO(sb) (((struct the_nilfs *)sb->s_fs_info)->ns_first_ino)


#define NILFS_MDT_INODE(sb, ino) \
#define NILFS_MDT_INODE(sb, ino) \
	((ino) < NILFS_FIRST_INO(sb) && (NILFS_MDT_INO_BITS & (1 << (ino))))
	((ino) < NILFS_FIRST_INO(sb) && (NILFS_MDT_INO_BITS & BIT(ino)))
#define NILFS_VALID_INODE(sb, ino) \
#define NILFS_VALID_INODE(sb, ino) \
	((ino) >= NILFS_FIRST_INO(sb) || (NILFS_SYS_INO_BITS & (1 << (ino))))
	((ino) >= NILFS_FIRST_INO(sb) || (NILFS_SYS_INO_BITS & BIT(ino)))


/**
/**
 * struct nilfs_transaction_info: context information for synchronization
 * struct nilfs_transaction_info: context information for synchronization
+13 −13
Original line number Original line Diff line number Diff line
@@ -31,8 +31,8 @@




#define NILFS_BUFFER_INHERENT_BITS					\
#define NILFS_BUFFER_INHERENT_BITS					\
	((1UL << BH_Uptodate) | (1UL << BH_Mapped) | (1UL << BH_NILFS_Node) | \
	(BIT(BH_Uptodate) | BIT(BH_Mapped) | BIT(BH_NILFS_Node) |	\
	 (1UL << BH_NILFS_Volatile) | (1UL << BH_NILFS_Checked))
	 BIT(BH_NILFS_Volatile) | BIT(BH_NILFS_Checked))


static struct buffer_head *
static struct buffer_head *
__nilfs_get_page_block(struct page *page, unsigned long block, pgoff_t index,
__nilfs_get_page_block(struct page *page, unsigned long block, pgoff_t index,
@@ -85,9 +85,9 @@ void nilfs_forget_buffer(struct buffer_head *bh)
{
{
	struct page *page = bh->b_page;
	struct page *page = bh->b_page;
	const unsigned long clear_bits =
	const unsigned long clear_bits =
		(1 << BH_Uptodate | 1 << BH_Dirty | 1 << BH_Mapped |
		(BIT(BH_Uptodate) | BIT(BH_Dirty) | BIT(BH_Mapped) |
		 1 << BH_Async_Write | 1 << BH_NILFS_Volatile |
		 BIT(BH_Async_Write) | BIT(BH_NILFS_Volatile) |
		 1 << BH_NILFS_Checked | 1 << BH_NILFS_Redirected);
		 BIT(BH_NILFS_Checked) | BIT(BH_NILFS_Redirected));


	lock_buffer(bh);
	lock_buffer(bh);
	set_mask_bits(&bh->b_state, clear_bits, 0);
	set_mask_bits(&bh->b_state, clear_bits, 0);
@@ -124,17 +124,17 @@ void nilfs_copy_buffer(struct buffer_head *dbh, struct buffer_head *sbh)
	dbh->b_bdev = sbh->b_bdev;
	dbh->b_bdev = sbh->b_bdev;


	bh = dbh;
	bh = dbh;
	bits = sbh->b_state & ((1UL << BH_Uptodate) | (1UL << BH_Mapped));
	bits = sbh->b_state & (BIT(BH_Uptodate) | BIT(BH_Mapped));
	while ((bh = bh->b_this_page) != dbh) {
	while ((bh = bh->b_this_page) != dbh) {
		lock_buffer(bh);
		lock_buffer(bh);
		bits &= bh->b_state;
		bits &= bh->b_state;
		unlock_buffer(bh);
		unlock_buffer(bh);
	}
	}
	if (bits & (1UL << BH_Uptodate))
	if (bits & BIT(BH_Uptodate))
		SetPageUptodate(dpage);
		SetPageUptodate(dpage);
	else
	else
		ClearPageUptodate(dpage);
		ClearPageUptodate(dpage);
	if (bits & (1UL << BH_Mapped))
	if (bits & BIT(BH_Mapped))
		SetPageMappedToDisk(dpage);
		SetPageMappedToDisk(dpage);
	else
	else
		ClearPageMappedToDisk(dpage);
		ClearPageMappedToDisk(dpage);
@@ -215,7 +215,7 @@ static void nilfs_copy_page(struct page *dst, struct page *src, int copy_dirty)
		create_empty_buffers(dst, sbh->b_size, 0);
		create_empty_buffers(dst, sbh->b_size, 0);


	if (copy_dirty)
	if (copy_dirty)
		mask |= (1UL << BH_Dirty);
		mask |= BIT(BH_Dirty);


	dbh = dbufs = page_buffers(dst);
	dbh = dbufs = page_buffers(dst);
	do {
	do {
@@ -414,9 +414,9 @@ void nilfs_clear_dirty_page(struct page *page, bool silent)
	if (page_has_buffers(page)) {
	if (page_has_buffers(page)) {
		struct buffer_head *bh, *head;
		struct buffer_head *bh, *head;
		const unsigned long clear_bits =
		const unsigned long clear_bits =
			(1 << BH_Uptodate | 1 << BH_Dirty | 1 << BH_Mapped |
			(BIT(BH_Uptodate) | BIT(BH_Dirty) | BIT(BH_Mapped) |
			 1 << BH_Async_Write | 1 << BH_NILFS_Volatile |
			 BIT(BH_Async_Write) | BIT(BH_NILFS_Volatile) |
			 1 << BH_NILFS_Checked | 1 << BH_NILFS_Redirected);
			 BIT(BH_NILFS_Checked) | BIT(BH_NILFS_Redirected));


		bh = head = page_buffers(page);
		bh = head = page_buffers(page);
		do {
		do {
+7 −7
Original line number Original line Diff line number Diff line
@@ -1858,11 +1858,11 @@ static void nilfs_segctor_complete_write(struct nilfs_sc_info *sci)
		 */
		 */
		list_for_each_entry(bh, &segbuf->sb_payload_buffers,
		list_for_each_entry(bh, &segbuf->sb_payload_buffers,
				    b_assoc_buffers) {
				    b_assoc_buffers) {
			const unsigned long set_bits = (1 << BH_Uptodate);
			const unsigned long set_bits = BIT(BH_Uptodate);
			const unsigned long clear_bits =
			const unsigned long clear_bits =
				(1 << BH_Dirty | 1 << BH_Async_Write |
				(BIT(BH_Dirty) | BIT(BH_Async_Write) |
				 1 << BH_Delay | 1 << BH_NILFS_Volatile |
				 BIT(BH_Delay) | BIT(BH_NILFS_Volatile) |
				 1 << BH_NILFS_Redirected);
				 BIT(BH_NILFS_Redirected));


			set_mask_bits(&bh->b_state, clear_bits, set_bits);
			set_mask_bits(&bh->b_state, clear_bits, set_bits);
			if (bh == segbuf->sb_super_root) {
			if (bh == segbuf->sb_super_root) {
@@ -2132,10 +2132,10 @@ static void nilfs_segctor_start_timer(struct nilfs_sc_info *sci)
static void nilfs_segctor_do_flush(struct nilfs_sc_info *sci, int bn)
static void nilfs_segctor_do_flush(struct nilfs_sc_info *sci, int bn)
{
{
	spin_lock(&sci->sc_state_lock);
	spin_lock(&sci->sc_state_lock);
	if (!(sci->sc_flush_request & (1 << bn))) {
	if (!(sci->sc_flush_request & BIT(bn))) {
		unsigned long prev_req = sci->sc_flush_request;
		unsigned long prev_req = sci->sc_flush_request;


		sci->sc_flush_request |= (1 << bn);
		sci->sc_flush_request |= BIT(bn);
		if (!prev_req)
		if (!prev_req)
			wake_up(&sci->sc_wait_daemon);
			wake_up(&sci->sc_wait_daemon);
	}
	}
@@ -2319,7 +2319,7 @@ int nilfs_construct_dsync_segment(struct super_block *sb, struct inode *inode,
}
}


#define FLUSH_FILE_BIT	(0x1) /* data file only */
#define FLUSH_FILE_BIT	(0x1) /* data file only */
#define FLUSH_DAT_BIT	(1 << NILFS_DAT_INO) /* DAT only */
#define FLUSH_DAT_BIT	BIT(NILFS_DAT_INO) /* DAT only */


/**
/**
 * nilfs_segctor_accept - record accepted sequence count of log-write requests
 * nilfs_segctor_accept - record accepted sequence count of log-write requests
Loading