log.c (22164fbe274c2dd96d2887fe121896d321000a61) | log.c (2e9eeaa1175112ac494ba3c2ea4b71b1febeb6ab) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. 4 * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. 5 */ 6 7#include <linux/sched.h> 8#include <linux/slab.h> --- 23 unchanged lines hidden (view full) --- 32#include "trace_gfs2.h" 33 34static void gfs2_log_shutdown(struct gfs2_sbd *sdp); 35 36/** 37 * gfs2_struct2blk - compute stuff 38 * @sdp: the filesystem 39 * @nstruct: the number of structures | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. 4 * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. 5 */ 6 7#include <linux/sched.h> 8#include <linux/slab.h> --- 23 unchanged lines hidden (view full) --- 32#include "trace_gfs2.h" 33 34static void gfs2_log_shutdown(struct gfs2_sbd *sdp); 35 36/** 37 * gfs2_struct2blk - compute stuff 38 * @sdp: the filesystem 39 * @nstruct: the number of structures |
40 * @ssize: the size of the structures | |
41 * 42 * Compute the number of log descriptor blocks needed to hold a certain number 43 * of structures of a certain size. 44 * 45 * Returns: the number of blocks needed (minimum is always 1) 46 */ 47 | 40 * 41 * Compute the number of log descriptor blocks needed to hold a certain number 42 * of structures of a certain size. 43 * 44 * Returns: the number of blocks needed (minimum is always 1) 45 */ 46 |
48unsigned int gfs2_struct2blk(struct gfs2_sbd *sdp, unsigned int nstruct, 49 unsigned int ssize) | 47unsigned int gfs2_struct2blk(struct gfs2_sbd *sdp, unsigned int nstruct) |
50{ 51 unsigned int blks; 52 unsigned int first, second; 53 54 blks = 1; | 48{ 49 unsigned int blks; 50 unsigned int first, second; 51 52 blks = 1; |
55 first = (sdp->sd_sb.sb_bsize - sizeof(struct gfs2_log_descriptor)) / ssize; | 53 first = sdp->sd_ldptrs; |
56 57 if (nstruct > first) { | 54 55 if (nstruct > first) { |
58 second = (sdp->sd_sb.sb_bsize - 59 sizeof(struct gfs2_meta_header)) / ssize; | 56 second = sdp->sd_inptrs; |
60 blks += DIV_ROUND_UP(nstruct - first, second); 61 } 62 63 return blks; 64} 65 66/** 67 * gfs2_remove_from_ail - Remove an entry from the ail lists, updating counters --- 400 unchanged lines hidden (view full) --- 468 dbuf = tr->tr_num_databuf_new - tr->tr_num_databuf_rm; 469 reserved = mbuf + dbuf; 470 /* Account for header blocks */ 471 reserved += DIV_ROUND_UP(mbuf, buf_limit(sdp)); 472 reserved += DIV_ROUND_UP(dbuf, databuf_limit(sdp)); 473 } 474 475 if (sdp->sd_log_commited_revoke > 0) | 57 blks += DIV_ROUND_UP(nstruct - first, second); 58 } 59 60 return blks; 61} 62 63/** 64 * gfs2_remove_from_ail - Remove an entry from the ail lists, updating counters --- 400 unchanged lines hidden (view full) --- 465 dbuf = tr->tr_num_databuf_new - tr->tr_num_databuf_rm; 466 reserved = mbuf + dbuf; 467 /* Account for header blocks */ 468 reserved += DIV_ROUND_UP(mbuf, buf_limit(sdp)); 469 reserved += DIV_ROUND_UP(dbuf, databuf_limit(sdp)); 470 } 471 472 if (sdp->sd_log_commited_revoke > 0) |
476 reserved += gfs2_struct2blk(sdp, sdp->sd_log_commited_revoke, 477 sizeof(u64)); | 473 reserved += gfs2_struct2blk(sdp, sdp->sd_log_commited_revoke); |
478 /* One for the overall header */ 479 if (reserved) 480 reserved++; 481 return reserved; 482} 483 484static unsigned int current_tail(struct gfs2_sbd *sdp) 485{ --- 583 unchanged lines hidden --- | 474 /* One for the overall header */ 475 if (reserved) 476 reserved++; 477 return reserved; 478} 479 480static unsigned int current_tail(struct gfs2_sbd *sdp) 481{ --- 583 unchanged lines hidden --- |